llms_load_textdomain( string $domain, string|null $plugin_dir = null, string|null $language_dir = null )
Load MO format localization files for the given text domain
Description Description
This function localizes using the WP Core’s default language file directories as a after checking in the LifterLMS-defined "safe" directory.
Language files files can be found in the following locations (The first loaded file takes priority):
-
wp-content/languages/{$domain}/{$domain}-{$locale}.mo
This is recommended "safe" location where custom language files can be stored. A file stored in this directory will never be automatically overwritten.
-
wp-content/languages/plugins/{$domain}-{$locale}.mo
This is the default directory where WordPress will download language files from the WordPress GlotPress server during updates. If you store a custom language file in this directory it will be overwritten during updates.
-
wp-content/plugins/{$domain}/languages/{$domain}-{$locale}.mo
This is the the LifterLMS plugin directory. A language file stored in this directory will be removed from the server during a LifterLMS plugin update.
Parameters Parameters
- $domain
-
(string) (Required) Textdomain being loaded.
- $plugin_dir
-
(string|null) (Optional) Full path to the plugin directory, if none supplied
LLMS_PLUGIN_DIR
is used.Default value: null
- $language_dir
-
(string|null) (Optional) Relative path to the language directory within the plugin. If none supplied,
languages
is used.Default value: null
Return Return
(void)
Source Source
File: includes/functions/llms-functions-l10n.php
function llms_load_textdomain( $domain, $plugin_dir = null, $language_dir = null ) { $plugin_dir = $plugin_dir ? $plugin_dir : LLMS_PLUGIN_DIR; $language_dir = $language_dir ? $language_dir : 'languages'; /** * Load from the custom LifterLMS "safe" directory (if it exists). * * Example path: wp-content/languages/lifterlms/lifterlms-en_US.mo */ load_textdomain( $domain, sprintf( '%1$s/%2$s-%3$s.mo', llms_l10n_get_safe_directory(), $domain, llms_get_locale( $domain ) ) ); /** * Load from default plugin locations specified by the WP core. * * 1. wp-content/languages/plugins/lifterlms-en_US.mo * 2. wp-content/plugins/lifterlms/languages/lifterlms-en_US.mo */ load_plugin_textdomain( $domain, false, sprintf( '%1$s/%2$s', basename( $plugin_dir ), $language_dir ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |