Code globalized applications with high-level languages

Your major goal must be to have only one general set of running code that is common for all language versions and to make your programs table-driven as much as possible.

You should do as follows:

Do not use hard-coded values unless they are fully language and cultural independent on comparison, scan, replace, or call operations. In addition, do not use uppercase or lowercase-sensitive values. For example, never hard code Yes and No (Y or N) responses in your program, because these values are different for every language, and should be part of the textual data.

For literals and constants in source code, use characters only from the invariant character set. If input data is checked for validity in the program, make sure that the characters checked belong to the invariant character set; otherwise you might get a situation where the user is requested to enter a character that is not even on his keyboard. For example, the left brace ({) and right brace (}) do not appear on Arabic keyboards. See Invariant character set for a listing of the invariant character set.

Do not use compile-time arrays to hold messages or any other language or cultural-sensitive data.

For better performance, when you need to call external NLS-dependent modules, call them by a fixed name as a literal (but based on the library list) rather than by a variable field containing the program name. This allows your application to call the modules of different libraries based on the associated library list.

To allow users to work with an application in the language and habits of their culture, specify the editing values (for example, date, time, and date separators) as dependent on the language and country or region. You can then retrieve them according to the information in the user profile. The parameters are LANGID (language identifier) and CNTRYID (country or region identifier). You need to retrieve the cultural-sensitive information only once at program initiation. You can do this by an initial CL program or by the high-level language program and prepare them as:

Using an initial program allows you to set the user's job attributes to present a consistent application.

Related concepts
Invariant character set
Language identifier (QLANGID) system value
Country or region identifier (QCNTRYID) system value