DALT - Database Application Language Translations |
[eluser]tdktank59[/eluser]
So I had the need to add some language support to my websites. However I wanted to move it to the database to allow easier maintenance of it also allowing it easier to get things translated. So here it is. DB_Lang v0.0.1 Its pretty simple I have included wiredesigns URI language identifier http://codeigniter.com/wiki/URI_Language_Identifier Usage is simple. $this->lang->db_line($key); use it the same way as the normal language line lookup It is also smart so if the record does not exist it will create it and set a default value in the translated table. It required 2 tables for a single lanauge The key table wich holds the lookups. and the translated table which has the translated values. language and lanugage_{lanauge} I have included english and spanish since those were what I had on hand. Let me know if you have any questions. I will be adding some extra stuff later on to grab cookie info to see what the language is, as well as try and pull the browsers lanauge and/or other regional settings to try and detect what to send the user as a default lanauge. Otherwise it will default to what you set in CI I also plan to have a config value that would allow you to cache the database results to a language file as well.
[eluser]freshface[/eluser]
Does this cache? I want to keep my query count low.
[eluser]tdktank59[/eluser]
[quote author="freshface" date="1262381325"]Does this cache? I want to keep my query count low.[/quote] not at this time. If you had read the first post I covered what I want to do with it in the future. |
Welcome Guest, Not a member yet? Register Sign In |