Astra_Theme_Extension::load_textdomain()
Load Astra Pro Text Domain.
Description
This will load the translation textdomain depending on the file priorities.
- Global Languages /wp-content/languages/astra-addon/ folder
- Local dorectory /wp-content/plugins/astra-addon/languages/ folder
Return
(void)
Source
File: classes/class-astra-theme-extension.php
public function load_textdomain() { // Default languages directory for Astra Pro. $lang_dir = ASTRA_EXT_DIR . 'languages/'; /** * Filters the languages directory path to use for Astra Addon. * * @param string $lang_dir The languages directory path. */ $lang_dir = apply_filters( 'astra_languages_directory', $lang_dir ); // Traditional WordPress plugin locale filter. global $wp_version; $get_locale = get_locale(); if ( $wp_version >= 4.7 ) { $get_locale = get_user_locale(); } /** * Language Locale for Astra Pro * * @var $get_locale The locale to use. Uses get_user_locale()` in WordPress 4.7 or greater, * otherwise uses `get_locale()`. */ $locale = apply_filters( 'plugin_locale', $get_locale, 'astra-addon' ); $mofile = sprintf( '%1$s-%2$s.mo', 'astra-addon', $locale ); // Setup paths to current locale file. $mofile_local = $lang_dir . $mofile; $mofile_global = WP_LANG_DIR . '/plugins/' . $mofile; if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/astra-addon/ folder. load_textdomain( 'astra-addon', $mofile_global ); } elseif ( file_exists( $mofile_local ) ) { // Look in local /wp-content/plugins/astra-addon/languages/ folder. load_textdomain( 'astra-addon', $mofile_local ); } else { // Load the default language files. load_plugin_textdomain( 'astra-addon', false, 'astra-addon/languages' ); } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |