GLG Toolkit, C / C++ API Library  Version 4.6
Internationalization and Localization

This group contains functions for setting locate as well as localizing GLG drawings by translating text strings to different languages. More...

Detailed Description

This group contains functions for setting locate as well as localizing GLG drawings by translating text strings to different languages.

Functions

GlgLong GlgExportStrings (GlgObject object, char *filename, GlgLong separator1, GlgLong separator2)
 Writes all text strings defined in the drawing to a string translation file. More...
 
GlgLong GlgImportStrings (GlgObject object, char *filename, GlgBoolean verbose)
 Replaces text strings in the drawing with the strings loaded from a string translation file. More...
 
GlgBoolean GlgInitLocale (char *locale)
 Sets the program locale. More...
 

Function Documentation

◆ GlgExportStrings()

GlgLong GlgExportStrings ( GlgObject  object,
char *  filename,
GlgLong  separator1,
GlgLong  separator2 
)

Writes all text strings defined in the drawing to a string translation file.

Parameters
objectSpecifies a viewport or an object whose text strings to export.
filenameSpecifies the filename of the string translation file.
separator1Defines the first separator character to be used in the generated file.
separator2Defines the second separator character to be used in the generated file.
Returns
The number of exported strings or -1 in case of an error.

This function exports all strings defined in the drawing to an ASCII string translation file that can be edited using a text editor.

The function exports strings of the S (string) resource objects, such as the String attribute of a text object. It does not export strings that are not values of the S resource objects, such as object names, tag names and tag sources, which makes sure that the program logic is not affected by the string changes.

The string translation file contains a line for each exported string. Each string entry contains the name of a string resource which helps identify how the string is used, and two copies of the string: the current value and the new value. Each item in the string entry is separated by two separator characters. The name of the string resource and the first copy of the string are used to identify the string and should not be changed.

When the file is translated, the second copy of the string (the new value) may be replaced with a new string representing the text in the local language and local character set. Multiple copies of the file can be created, one for each supported language.

The GlgImportStrings function can be used at run time to display a localized drawing. An application can load different versions of the translated file to display localized drawings for different language environments.

This function provides a programming interface for exporting strings from a drawing. The File, Export Strings option of the GLG editors can be used to export strings from the loaded drawing, in which case two double quotation characters are used as the default separators. This can be changed by defining the GLG_STRING_SEPARATOR environment variable to supply a two character string to be used as a separator.

Refer to the Localization Support section of the GLG User's Guide and Builder Reference Manual for more information about the string translation file format.

◆ GlgImportStrings()

GlgLong GlgImportStrings ( GlgObject  object,
char *  filename,
GlgBoolean  verbose 
)

Replaces text strings in the drawing with the strings loaded from a string translation file.

Parameters
objectSpecifies a viewport or an object whose text strings to replace.
filenameSpecifies the string translation file to load.
verboseIf True, generates an error for each string that was not changed to a new value because it was missing a matching entry in the string translation file.
Returns
The number of imported strings or -1 in case of an error.

This function can be used at run time to display a localized drawing. An application can load different versions of the translated file to display localized drawings for different language environments. See GlgExportStrings for more information.

This function provides a run time interface for importing translated strings into a drawing to display it in a different language environment. The File, Import Strings option of the GLG editors can be used to import strings into the currently loaded drawing for testing.

◆ GlgInitLocale()

GlgBoolean GlgInitLocale ( char *  locale)

Sets the program locale.

The function invokes setlocale( LC_ALL, locale ). In the X11 environment, it also performs X11 locale initialization.

If it is used, the function must be invoked before the GlgInit function.

Refer to the Internationalization and Localization Support chapter of the GLG User's Guide and Builder Reference Manual for information on string encoding, as well as using the UTF8 locale.

Parameters
localeSpecifies a program locale, or NULL to use the current system locale.
Returns
Success or failure status.