\DevOwl\RealProductManagerWpClientLocalization

Package localization for `real-product-manager-wp-client` package.

For non-utils packages you need to extend from this class and properly fill the constructor.

Summary

Methods
Properties
Constants
getRootSlug()
getPackage()
getPackageDir()
instance()
getLanguageFromFile()
load_textdomain_mofile()
hooks()
getPotLanguages()
instanceThis()
$PACKAGE_INFO_FRONTEND
$PACKAGE_INFO_BACKEND
No constants found
__construct()
getPackageInfo()
No protected properties found
N/A
No private methods found
$rootSlug
$packageDir
N/A

Properties

$PACKAGE_INFO_FRONTEND

$PACKAGE_INFO_FRONTEND :

Type

$PACKAGE_INFO_BACKEND

$PACKAGE_INFO_BACKEND :

Type

$rootSlug

$rootSlug :

Type

$packageDir

$packageDir :

Type

Methods

getRootSlug()

getRootSlug(): string

Getter.

Returns

string

getPackage()

getPackage(): string

Get package name.

Returns

string

getPackageDir()

getPackageDir(): string

Getter.

Returns

string

instance()

instance(string  $rootSlug,string  $packageDir): \MatthiasWeb\Utils\PackageLocalization

New instance.

Parameters

string $rootSlug
string $packageDir

Returns

\MatthiasWeb\Utils\PackageLocalization

getLanguageFromFile()

getLanguageFromFile(string  $file)

Obtain language key from a file name.

Parameters

string $file

load_textdomain_mofile()

load_textdomain_mofile(string  $mofile,string  $domain)

Never load `.mo` files from `wp-content/plugins/languages` as we do manage all our translations ourself.

TODO: make this configurable per plugin?

Parameters

string $mofile
string $domain

hooks()

hooks()

Add filters to WordPress runtime.

getPotLanguages()

getPotLanguages()

Get the languages which are available in the POT file. Why multiple? Imagine you want to use the pot file for `en_US` and `en_GB`. This can be useful for the `@devowl-wp/multilingual` package, especially the `TemporaryTextDomain` feature.

instanceThis()

instanceThis()

Create instance.

__construct()

__construct()

C'tor.

getPackageInfo()

getPackageInfo(string  $type): array<mixed,string>

Get the directory where the languages folder exists.

The returned string array should look like this: [0] = Full path to the "languages" folder [1] = Used textdomain [2]? = Use different prefix domain in filename

Parameters

string $type

Returns

array<mixed,string>