Localization: Multi-Language Support
When localizing an application for multiple groups of users, each with different language or localization requirements, you must use the multi-language method of localization. This allows for different localization override values to be used for different groups of users without the need for multiple server installations.
With multi-language support, multiple sets of localization override files are used, with each set containing the translations for one of the languages. The localization files are then made available to the server. During transmit, clients receive the override values from one of the sets of localization files based on the client device’s locale settings.
You must name the localization files based on the settings in the [Configuration] section of the Agentry.ini configuration file for the server. There are two additional settings within this same section related to the multi-language localization method. All localization settings are listed here, followed by a discussion of how the localization override files are named:
-
localizations
-
localizationsPath
-
applicationStringsFile
-
applicationGlobalsFile
-
clientStringsFile
The localizations setting contains one or more locale name values. A locale name is defined as a text value containing the language name and locale of a supported language for the application. The language name indicates the language used (i.e., English, French, Spanish). The locale is the sub-language, dialect, or region for the language (i.e., United Kingdom, Canada, Mexico). The combination of the language name and locale produces the locale name used by the server to identify the language overrides for a particular client.
The supported languages must be listed in the localizations setting of the [Configuration] section of the Agentry.ini file. Each language is identified by its locale name. The values for this setting are separated by semi-colons when multiple language names are listed. The specific values are the locale names for the desired languages as listed at Language Identifier Constants and Strings
.
This Web page contains a table with several columns related to language names, locales, and similar information. The column whose value is important here is the one labeled Locale Name. Each locale name consists of the language name followed by the locale, with the two values separated by a hyphen. For example, Spanish is represented by the language name es. There are several different locales for Spanish. Two of these are Spain and Mexico, which are represented by the locale values ES and MX, respectively. The resulting locale names are es-ES for the Spain dialect of Spanish and es-MX for the Mexican dialect. To support these two locales within the application, list the two locale names in the localizations configuration option.
ApplicationText.es-MX.ini
The es-MX portion of the name indicates that the overrides in this file are provided for support of the Spanish language, Mexican dialect locale. This locale name must be the same as the one listed in the localizations setting. The other localization file names are of the same format.
AppTxt.es-MX.ini
While it is possible to change the settings of the Agentry.ini file to look for different file names, this is not a recommended practice in most situations. The ability to change these names is provided for the sake of comprehensiveness. Unless dictated by specific implementation or deployment needs, it is recommended that the localization override files are named to match the default settings for these options.
An additional option for supported languages is to provide for a base language that is used without concern over a locale. In this case, the language name of the language is listed in the localizations option. An example of a base language is simply Spanish, which has a language name of es. Specify a base language for one of two reasons:
-
It is possible that a client will send a locale name that is not listed in the localizations option.
-
It may not be necessary to distinguish between one locale and another. Simply supporting a language is sufficient.
localizations=es-ES;es-MX;es
The supported languages, then, are: Spanish as spoken in Spain; Spanish as spoken in Mexico; and Spanish. If a client’s locale name is transmitted to the server as es-ES or es-MX, that client will receive the corresponding overrides from the localization files for the specified dialect. If, however, a client’s locale name is es-PA, which is the locale for Spanish - Panama, neither of the first two configured locales match. If no other option is provided, that client will receive the defined display values as set in the application project.
However, since the language name es is listed in the localizations setting, the client will receive the override values from the localization files for Spanish. This results in the client receiving overrides that, while they are not ideal for the users’ native dialect, are likely to be far better than the defined language of the application, which may not be in Spanish but in English.
ApplicationText.es.ini
The above example contains the language name es. The overrides in this file are the ones sent to clients providing locale names for Spanish, but not Spain or Mexico.
It is also possible to use both the single language localization method and multi-language localization method for the same implementation. In this case, the override files provided for the single language method, that is, the ApplicationText, ClientText and ApplicationGlobals files that do not include locale names, act as default values.
Assuming that the definitions are created in one language, with overrides provided using both the single language and multi-language methods, the following list provides the order used to determine what value is sent to the client for display. This order of precedence also applies to values overridden in one localization file but not another, or values not overridden at all:
-
The server first attempts to exactly match the locale name received from the client to the options in the localizations setting. If a match is found, the corresponding localization files are used and all values in these files are sent to the client. If a match is not found for the client’s locale name in the localizations configuration option, or if one or more values are not overridden in these files, then...
-
The server determines if the base language of the client’s locale name is listed in the localizations setting. If a match is found for the language name, the corresponding override files are used. Any values found in the base language files are not used if they are already overridden by the more specific locale name override files. If a match is not found for the client’s base language in the localizations configuration option, or if one or more specific display values are not overridden by these localization files, then...
-
The single language override files and any override values in the files, if present, are processed. Any overlaps for individual override values between these files and those localization files processed before them are not used. If the single language override files are not present, or if one or more specific display values are not overridden by these localization files, then...
-
The defined values from the application project are used.