Categories In Databases


(Frank Gutknecht) #1

Hey

I have some categories in my Database.

For Example some Countries.




ID 1 NAME England

ID 2 NAME France

ID 3 NAME Spain



If I want to translate these categories into other languages, is it useful to save the categories in english (My sourceLanguage) like in my example or is it better to save just keys for the names?

Are there any good tutorials about internalization? I’ve read “Agile Web Application Development” and the “YII Cookbook” but the explanations are sparse :frowning:

Thx!


(Amjad Mghl) #2

It is not a good idea.

Instead of doing so, you need to translate them and save in database.

There should be something like as

languages


id             name

1              ENGLISH

2              URDU

categories_meta


id cat_id lang_id value

1  1       1      Shop

2  1       2      Dukan

Thanks


(Frank Gutknecht) #3

Ok, thanks… do you know some good tutorials for internalization?

How can I set flags on the site and change the language?

How can I recognize from which countries the users come?

Should I save the language in the Session (cookie) of the user?

Thanks!


(mbi) #4

your post sounds like this

http://www.yiiframework.com/wiki/66/i18n-for-your-model-in-just-1-line/


(Amjad Mghl) #5

1 - Set a Default Language in config.php

2 - Use Portlet/widget to allow user to select language he wants

3 - Yes, it is important. If you do not want then have sub domains or sub dirs i.e. en.mysite.com or mysite.com/en

Check some below

http://www.yiiframework.com/extension/yii-language-behavior

http://www.yiiframework.com/extension/language-picker

http://www.yiiframework.com/extension/yii-multilanguage

http://www.yiiframework.com/extension/multilingual-behavior

thanks