I am trying to translate a wordpress site but whatever I do the english file is always loaded.
In functions.php I’ve set load_theme_textdomain('twentyeleven', get_template_directory() . '/languages');
In the template page I use <?php _e('HOME', 'twentyeleven'); ?>
And in wp-config.php
the language is set like this (I use the qtranslate plugin)
$enabledLanguages = qtrans_getSortedLanguages();
$uri = $_SERVER['REQUEST_URI'];
$path = explode('/', $uri);
if (in_array($path[1], $enabledLanguages)) {
define('_1D1F_LANG_', $path[1]);
if (_1D1F_LANG_ == 'en') {
define('WPLANG', 'en_US'); // exception to set en_US not en_EN ;_;
}
else {
$lang = _1D1F_LANG_.'_'.strtoupper(_1D1F_LANG_);
define('WPLANG', $lang);
}
}
else {
$defaultLang = get_option('qtranslate_default_language');
define('_1D1F_LANG_', $defaultLang);
define('WPLANG', 'en_US');
}
The WPLANG
constant is correctly set, but the en_US.mo file is always loaded not matter what happens.
Anybody has an idea what I am doing wrong? I’ve used the same process on another site and it worked…