isCOBOL software includes full support for Unicode, both as an encoding for COBOL source code and for data processing within COBOL, for example with the PIC N and USAGE NATIONAL syntax elements. By default all strings and usage display items such as PIC X and PIC 9 are encoded in UTF-8. So a Unicode encoded language is supported without requiring any modifications to existing COBOL code.
isCOBOL supports multiple languages natively because it makes use of Java Swing and standard Web programming technologies designed for multi-language and international applications. For example, isCOBOL provides graphical user interface (GUI) programming capabilities to COBOL programmers for deployment as a Java Swing based application, using a Java Swing thin client or an AJAX-based Web 2.0 user interface. Java Swing, Servlets, HTML and Javascript technologies all support multiple natural languages.
The isCOBOL language resource feature provides an easy, yet powerful way to localize an application by configuring the text to be displayed for a particular user interface at runtime by selecting it from different languages.
During the initial program initialization, and optionally before calling a subprogram, the isCOBOL Runtime Framework loads a specified language resource file. This file is a Java properties file which contains any number of name=value pairs. A developer specifies where in the program he or she wants these resource values to be used with a letter R followed by the quoted name of the resource. For example,
DISPLAY R"Greeting".
will use a resource named Greeting that has been loaded from the language resource file. If a resource file contains the following:
Greeting=Hello World
Then the program will display:
Hello World
A resource name can be used anywhere in program source code where it is valid to use a string literal.
The basic steps required to create a multi-language version of a program using the isCOBOL language feature are:
- Search for string literals in the program source code
- Copy each string literal to a text file and remove the quotes
- Add a resource name followed by an equal sign to the beginning of the line in the text file
- Replace the original string literal in the source code with the letter R (or lowercase r) followed by the quoted resource name
For example, a developer could replace "Please enter a valid credit card number" with r"ValidCCNumberMsg" and then add the following line to the resource file:
ValidCCNumberMsg=Please enter a valid credit card number
To assist the translator, a comment line can be added before or after each text resource value and describe the usage and/or context. For example,
# Program: CCVALIDATE
# Context: Message displayed on line 24 when user has entered an invalid credit card number
ValidCCNumberMsg=Please enter a valid credit card number
The name of the language resource file is constructed from the values of the following framework properties:
iscobol.resource.file
iscobol.resource.country
iscobol.resource.language
iscobol.resource.variant
as follows (square brackets enclose optional elements):
file[_language[_country[variant]]].properties
For example, if iscobol.resource.file=RES and iscobol.resource.language=en then the isCOBOL Runtime Framework will attempt to load a file named RES_en.properties.
The resource file must be located in a directory or jar file listed in the class path.
The above framework properties can be set programmatically using SET ENVIRONMENT leaving off the "iscobol." prefix.
The following example uses Hebrew text to illustrate the capabilities of the isCOBOL language resource feature:
It is possible to create a text resource file, RES_iw.properties, containing this text for use with isCOBOL's multilanguage sample program distributed with isCOBOL in the sample\multilanguage folder.
To create the file save the above text into a utf-8 encoded file named "RES_iw.txt" using notepad and then run native2ascii to create a properties file.
native2ascii -encoding utf8 RES_iw.txt RES_iw.properties
Edit the RES_iw.properties file to add the text resource names such as "usr=", "pwd=", etc, to the beginning of each line, and then reference these text resources in the COBOL program. For example, the resulting text resource properties might have the following:
usr=:\ufeff\u05e9\u05dd \u05de\u05e9\u05ea\u05de\u05e9
pwd=:\u05e1\u05d9\u05e1\u05de\u05d4
And the COBOL screen section would look like this:
01 Login-Screen.
03 label
line
2
col
2
size
12
title
r"usr"
.
03 label
line
4
col
2
size
12
title
r"pwd"
.
Here are some sample screenshots:
An example program demonstrating the isCOBOL resource language feature is also provided in the isCOBOL/sample/multilanguage directory of isCOBOL.
|
 |
"Veryant's isCOBOL technology opens new markets for us because of its pure Java deployment model and the foreign language localization capabilities. It makes us more competitive and will help expand our business."
|
 |
| |
Larry Turley, President
Ron Turley Associates
|
|
|
Join our Community
Keep updated on the latest product news and information
|
| |
 |
Sign up here |
|
|
|
|