1 Consider multilingual issues
For multi-language, you need to consider two aspects, one is the interface, one is the database information, the multilingual problem for the interface is relatively simple, as long as the corresponding resource file is available, here is not more, more complicated is database information Multi-language, here is the solution of Freight.Net.
FREIGHT.NET will use the Storm.Multilanguage component to handle multilingual.
This component can operate on a string data table in the database and a string data table in the XML format. The default database table name is displayString, the default XML file name is DisplayStringData.xml
The string data table in the database supports the operation of multi-database tables and the same data. The database connection string is specified in the configuration file of storm.appsetting.
For a string data table in the XML format, the default storage path is determined by the "XMLPath" setting of the storm.appsetting configuration file, otherwise, it will be placed directly in the application directory. For web applications, it will be saved in relative to the application. In the launch directory, IIS5 is Windows / System32, IIS6Windows / System32 / InetSRV
Non-default XML format files are determined by the setup of "* xmlpath" in storm.appsetting configuration file, where the asterisk represents the specified XML fileset name, otherwise, it will be placed directly in the application directory, for web applications The program will be saved in the launch directory relative to the application, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV
The LanguageData Data Set is used to record the language available in the application, and the traffic path is determined by the "XMLPath" set by the application configuration section. Otherwise, it will be placed directly in the application directory. For web applications, it will be saved relative to Under the application launch directory, IIS5 is Windows / System32, IIS6Windows / System32 / InetSRV
Absolute and relative paths, for web applications, relative path representation relative to the application startup path, IIS5 is Windows / System32, IIS6Windows / System32 / INETSRV
The default language of the application is set in "DefaultLanguage" in storm.appsetting configuration file.
The above is a brief description of the component, and now look at the data structure:
LanguageData:
It can be seen that this table is simple, it defines which languages that the application will support, and it is also very simple when you need to support a new language.
DisplayString:
It can be seen that this data sheet is also very simple, and his use will be very flexible, it can exist in multiple databases while multiple different names, multiple folders ...
Components provide some ways to access data:
The getDisplay method is used to get the display character under the required language;
SaveDisplay method is used to save the display character of the specified language;
GetDisplayDS method takes out all languages of the relevant objects;
The Deldisplay method clears the display data of all languages of the specified object.
In use, just save the REFGUID of the target data, such as the country country (Name), you need to save a multilingual, then you need to save the Nameguid field in the database, and add the data to Name when getting information. Fields and call the getDisplay method to fill the obtained value.
The value of the NAME field can be arbitrarily modified by writing the appropriate method in the middle layer, and the system automatically saves back to the current language. For example: The default language of the system is "en-us", and a user adds a Country record in the ZH-CHS language, then the Name field value of this country (assuming "US") will be saved to zh-chs Under the logistics record, because this record is new, it is obvious that the record of this recorded EN-US language is not, then the system will automatically add a record, value " US; then, another user accesses this record, his language is en-cht, and this record is not available, the system will display the value of the default language (En-US) "US", this is of course Not right, he only needs to modify this value "US", save, the system will automatically add a CN-CHT record value as "United States", and use the EN-US language user, as long as the Name is "" USA, the system automatically modifies the display string of the EN-US language, and other languages do not have any impact. But the user will not feel this, and he seems to have modified this Country record. The benefit of this is that each user only needs to maintain the record information of this language that you use, and you don't have to consider the problem of other languages, or it can be very convenient to add support even after the system has run for a period of time. Language, you don't need to add a version of all languages when you add a record, just add the version of the corresponding language when you need it, so that the database record number is small.
Of course, don't expect anything by this component, in order to achieve these functions, you still need to write some code than before. I will give an example later.
(Endlessly)