Legal stuff about this site and your private life:

  • We use a cookie to keep your preferences (language, NSFW status, login status) during navigation.
  • We use your local storage to save the announces you closed (like this one).
  • We don't save informations you don't give
  • We don't share your email address if you comment or register
  • There is no tracker of any kind.

If you're not OK with this, move your way.

As the last update was about the different languages on user submitted content, it's time to internationalize Elabs, the core.

Here is the beggining of this wonderful journey.

All the strings in the source code were written in english (hum... almost everything), using the internationalization functions of CakePHP : __('The string') and __d('domain', 'The string') mostly.

I choosed to divide my app in multiple parts, the domains, to make the translation easier, as it's generally something we do in the end, so I had elabs, posts, projects,... elabs being the domain of all the shared strings.

As I don't have time to work everydays on it, I slowly mixed singulars and plural domain names, sometimes assigning a string to a domain it don't belong to. So I had the bad surprise to find a lot .pot files in the extraction, and their content was a real mess.

Finally, I fell back to a unique domain name, 'elabs', with all the strings. Here where the steps to batch replace existing content in the src dir:

  • Change all domains to elabs: replace __d\('[a-z]*' with __d('elabs' (regex on, all files)
  • Add a domain on all the strings with no domain: replace __(' with __d('elabs', (plain text, all files)

The next step was to re-generate the .pot files: ./bin/cake i18n extract, using the default propositions except for the one about extracting the core strings.

And now I have a unique elabs.pot file, with all the strings of my app to translate. Opening it with poEdit gave me a small heart attack: a lot of strings were almost the same, with only small differences with ponctuation and/or spaces, plurals without singular versions for counts, hardcoded html and other nice things.

And a lot of strings totally weird, when read out of their context.

Happily, CakePHP have a strong internationalization support, so i'll have to read the docs and re-work my code. That may not be the smartest thing to do at this point, as it will block the development of other features, but I need to know...

To be continued...

Leave a comment

You want to react to this content or ask something to the author? Just leave a comment here!

Note that the comments are not publicly visible, so don't worry if you don't see yours.

All the information you give will only be visible to the author. We don't share anything with anyone.

Don't fill this field if you want this form to be saved.