Package internationalization not working

Permalink
I am internationalizing a site of ours and have set it up successfully to find the translations in my /languages/xx_XX/LC_MESSAGES/messages.mo file but can't seem to get the translations in my /packages/mypackage/languages/xx_XX/LC_MESSAGES/messages.mo file to be used. I've tried removing the root /languages directory in case that would override any package-specific translations with no luck. If I point the /languages directory at my /packages/mypackage/languages directory using a soft link it works so I know things are generally right, I just can't seem to make c5 use the translation for the package the way I understand it should. Any ideas what I could be doing wrong?

 
A3020 replied on at Permalink Reply
A3020
I guess you already tried to empty your cache and flushed APC or opcache or whatever you're using?

Also, check the size of the .mo file. Zend Locale checks the file size and skips it if it only contains 1 translation for example. How many KB is yours?
nklatt replied on at Permalink Reply
Thanks for the ideas. The messages.mo file is 18k and clearing caches doesn't help anything - I can turn on and off the translation by moving the languages directory between root and under /packages/<mypackage> so the file is good, it just seems to be ignored unless it's directly under /. I've tried creating the structure and files using both the Translations Manager add-on and Michele Locati's i18n.php utility (https://github.com/mlocati/concrete5-build) and both sets of files exhibit the same behavior.

It seems like there must be something wrong with my config or something, that c5 either needs to be told to look for the files within the packages or that I'm somehow telling it not to do so. All caching is turned off - Blocks, Overrides, and Full Page - I specifically checked for the Overrides Cache in case it had locked into using the root version but it was already turned off.

Thanks again - any other ideas? Anybody?
nklatt replied on at Permalink Reply
Think I got it figured out! Looking in /concrete/core/libraries/localization.php, function setLocale, it only will set the locale if there is a directory for the passed-in $locale in either /languages or /concrete/languages. If neither of those exist, c5 (or Zend) will not look in the various package directories for translations.

As a test, I downloaded the language pack for the c5 core fromhttp://www.concrete5.org/developers/translate/... and unzipped it in / then my package translations were found!
mlocati replied on at Permalink Reply
mlocati
It's quite an important thing to know!
I updated my "Translate your package" how-to (http://www.concrete5.org/documentation/how-tos/developers/translate... ) to state that.
nklatt replied on at Permalink Reply
Thanks Michele!
tdausner replied on at Permalink Reply
tdausner
Faced the same or similar problem on 8.0.3 and found a different solution. See https://www.concrete5.org/developers/bugs/8-0-3/no-translated-messag...
linuxoid replied on at Permalink Reply
linuxoid
I may have come across the same or maybe a new issue. I have C5-8.2.1.

I have a weird localization bahavior. I translated my package. When I add my package, the form to add my block is translated. But when the block is placed - nothing is translated. Also in the Dashboard, nothing on the Add Functionality is translated, but when I click to see details of the block - everything IS translated. How come?

I have a single language (not multilingual) site, the interface is set to the language

And it's not just my package. Any translated package does this.

More here:
https://github.com/concrete5-community-store/community_store/issues/...
https://www.concrete5.org/community/forums/internationalization/c5-8...
linuxoid replied on at Permalink Reply
linuxoid
[UPDATE] This is THE problem and C5 bug:
I always install C5 on all sites with the default English language. It's just easier for me. Then I change the language in Dashboard just before I release the site.

Now, I've just deleted my site from my PC, cleared the DB as well and reinstalled C5-8.2.1 from scratch BUT I selected Russian language from the very beginning... installed everything in Russian, installed my package - and here we go, the package is fully translated!!!

Yes, the Community Store is now fully translated too!

So, to reproduce the bug: install C5 in English, change site language, install a translated package.