views:

41

answers:

1

I have a website on Kohana and I'm planning to have it multi-language.
Now I know the way with i18n folder and inside each language folder
there's some sort of strings.php file..
But I want a dynamic way (on DB) so I could change the values whenever I want
through the website.

Is there any common table schema that is usually used for multi-lang content?

A: 

Well, you can probably mimic a "resource" file in your database,

You can have a table working as a catalog for your strings, with two columns, like

Lang_Constants
ID, Constant_Name
1, HELLO_STRING

Another table with supported languages:

Languages
ID, Name
1, English
2, Spanish

and the table with the actual data:

ID, Language, Constant, Value
1,   1, 1, "Hello world!"
10,  2, 1, "Hola mundo!"

ANd you could do a query like :

SELECT Value from Lang_Constant_values where 
  Language = (Select ID from Languages where Name = 'English')
and
  Constant = (Select ID from Lang_Constants where Constant_Name = 'HELLO_STRING')
Francisco Soto