Created
January 9, 2016 17:33
-
-
Save larsmqller/7af1b6492422938c527c to your computer and use it in GitHub Desktop.
WordPress Language translation, stuff i forget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/ | |
https://localise.biz/help/wordpress/loading-translations | |
"If WordPress fails to find a MO file at this exact location, it will then look in the global languages directory" | |
So in short, WordPress will look in only two places for a theme's MO file: | |
{absolute_path}/{locale}.mo | |
wp-content/languages/themes/{domain}-{locale}.mo | |
e.g. for twentyfourteen's French translations: | |
wp-content/themes/twentyfourteen/languages/fr_FR.mo | |
wp-content/languages/themes/twentyfourteen-fr_FR.mo | |
/* | |
add_filter('locale', 'different_backend_lang', 1); | |
function different_backend_lang($locale) { | |
if ( is_admin() ) { | |
$locale = 'en_US'; // Backend | |
} else | |
$locale = 'da_DK'; // Frontend | |
return $locale; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment