Skip to content

Instantly share code, notes, and snippets.

@larsmqller
Created January 9, 2016 17:33
Show Gist options
  • Save larsmqller/7af1b6492422938c527c to your computer and use it in GitHub Desktop.
Save larsmqller/7af1b6492422938c527c to your computer and use it in GitHub Desktop.
WordPress Language translation, stuff i forget.
*/
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