CodeIgniter Forums
Internationalization in CI - any good examples? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Internationalization in CI - any good examples? (/thread-32664.html)

Internationalization in CI - any good examples? - El Forum - 07-30-2010

Does anybody have good examples of internationalizing the site built on CI?
I am trying to build a complex solution where a site can reflect language, country, city selection independent of each other. For example, someone wants to see products located in New York but wants to choose spanish as prefered language.

The difficulty I am having is to make this work independent of each other. I am trying to avoid passing this through the URI, because then, every link on every page needs to be re-done to pass these settings on to the next page. I am leaning towards using sub domains... but how can I distinguish country, city and language within a subdomain?
Example (may not be good, but it shows the concept): - all products, site language english - all products, site language french - all products in Canada, site language french - all products in New York, USA, site language spanish

The catch with this method is there is no set pattern, such as so a situation like may lead to either showing all products with site language being Spanish, or showing all products for spain with site default language being english.

Anyone has better ideas or knows of a "proper" way to do it in CI?

I have looked at the i18n wiki extension for CI, but it focuses on loading language specific views. I am not excited about creating multiple version of same view, particularly when all my views are just html code. I store actual text you see on the page in lang array. So what I would need is to load a specific lang file once language is identified. I am leaning toward solution, but the .../lang/controller/... part worries me since for some controllers I have routes that pass everything after /controller/ as variables in no particular order. Then I catch them using uri_helper returning array($var1=>$value).

And there is still the issue of writing /lang/ into all consecutive urls throughout the whole site