Welcome Guest, Not a member yet? Register   Sign In
Translating your app
#1

Hi guys,

I was kinda thinking about translating my app to support different languages but was more of an after thought rather than a necessity, so I understand codeigniter comes with a translate support option. But I was wondering if anyone has any useful tips or tricks or things to look out for when getting their application ready for different translations?

Cheers in advance.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#2

The biggest issues I would look out for are:
- $this->lang->load() will call show_error() if a language file isn't found in the current language, so you need to make sure all of your language files are supplied in every language you support.
- $this->lang->line() will return FALSE, instead of a string, if the requested line isn't found, so you will probably want to make sure that all of your language keys are included, even if you only supply a blank line during the process of putting together the translation (though generating errors in the log can be useful if you don't want to check your lang files some other way).

Bonfire modifies the Language class to load a fallback language (English by default), so, if a language other than the fallback is in use, it loads the fallback first, followed by the current language, so any lines not supplied by the current language are still in English. It also modifies the line() method to return "FIXME('{$line}')" instead of FALSE when the line is not found.

Neither of these are ideal modifications for a production site, where you would want the translations to be complete or not present them to the end user at all. However, for development they can be very useful (as long as you have a good method of tracking which lines still need to be translated).

If you're planning on adding translations, I would definitely recommend adding some sort of back-end to track the current state of the translations. For example, Bonfire's translate module will list a language file side-by-side with the existing translations of the lines in that file for a given language, and allows you to input the translations (if the file is writable). It also allows you to download a zip file of the language files for a given language to make it easier to pass those off to a translator (though you would still have to manually place the translated files into the correct locations afterwards).
Reply
#3

(This post was last modified: 10-28-2015, 03:20 PM by ignitedcms.)

Once again thanks for the advice, I'm just trawling through url SEO optimisation at the moment, but I'm almost finished, well a generic way of doing things anyway.

I will play around with the language files in codeigniter in the next few days if I get around to it. I would just like to add a fellow codeigniter forum user has the following link in his signature and looked useful enough to try out and test.

http://aldra.ca/project/translation-tester

But yes, like I said, the translation part is more of an afterthought, but I just want to get a headstart on what might be involved in implementation before my code becomes too rigid to change in terms of providing easy modular translations.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply




Theme © iAndrew 2016 - Forum software by © MyBB