\MatthiasWeb\RealMediaLibraryLocalization

i18n management for backend and frontend.

Summary

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

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

getPackageInfo()

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

Get the directory where the languages folder exists.

Parameters

string $type

Returns

array<mixed,string>