LifterLMS_REST_API::load_textdomain()
Load l10n files.
Description Description
This method is only used when the plugin is loaded as a standalone plugin (for development purposes), otherwise (when loaded as a library from within the LifterLMS core plugin) the localization strings are included into the LifterLMS Core plugin’s po/mo files and are localized by the LifterLMS core plugin.
Files can be found in the following order (The first loaded file takes priority):
- WP_LANG_DIR/lifterlms/lifterlms-rest-LOCALE.mo
- WP_LANG_DIR/plugins/lifterlms-rest-LOCALE.mo
- WP_CONTENT_DIR/plugins/lifterlms-rest/i18n/lifterlms-rest-LOCALE.mo
Note: The function load_plugin_textdomain()
is not used because the same textdomain as the LifterLMS core is used for this plugin but the file is named lifterlms-rest
in order to allow using a separate language file for each codebase.
Return Return
(void)
Source Source
File: libraries/lifterlms-rest/class-lifterlms-rest-api.php
*/ public function load_textdomain() { // Load locale. $locale = apply_filters( 'plugin_locale', get_locale(), 'lifterlms' ); // Load from the LifterLMS "safe" directory if it exists. load_textdomain( 'lifterlms', WP_LANG_DIR . '/lifterlms/lifterlms-rest-' . $locale . '.mo' ); // Load from the default plugins language file directory. load_textdomain( 'lifterlms', WP_LANG_DIR . '/plugins/lifterlms-rest-' . $locale . '.mo' ); // Load from the plugin's language file directory. load_textdomain( 'lifterlms', LLMS_REST_API_PLUGIN_DIR . '/i18n/lifterlms-rest-' . $locale . '.mo' );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.17 | Fixed the name of the MO loaded from the safe directory: lifterlms-{$locale}.mo to lifterlms-rest-{$locale}.mo . Fixed double slash typo in plugin textdomain path argument. Fixed issue causing language files to not load properly. |
1.0.0-beta.1 | Introduced. |