![](/images/services/localization/localization_01.jpg)
COBOL Language Localization
Take your applications on a quick spin around the world
isCOBOL Evolve allows businesses to easily deliver and maintain localized, multiple-language software distributions. By incorporating Veryant technology such as the isCOBOL language resource feature, organizations can seamlessly distribute multi-language, global programs. This article briefly examines the language localization capabilities included with isCOBOL and offers an example illustrating how programmers can incorporate such technologies within their COBOL applications.
Full support of Unicode, the ability to incorporate Java Swing and standard Web programming techniques using only the COBOL language, and an efficient language resource feature make isCOBOL an ideal platform to develop and distribute applications requiring natural language localization.
Unicode support
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.
Java Swing and Web programming
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.
- isCOBOL supports all of the internationalization features of Java SE and J2EE Web-tier components. See the Java Internationalization FAQ at http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp
- See Supported Locales at http://java.sun.com/javase/6/docs/technotes/guides/intl/locale.doc.html
- For a discussion on entering bidirectional text, see IBM's article "Globalize your On Demand Business - Entering bidirectional text" at http://www-01.ibm.com/software/globalization/guidelines/h1.jsp
![](/images/services/localization/localization_02.jpg)
![](/images/services/localization/localization_03.jpg)
Overview of the isCOBOL language resource feature
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.
Getting started with isCOBOL language resource feature
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,
![](/images/services/localization/localization_04.jpg)
# 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.
isCOBOL language resource feature in action
The following example uses Hebrew text to illustrate the capabilities of the isCOBOL language resource feature:
![](/images/localization/local-text.gif)
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:
Learn more
View a 10-minute Webinar demonstration on the isCOBOL language resource feature.
View a Veryant Knowledge Base article entitled "How do I use text that has been translated into other languages in my screens and messages?"
Arrange code analysis report or to discuss your COBOL migration and localization needs in more detail by emailing info@veryant.com.
An example program demonstrating the isCOBOL resource language feature is also provided in the isCOBOL/sample/multilanguage directory of isCOBOL.