API / Minn\Runtime / Translations

Translations final class

Minn\Runtime\Translations · public/minn/src/Minn/Runtime/Translations.php · 174 lines

The translations a request loads, as WordPress's l10n functions load them: the locale in force, a text domain loaded from its file (or its folder named for later) and unloaded, the default domain, a plugin's, a user's locale, and the translations installed on disk; each step with the filters that may answer first.

Public

staticfolderFiles(string $path): mixed#

The translation files in a folder (WP_Textdomain_Registry::get_language_files_from_path): the folder as pre_get_language_files_from_path hears it, trailing slash and all, may answer; else its .mo and .l10n.php files, listed once a request in the translation_files cache group.

staticforgetFolders(mixed $hookExtra): void#

After an upgrade that installed translations, the listings of the folders they went to are forgotten (WP_Textdomain_Registry::invalidate_mo_files_cache): the plugins or themes language folder, else the language folder itself.

staticlocale(): string#

The locale in force (determine_locale): a switched one, else pre_determine_locale, else the configured one through determine_locale.

staticload(mixed $domain, mixed $mofile, mixed $locale = NULL): bool#

A text domain loaded from a translation file (load_textdomain), the PHP file beside the .mo first unless translation_file_format says mo; whether one loaded. Its locale becomes the one translations are looked up in, and its folder where its script translations are looked for.

staticunload(mixed $domain, mixed $reloadable = false): bool#

A text domain unloaded (unload_textdomain): whether it had files; one that did stays closed unless it may load again.

staticfromFolder(string $domain, string $folder): bool#

A domain's folder named for later (load_plugin_textdomain and the rest): nothing is read and no locale asked until the domain's first translation, which reads the folder's file for the locale then (probe text-domain-timing).

staticloadDefault(mixed $locale = NULL): bool#

The default domain loaded again for a locale, the one in force unless named (load_default_textdomain).

staticloadPlugin(mixed $domain, mixed $deprecated = false, mixed $relativePath = false): bool#

A plugin's domain named to load from its folder (load_plugin_textdomain): a path under the plugins folder when one is given; else the deprecated folder under the site's root, told as deprecated since 2.7.0; else the plugins folder itself.

staticuserLocale(mixed $user = 0): string#

A user's locale (get_user_locale), the signed-in user's for 0; the site's when the user has none or does not exist.

staticinstalled(mixed $type): array#

The translations installed (wp_get_installed_translations) for core, plugins or themes: by text domain and locale, each with its file's headers; a .po without its .mo is not one.

@return array<string, array<string, array<string, string>>>