\DevOwl\RealCookieBannerLocalization

i18n management for backend and frontend.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
clearMoCacheDir()
getLanguageFromFile()
override_load_textdomain()
hooks()
getPotLanguages()
getMoCacheDir()
multilingual()
No public properties found
COMMON_SKIP_KEYS
getPackageInfo()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

COMMON_SKIP_KEYS

COMMON_SKIP_KEYS =array('slug')

Keys of array which should be not translated with `translateArray`.

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

Returns

string

clearMoCacheDir()

clearMoCacheDir(string  $slug)

Clear the MO cache directory for a given plugin.

Parameters

string $slug

getLanguageFromFile()

getLanguageFromFile(string  $file)

Obtain language key from a file name.

Parameters

string $file

override_load_textdomain()

override_load_textdomain(boolean  $plugin_override,string  $domain,string  $mofile)

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

TODO: make this configurable per plugin?

This filter is directly implemented in override_load_textdomain but keep for history.

Parameters

boolean $plugin_override
string $domain
string $mofile

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.

getMoCacheDir()

getMoCacheDir(string  $slug)

Get the cache directory for cached MO files after parsing. It also checks, if the directory is writable and create the path for a given plugin slug.

This function is expensive, so we cached it to $GLOBALS.

Parameters

string $slug

multilingual()

multilingual()

Make our plugin multilingual with the help of `AbstractSyncPlugin` and `Sync`! Also have a look at `BannerCustomize`, there are `LanguageDependingOption`'s.

getPackageInfo()

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

Get the directory where the languages folder exists.

Parameters

string $type

Returns

array<mixed,string>