Translation Loading Issue
-
Hello,
- I tried to load the translation from the path:
/wp-content/languages/plugins/mxchat-de_AT.mo
but the language is not loading. - I attempted to load
mxchat-de_AT.mofrom the path:/mxchat-basic/languages/mxchat-de_AT.mo
and within the plugin it works correctly. - Therefore, the naming is correct, but upon inspecting the file
mxchat-basic.php, I noticed that the code line:load_plugin_textdomain('mxchat', false, dirname(plugin_basename(__FILE__)) . '/languages');
is intentionally or unintentionally programmed to load the language only from the plugin’s language file, which is unacceptable.
Please, if this is not a problem, ensure that the language is also loaded from the path:/wp-content/languages/plugins/so that the language is not overwritten every time the plugin is updated.
maybe something like this…:
function mxchat_load_textdomain() {
$domain = 'mxchat';
$wp_mo_file = WP_LANG_DIR . '/plugins/' . $domain . '-' . get_locale() . '.mo';
if (file_exists($wp_mo_file)) {
load_textdomain($domain, $wp_mo_file);
}
$plugin_mo_file = dirname(plugin_basename(__FILE__)) . '/languages/' . $domain . '-' . get_locale() . '.mo';
if (file_exists(plugin_dir_path(__FILE__) . $plugin_mo_file)) {
load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages');
}
}
add_action('init', 'mxchat_load_textdomain');Best regards,
- I tried to load the translation from the path:
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.