How to read Languages from /wp-content/languages for Child-Theme

Hi there!

Is it possible to tell my Child-Theme (via functions.php) to read the x.po/x.mo from /wp-content/languages/ instead of /wp-content/themes/x-child/languages/ ?

This could allow me to set multiple Multisite Child-Sites to read the same language pack, stored on the main Languages Directory.

Thanks in advance!

Hello There,

Thanks for writing in! You can directly place the translation files in /wp-content/languages/. You must named it correctly though. It should be for example:

__x__-en_US.po
__x__-en_US.mo
__x__-en_GB.po
__x__-en_GB.mo

Hope this helps. Please let us know how it goes.

Thank you @RueNel!

You mean:

x-pt_BR.po
x-pt_BR.mo

Is that correct? I cand understand that double underscores before and after x…

I have something on my functions.php to load from the X-Child folder…

add_action( 'after_setup_theme', 'load_child_language' );
	function load_child_language() {
		load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' );

Should I remove that? Or change that? Thanks!

It’s not working :frowning:

Hey There,

The names of the translation files is incorrect. Please rename it to:

__x__-pt_BR.po
__x__-pt_BR.mo

And this should be uploaded in /wp-content/languages/themes/ instead.

Please let us know if this works out for you.

Perfect! Thank you so much @RueNel!

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.