Globalizing a toolkit
You can load and format string resources for different locales using the tools that are provided.
About this task
cgt
code
generators so that the toolkit can generate locale-sensitive, compile-time
messages. You can also instrument the toolkit operator code to access
locale-sensitive strings at run time for use in the data processing
or for writing to the system log file.Procedure
- Create the toolkit directory.
- Create the toolkit information model file, info.xml, and define any resources to be generated.
- Create the underlying operators and SPL code.
- Create the resource files.
- Run spl-make-toolkit to generate or regenerate the C++ header and Perl module, and include these files in your C++ or Perl (cgt) files.
- Use the macros that are defined in the C++ header or the subroutines that are defined in the Perl module to access the translated and formatted strings.
- Use the formatted string in the operator code. The string
type is a
std::string
in C++ and a UTF-8 string in Perl. - Run spl-make-toolkit to generate and validate the code generators.
Example
Localization
sample application to demonstrate
the use of a resource bundle to hold translatable messages that can
be loaded at compile time or at run time. The translatable messages
are formatted appropriately for the execution locale. The Localization
sample
is installed in the $STREAMS_INSTALL/samples/spl/features/Localization directory.