validation errors multi-lingual - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: validation errors multi-lingual (/showthread.php?tid=11051) |
validation errors multi-lingual - El Forum - 08-24-2008 [eluser]sl3dg3hamm3r[/eluser] Hey there! I'm just doing my small form, using CI's validation capabilities. How can I make this multi-lingual? The returned errors are by default english, but I'd like german and russian too Sl3dg3 validation errors multi-lingual - El Forum - 08-24-2008 [eluser]everdaniel[/eluser] You can add additional languages in your system/application/languages folder and then use this language in your config file. I think there is already some translations out there, you should run a search about that here in the forums. Good luck! validation errors multi-lingual - El Forum - 08-24-2008 [eluser]Derek Allard[/eluser] I do this in BambooInvoice if you want to download the code and poke. I think there's... 7 or 8... lost count, supported langs in there. validation errors multi-lingual - El Forum - 08-25-2008 [eluser]sl3dg3hamm3r[/eluser] Thx for the inputs. I already saw that I can configure the language in the conf-file and download additional languages (not sure about russian yet), but I would like to alter the language on runtime (the user can select between three languages). I will have a look at Bamboolnvoice and see if the language is changed during runtime? Sl3dg3 validation errors multi-lingual - El Forum - 08-25-2008 [eluser]xwero[/eluser] The hardest part about changing languages at runtime is loading the choosen language files. I've made a method for this a while ago Code: /** validation errors multi-lingual - El Forum - 08-25-2008 [eluser]sl3dg3hamm3r[/eluser] thx! The language-switcher I already have implemented. Now I would only need to call this additional method, nice! validation errors multi-lingual - El Forum - 02-14-2009 [eluser]sl3dg3hamm3r[/eluser] here a corrected script which worked for me (based on Xwero's script, which had some errors concerning $this, maybe I tried it in a wrong context): Code: $CI =& get_instance(); I wrote a small helper. A better way might be to inherit the Config-class and add this specialized function, but I was lazy... validation errors multi-lingual - El Forum - 07-07-2009 [eluser]sl3dg3hamm3r[/eluser] Gosh, I only realized now that the above snippet (which I use in a helper) doesn't seem to work. The language-files are not loaded when I change the language. It seems that the array is_loaded (from Config-class) is empty, therefore there is nothing to replace. Why is it empty? validation errors multi-lingual - El Forum - 07-07-2009 [eluser]sl3dg3hamm3r[/eluser] Ok, since Config::is_loaded is empty, I tried Config::config. That's how it looks like: Code: ( There is the language, of course, but there is nothing about what CI language-files are loaded. Where would I find them? Could somebody with some more CI-insights give me a hint where to find (and manipulate) them? validation errors multi-lingual - El Forum - 02-05-2012 [eluser]benjamincurrie[/eluser] I created a Multi-Language Hook that I created for a project I have been working on. Multi-Language front-end support seems to be a very desired functionality that doesn't seem to be well supported in any frameworks, heres hoping this helps some people. https://github.com/benjamincurrie/CodeIgniter-Language-Switch My main goal was to support multi-lingual search engine friendly URL's, for example: http://mysite.com/home (home page in English) http://mysite.com/accueil (home page in French) This does require a config file to keep track of controller and function translations, for those who don't wish to maintain translations it reverts to URL's like this: http://mysite.com/fr/home There is also an option to use a query string: http://mysite.com/home?lang=fr I've put the project up on Github and would love some feedback, feel free to fork and improve on the code. A lot of people seem to want to use cookies for storing user language preference, however I don't believe this is the best practice for search engine crawlers. Will eventually get to supporting this method too (as well as subdomain). Ben |