How do you i18n? |
[eluser]tobben[/eluser]
As the topic ask, how do you do i18n in CI? Do you use the Wiki-suggestions or do you make it happen with another procedure?
[eluser]CI Lee[/eluser]
Generally I use hard encoded English localization which helps ensure that I alienate as many users as possible. To be honest I have not really given it much thought but you have reminded me that I need to. -Lee
[eluser]tobben[/eluser]
Yeah, I believe it will be more and more common in a digital society with no borders. It maybe count more for small countries like Norway. All of us understand english, but it's probably a bit overkill to ask foreigners to learn norwegian.
[eluser]CI Lee[/eluser]
Funny thing is I am third generation Canadian and my father was actually born in Norway, I was close to being born there as well... yet I speak not one word of it. Come to think of it its not funny... its quite sad.
[eluser]Michael Wales[/eluser]
I do the hard-coded English method of il8n as well - it's worked resoundingly well for me thus far. In all seriousness, I am currently working on a project that will probably receive some localization (I can really only foresee Spanish and French translations for the time being - crazy Canadians). I intend to use the community in much the same way as Facebook did - seeing as I'm an ignorant American that can hardly speak English properly, much less another language.
[eluser]Référencement Google[/eluser]
I am using the wiki solutions to support the internationalization stuff and sessions, but not hard coding all. It depends the situation and in 1 application I mix between hard coded files and a databse. So I adopted this rule: - If it's something about website content, like content texts or long sentences, I do that with the DB - If it's 1 word stuff or small sentence, I use generally hard coded files (ex. forms labels, error and success messages, ...) I am asking myself too wich is the best solution because I don't like too much to mix things between hard coded and DB, I am feeling that it could be better to really have all in the DB, but haven't tried to find a working solution yet.
[eluser]xwero[/eluser]
The way i do it is to put static and semi-static sentences/words in one or more language files. With semi-static i mean a sentence that has a few variables: "[0]'s won the [1] prize". Sentences/long texts that are generated by the user i store in the database. I split my tables in a language independent and a language dependent part. Code: blog I match the language directory names with the content in the language field. I found out users don't like to translate, even if they insist on a multi language site, so i don't specify the language subgroup. Hardcoding strings is one of the minor points about CI for me. I can forgive that development messages (library missing, error in the sql query, ...) are hardcoded because only developers will see them but then again you never know what can happen. If they let the hardcoded developer messages in they should create an error message routine that makes a difference between developer and user messages.
[eluser]frenzal[/eluser]
I use subsites and language files for non "content pages"
[eluser]adamp1[/eluser]
Yup same as people above, made a little library that detects a browsers language(if it can) and loads it. Otherwise it loads a default. Also allows the user to click a button and save their preference in a cookie. I find just using languages files maybe a bit more of a pain than just typing it in, but found its great when you need to reuse strings.
[eluser]Unknown[/eluser]
I'm trying to do it following the CI wiki instructions here: But I've had no luck. I'm new to MVC and CodeIgniter, so maybe I'm just missing some small detail the the instructions, for example: In step 2. Add controller i18n to manage language loading of views: What's the file named, i18n.php? Is it stored here: system->application->controllers ? In step 3. Add url helper which can also manage different languages: there are no <?PHP ?> brackets. I assume there's supposed to be, and again: What's the file named, url_helper_i18n.php? Is it stored here: system->application->helpers ? Even with my assumptions, I still can't get it to work. I must be missing something. 8-/ |
Welcome Guest, Not a member yet? Register Sign In |