Question

I have a site with polylang installed with 3 languages. LV as default, EN and RU. For the PLURAR(polylang does not support it) strings translation I want to use poedit locally and then copy the translated mo/po files to the child theme /language folder. I tried to translate two string, copied the created mo/po files to the server, but the at the sites frontend transaltion is not shown. I have read multiple manuals and everything should be working, but nothing really happens.

In my child themes /languages folder I even created two types of language code files lv.mo , lv.po and lv_LV.mo and lv_LV.po but nothing happens.

My child themes function.php has definition of language folder.

load_child_theme_textdomain ( 'greattheme', get_stylesheet_directory () . '/languages' );

What could be wrong with my setup?

Was it helpful?

Solution

As per Theme Handbook ⇒ Internationalization, you should call load_child_theme_textdomain() from within the after_setup_theme hook:

function load_greattheme_textdomain() {
    load_child_theme_textdomain( 'greattheme', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'load_greattheme_textdomain' );

Make sure you name your *.mo and *.po files properly (follow the link above).

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top