Translating a package

Permalink
Hello there,


I have a package which I would like to translate to Danish. I have used the t() function throughout my package and have used English strings.

I followed the following guide from the documentation:
http://www.concrete5.org/documentation/developers/system/localizati...

Therefore, I created the following directories:
"root/packages/mypackage/languages/da_DK/LC_MESSAGES"

And added an "messages.mo" file in that directory. Then I added "define('LOCALE', 'da_DK');" in "root/config/site.php".

I tried to translate some strings (the file and line numbers are correct in the .po file), but it is not working. Clearing the cache does not help. I tried to use the plural form for Danish that I found on this website:
http://translate.sourceforge.net/wiki/l10n/pluralforms...

But still no luck. I have translated several times in other frameworks without problems.

What on Earth am I doing wrong?

 
mlocati replied on at Permalink Reply
mlocati
Hi

I've just published a php tool that may be useful for managing .po/.mo files.

Just download the two files base.php and i18n.php from
https://github.com/concrete5/concrete5/pull/670/files...

and launch the following command:
php i18n.php --webroot=RootFolderOfConcrete5 --interactive --languages=da_dk
(or php i18n.php --help for more options)

With this utility you'll be able to create the .pot file (the template used as "base" for all the translations), the .po file for the language, and the .mo file from the .po file.

(Please remark that the .po file is the one that should be translated with poedit or betterpoeditor)
andy17 replied on at Permalink Reply
Thank you for the answers.

Here is the solution as far as I remember. If you are trying to translate to Spanish, then you must have the Spanish language files in root/languages; otherwise your package will not even be attempted to be translated. This is what caught me; I thought I could keep my concrete5 in English (though with a Danish setting) and then have my package translated only. However, when I put the Danish concrete5 language files into root/languages/da_DK/LC_MESSAGES/messages.mo, my package translated as well.