I'm trying to translate a WordPress template. I went to language files, then opened that copy with Poedit and started translating to my language (persian).
After finishing the translation, I changed the WordPress language from the dashboard, but the language didn't change in the template settings panel, it stays on English. Any idea why this happens?
These are the language instructions from functions.php:
load_theme_textdomain( 'apress', get_template_directory() . '/languages' );
I'm trying to translate a WordPress template. I went to language files, then opened that copy with Poedit and started translating to my language (persian).
After finishing the translation, I changed the WordPress language from the dashboard, but the language didn't change in the template settings panel, it stays on English. Any idea why this happens?
These are the language instructions from functions.php:
load_theme_textdomain( 'apress', get_template_directory() . '/languages' );
Share
Improve this question
edited May 7, 2019 at 7:29
Vishwa
3762 silver badges17 bronze badges
asked May 7, 2019 at 7:11
Arash KhademlooArash Khademloo
1
5
|
1 Answer
Reset to default 0According to docs, load_theme_textdomain()
function should generally be called from within the after_setup_theme action hook.
add_action( 'after_setup_theme', 'my_theme_setup' );
function my_theme_setup(){
load_theme_textdomain( 'apress', get_template_directory() . '/languages' );
}
mo
file? – Nilambar Sharma Commented May 7, 2019 at 7:37load_theme_textdomain
in any hook or standalone? – anton Commented May 7, 2019 at 8:13