Data 1 consideration of multilingual issues
For multiple languages, need to consider two aspects, one is the interface, one is the database information, for the interface of the multilingual problem is relatively simple, as long as the establishment of the corresponding resource files can be, here no longer said; more complex is the multilingual information of the database, here to talk about Freight.net solution.
Freight.net will use the Storm.multilanguage widget to handle multiple languages.
The widget can manipulate string data tables in the database and string data tables in XML format. The default database table name is displaystring, and the default XML file name is Displaystringdata.xml
Supports multiple databases and multiple data tables under the same data for a String data table in a database. The database connection string is specified in the storm.appsetting configuration file.
For a String data table in XML format, the default hold path is determined by the setting of "Xmlpath" in the storm.appsetting configuration file, otherwise it is placed directly under the application directory, and the Web application is saved in relation to the application startup directory. IIS5 for Windows\system32,iis6windows\system32\inetsrv
The path of the Non-default XML format file is determined by the setting of "*xmlpath" in the storm.appsetting configuration file, where the asterisk represents the specified XML file set name, or it is placed directly under the application directory for the Web application. is saved in relation to the application startup directory, IIS5 is windows\system32,iis6windows\system32\inetsrv
The Languagedata dataset is used to record the languages available in the application, and the storage path is determined by the setting of "Xmlpath" in the Application configuration file configuration section, otherwise it is placed directly under the application directory, and for Web applications, it is saved in relation to the application startup directory. IIS5 for Windows\system32,iis6windows\system32\inetsrv
Supports absolute and relative paths, for Web applications, relative paths represent relative to application startup paths, IIS5 to Windows\system32,iis6windows\system32\inetsrv
The default language for the application is set in the storm.appsetting configuration file "DefaultLanguage".
The above is a simple description of the widget, now look at the data structure:
Languagedata:
You can see that this table is simple, it defines which languages the application will support, and it is easy to support the new language.
DisplayString:
As you can see, this datasheet is also very simple, and his use will be very flexible, it can be a number of different names at the same time in multiple databases, multiple folders ...
The widget provides methods to access the data:
The Getdisplay method is used to obtain the display characters under the required language;
The Savedisplay method is used to hold the display characters of the specified language;
The Getdisplayds method takes out the display data of all the languages of the related objects;
The Deldisplay method clears the display data for all languages of the specified object.
In use, as long as the target data refguid saved, such as the National Country name (name) needs to save the multilingual, then in the database needs to save the Nameguid field, The dataset adds the Name field to the data set and calls the Getdisplay method to populate the obtained values.
By writing the appropriate method in the middle tier, you can also allow the user to modify the value of the Name field arbitrarily, and the system is automatically saved back to the record in the current language.
As an example: the default language of the system is "en-us", where a user adds a country record in the Zh-chs language, then the country's Name field value (assumed to be "America") is saved to the Zh-chs language record, because this record is newly added, and obviously, This record is not in the en-US language, then the system automatically adds a record to the default language, en-us, and the value is "United States"; then another user accesses the record, his language is Zh-cht, and when this record is not available, the system displays the default language (en-American) value "The United States," of course, is not right, he just need to modify the value of the "United States", save, the system will automatically add a Cn-cht record value of "The United States", the same use of the U.S.-American language users, as long as directly modify the name "USA", The system will automatically modify the display string in the en-US language, and other languages will not have any effect. But the user does not feel this, in his view is only modified this country record. The advantage of doing this is that each user only needs to maintain their own use of the language of the record information, and do not have to consider other language problems, but also very convenient even if the system has been running for a period of time to add a supported language, do not need to add a record when you need to add all the language version, Add the version of the appropriate language only when needed, so that the database records as few as possible.
Of course, do not expect anything to be single-handedly by this component, in order to achieve these functions, still need to write some more than before in the middle tier code. Specifically I will give an example in the back.
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:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.