Language .po and .mo totally ignored

Hello,

I’ve downloaded the original language .mo and .po files translations (it_IT) from the official repository https://github.com/roots/sage-translations.
I put them in the theme-folder/lang/, and added load_theme_textdomain( 'sage', get_template_directory() . '/lang' ); inside the after_setup_theme function in setup.php.

But the translations are not loaded (for example when going to the 404 page), I still see the english strings.

I tried to disable the Polylang plugin, but the issue remains. I didn’t change the text_domain from ‘sage’.

1 Like

I tried to put the language files inside web/app/languages/themes, prepending the theme name, and it works. Why is that the case?

https://github.com/roots/sage-translations is for Sage 8, sorry for the confusion

See https://github.com/roots/docs/issues/96 for links to Sage 9 related translation info (I’ll be adding this to official docs shortly!)

1 Like

My problem seems different, or it’s my fault and I didn’t get how to solve it.

Wordpress seems to totally ignore the lang folder inside the theme one (even if I define it in setup.php as stated above), but it loads the web/app/languages/themes/themename-IT_it.mo.

Maybe this will help?

Already done, it doesn’t work.

You would need to put the files into theme-name/resources/lang rather than theme-name/lang

1 Like

Ok, my bad to put the files in the wrong folder. Thanks for your support!

1 Like

No problem, sorry this wasn’t already documented more clearly! Adding it to the docs right now

Edit: https://roots.io/sage/docs/theme-localization/

1 Like