Advanced Translations? |
[eluser]Tom Vogt[/eluser]
I've just started working with CI, and I'm wondering about the translation engine: How do I do translations beyond simple string replacements? Imagine I have a page that says something like: "You have 123 new messages." Obviously, in different languages, the sentence structure would be different, so just splitting it into something like $lang['You have'].$Number.$lang['new messages'] wouldn't work. So how do I do it in CI?
[eluser]Tom Vogt[/eluser]
Yeah, I know about gettext. I was wondering if there's a plugin, helper, library or anything to include gettext (whatever implementation) in CI.
[eluser]esra[/eluser]
There is a Language extension and Language Select class posted on the forums and possibly on the wiki. It basically allows the user to switch between languages. I believe that this contribution was due to be merged into the Kohana fork. If you're interested in a solution for switching between languages based on IP addresss and its associated locale, you might take a look at how this was handled in the Rapyd library for CI. You can roll your own Language extension and store a current language value in a session. I believe this has been discussed elsewhere on the forums.
[eluser]xwero[/eluser]
I haven't used the language functions of CI but the way i do it is to have a placeholder in the string Code: // language files Maybe it should be build in somewhere in the functions to recognize placeholders.
[eluser]Armchair Samurai[/eluser]
This was also recently discussed here: http://ellislab.com/forums/viewthread/57331/ |
Welcome Guest, Not a member yet? Register Sign In |