开发者

Internalization on html page

I have a question, how would I do the following?

  • I want to display a dropdown (html) with a lis开发者_如何学编程t of language (english, french, etc.), ISO 639-1 codes. I want to display the language based on the native language (e.g., on the combo box, the "french" must say "francais" for the french speaking people to understand).

How I would do it? i,e. This is how I did it in MySQL

CREATE TABLE IF NOT EXISTS LANGUAGE
(
     LANGUAGE_CODE              VARCHAR(3) NOT NULL    --ISO 3 digit digit code
     ,LANGUAGE_NAME_ENGLISH     TEXT NOT NULL
     ,LANGUAGE_NAME_NATIVE      TEXT NOT NULL
) DEFAULT CHARACTER SET utf8;

The only problem, I cannot populate "LANGUAGE_NAME_NATIVE" since 1) I cannot get all native languages, and 2) I don't have languages in UTF8 format.

Is there any better way to do this?

Basically, what I'm accenuating is this: Should I have a language table for all the language list of all respective language; should I have i18n configuration files (properties file) for all languages list in their respective language or should I use a language translator?

PS I'm using MVC like Spring MVC and Struts.


Storing in DB level is fine. The only alternative is to store it in same place as the translations. If those are filebased, it would be too expensive to open/load every file to gather the available languages.

Left behind your question how to get the translations: no tool comes to mind. How are you actually doing the "normal" translations? Using a human translator? Let him/her do the job translating the language name and insert it in the DB yourself. Alternatively, parse this or this.


many frameworks allow you to do i18n configuration via properties files. You would have a properties file for each supported language. All properties files would have the same keys but different values, and you would use the keys in your presentation layer. You will have to look at the documentation for whatever technologies you are using...

edit -- here is a link i found for struts... http://www.allapplabs.com/struts/struts_internationalization.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜