mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Theme Translations: Allow for theme pomo files to be loaded from WP_LANG_DIR/themes/{$domain}-{$locale}.(p|m)o.
This directory format is what we have chosen for Language Packs (See #18200), but which is currently delayed. By making this change, we can ship localised theme files within core for bundled themes, and avoid the issues associated with Theme Updates overwriting/removing the language files. Fixes #18960 git-svn-id: http://core.svn.wordpress.org/trunk@22346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
41c2935278
commit
57785c7fea
@ -459,9 +459,16 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
|
|||||||
function load_theme_textdomain( $domain, $path = false ) {
|
function load_theme_textdomain( $domain, $path = false ) {
|
||||||
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
|
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
|
||||||
|
|
||||||
$path = ( empty( $path ) ) ? get_template_directory() : $path;
|
if ( ! $path )
|
||||||
|
$path = get_template_directory();
|
||||||
|
|
||||||
$mofile = "$path/$locale.mo";
|
// Load the textdomain from the Theme provided location, or theme directory first
|
||||||
|
$mofile = "{$path}/{$locale}.mo";
|
||||||
|
if ( $loaded = load_textdomain($domain, $mofile) )
|
||||||
|
return $loaded;
|
||||||
|
|
||||||
|
// Else, load textdomain from the Language directory
|
||||||
|
$mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
|
||||||
return load_textdomain($domain, $mofile);
|
return load_textdomain($domain, $mofile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,12 +485,9 @@ function load_theme_textdomain( $domain, $path = false ) {
|
|||||||
* @param string $domain Unique identifier for retrieving translated strings
|
* @param string $domain Unique identifier for retrieving translated strings
|
||||||
*/
|
*/
|
||||||
function load_child_theme_textdomain( $domain, $path = false ) {
|
function load_child_theme_textdomain( $domain, $path = false ) {
|
||||||
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
|
if ( ! $path )
|
||||||
|
$path = get_stylesheet_directory();
|
||||||
$path = ( empty( $path ) ) ? get_stylesheet_directory() : $path;
|
return load_theme_textdomain( $domain, $path );
|
||||||
|
|
||||||
$mofile = "$path/$locale.mo";
|
|
||||||
return load_textdomain($domain, $mofile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user