|
GLG Toolkit, C# Class Library
Version 4.6
|
This group contains methods for setting locate as well as localizing GLG drawings by translating text strings to different languages. More...
This group contains methods for setting locate as well as localizing GLG drawings by translating text strings to different languages.
Functions | |
| int | ExportStrings (String filename, GlgMediumType medium_type, char separator1, char separator2, Encoding encoding) |
| Writes all text strings defined in the viewport's drawing into a string translation file. More... | |
| int | ImportStrings (String filename, GlgMediumType medium_type, bool verbose, Encoding encoding) |
| Replaces text strings in the viewport's drawing with the strings loaded from a string translation file. More... | |
| int ExportStrings | ( | String | filename, |
| GlgMediumType | medium_type, | ||
| char | separator1, | ||
| char | separator2, | ||
| Encoding | encoding | ||
| ) |
Writes all text strings defined in the viewport's drawing into a string translation file.
If the method is invoked on an arbitrary non-viewport object, it writes all text strings defined in the object.
| filename | Specifies the filename of the string translation file. |
| medium_type | Output type, must be FILE. |
| separator1 | A char value that specifies the first separator character to be used in the generated output (for example, '#'). |
| separator2 | A char value that specifies the second separator character to be used in the generated output (for example, '#'). |
| encoding | Encoding to use for encoding exported strings. If null, a default encoding is used. |
This method exports all strings defined in the drawing to an ASCII string translation file that can be edited using a text editor.
The method 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 S resource objects, such as object names, tag names and tag sources, which ensures that the program logic is not affected when the translated file is used by ImportStrings to modify text strings in the drawing.
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 ImportStrings method 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 method 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.
| int ImportStrings | ( | String | filename, |
| GlgMediumType | medium_type, | ||
| bool | verbose, | ||
| Encoding | encoding | ||
| ) |
Replaces text strings in the viewport's drawing with the strings loaded from a string translation file.
If the method is invoked on an arbitrary non-viewport object, it replaces text strings defined in the object.
| filename | Specifies the file or the URL to load the string translation file from. |
| medium_type | FILE or URL constant. |
| verbose | If 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. |
| encoding | Encoding to use for decoding imported strings. If null, a default encoding is used. |
This method 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 ExportStrings for more information.
This method 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.