llms_switch_to_site_locale( string $textdomain = 'lifterlms', string $plugin_dir = null, string $language_dir = null )
Switch LifterLMS language to site language.
Parameters Parameters
- $textdomain
-
(string) (Optional) Text domain. Defaults to lifterlms.
Default value: 'lifterlms'
- $plugin_dir
-
(string) (Optional) Plugin directory. Defaults to null.
Default value: null
- $language_dir
-
(string) (Optional) Language directory. Defaults to null.
Default value: null
Source Source
File: includes/functions/llms-functions-l10n.php
function llms_switch_to_site_locale( $textdomain = 'lifterlms', $plugin_dir = null, $language_dir = null ) {
global $wp_locale_switcher;
if ( function_exists( 'switch_to_locale' ) && isset( $wp_locale_switcher ) ) {
switch_to_locale( get_locale() );
// Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
add_filter( 'plugin_locale', 'get_locale' );
llms_load_textdomain( $textdomain, $plugin_dir, $language_dir );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.6.0 | Introduced. |