Multi-language website development: incomplete technical analysis

Source: Internet
Author: User
Multi-language website development: incomplete technical analysis
Language is the main obstacle to information dissemination.

Multi-language websites, as the name implies, provide information services to users in multiple languages (rather than in a single language), so that users in different languages can obtain the same content from the same website.

Multilingual website implementation solution

1. Static: Prepare a set of page files for each language, either by file suffix to distinguish different languages or by sub-directories to distinguish different languages.

Provides the traditional Chinese interface, or EN/index.htm provides the English interface, GB/index.htm provides the Simplified Chinese interface, and big/index.htm provides the traditional Chinese interface. Once you select the desired language, automatically jump to the corresponding page. Other links on the home page are handled in the same way. From the perspective of maintenance, it is simpler and clearer to distinguish different language versions by subdirectories than by file extension names.

2. Dynamic: All page files on the site are dynamic page files (PHP, ASP, etc.) instead of static page files. Language variables are used to represent the files where the language and text need to be output, these language variables can be assigned different values based on the user's selection of different languages, so that different texts can be output in different language environments.

For example, the language variable ln_name is assigned a value of "name" when the selected language is English and a value of "name" when the selected language is simplified Chinese ", in this way, you can adapt to the output in different languages.

The advantage of static mode is that the page is directly output to the client, which does not need to be run on the server. It occupies less server resources and the system supports a large number of concurrent connections, the disadvantage is that you need to create a set of page files for each language. A lot of content is stored in different languages even if it is not related to the language, so it occupies a lot of storage space.

The advantages and disadvantages of dynamic and static methods are the opposite. The advantage is that there is only one set of dynamic page files, and the texts in different languages are stored using language variables, only one copy of language-independent content is stored, which consumes less storage space and is easier to expand the new language. However, you need to run the content on the server and input the result to the client, the number of concurrent connections supported by the system is small because it occupies a large number of server resources.

Technical issues related to Dynamic Data Storage

Due to the increasing number of dynamic applications on websites, many websites still use files or databases to store application information. Therefore, if the content stored in files or databases is related to the language, pay special attention to this feature. For information stored in the database, you can use the following methods to support multiple languages:

1. multiple languages are supported at the database level: an independent database is created for each language, and users in different languages operate on different databases.

2. Table-level support for multiple languages: create independent tables for each language. Users in different languages operate different tables, but they are in the same database.

3. Supports multiple languages at the field level: create independent fields for each language in the same table. Users in different languages operate different fields in the same table.

Because the database has a large amount of information (such as signs, encoding, numbers, and so on) used for internal processing and has nothing to do with the language, supporting multiple languages at the database level can result in a great waste of space, the biggest problem with field-level multi-language support is that once a new language is needed, the table structure needs to be modified, which is difficult to maintain and has poor scalability.

In contrast, it is better to support multiple languages at the table level, because not all tables need to support multiple languages. For languages-independent tables, users in different languages share one set, language-related tables are created based on the types of Supported languages. Users in different languages access different tables. This makes the maintenance simple and saves storage space, and makes it easier to expand. You only need to create one more table that supports multiple languages.

Note that some fields in some tables are shared by tables of different language versions (such as inventory). Data Sharing is difficult due to the relative independence between tables in various languages. There are two solutions:

1. Synchronize the shared fields of tables in different languages: that is, If you modify the shared fields of one of the tables, the fields in other language tables are changed accordingly, in fact, when users in different languages access at the same time, the processing is still troublesome, and the modification work is relatively large when the new language is expanded.

2. Add a new table: put all the fields shared by all languages (such as goods number and origin Code) in this table, A table that supports multiple languages only stores fields related to different languages. When users in different languages use databases, they need to operate on two data tables.
In comparison, the second method is relatively simple, efficient, and easy to maintain.

Application Character Set Selection

An enterprise website located in countries of different languages is bound to provide product and sales information in multiple languages to satisfy customers and partners who use different languages around the world, these include French, German, Italian, Portuguese, Spanish, and Arabic. However, one problem is easily overlooked by website designers. This is the problem of website Character Set settings.

Generally, we use the simplified Chinese (gb2312) Character Set. for multilingual websites, the Chinese Character Set may make your hard work hard. The reason is simple: This is the inconspicuous little character set.

There are dozens of different character sets in the computer application field. When users in different languages browse webpages in different languages, garbled characters often occur because the character sets used by each other are incompatible. When we browse some foreign websites, we often have to switch back and forth between various character sets to see the information on the website normally.

Think about it: if a website provides content in Chinese, English, French, German, and other language versions, the content is complete and complete, and the design is magnificent. We thought it was perfect to browse these non-Chinese-version pages in the Chinese encoding environment. Now a French customer is interested in your product. When he enters the French layout, he can see that there are a lot of garbled characters, the layout may even collapse. What is the significance of making another effort on your website?

Therefore, the Unicode Character Set should be the most ideal choice for websites with multilingual versions. It is a double-byte encoding mechanism character set. both eastern and western texts are expressed in Unicode in two bytes. Therefore, at least 65536 different characters can be defined, it can cover almost every character of all common languages in the world. Therefore, when designing and developing multilingual websites, you must first define the character set of non-Chinese pages as "UTF-8" format.

This step is very important because it is a very thankless job to change the character set after the page is completed. Sometimes it may even need to start from scratch and re-enter the text content of the website.

Meta tag in HTML:

<Meta HTTP-EQUIV = "Content-Type" content = "text/html; charset = Character Set">

Do not write, display according to the default Character Set of the browser
Charset = gb2312 Simplified Chinese
Charset = big5 traditional Chinese
Charset = euc_kr Korean
Charset = shift_jis or euc_jp Japanese
Charset = KOI8-R/Windows-1251 Russian
Charset = iso-8859-1 Western European language (Dutch, English, French, German, Italian, Norwegian, Portuguese, Swiss. And other 18 languages) charset = iso-8859-2 Central European language
Charset = French language of iso-8859-5 (polygalic, Byelorussian, Russian, Russian, Ukrainian)
Charset = uft-8 Unicode multi-language

Concepts of PHP and Script Engine page numbers
Because our traditional internal code like big5, gb2312 does not have a one-to-one correspondence with Unicode, the conversion between the two depends on codePage (page number ).
<? PHP = Language = VBScript codePage = xxx?>

If this parameter is left blank, it is automatically parsed Based on the default code page of the Server Parsing engine and returned to the browser.
If the webpage script is different from the default code page of the web server, you must specify the code page:
CodePage = 936 Simplified Chinese GBK
CodePage = 950 traditional Chinese big5
CodePage = 437 US/Canada English
CodePage = 932 Japanese
CodePage = 949 Korean
CodePage = 866 Russian
CodePage = 65001 Unicode UFT-8

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.