SystemClass :: Translate - Fixed text translation
In order to use fixed text strings in a program, the Translate() function might be called. The text passed in ntext will be looked up in the internal text cache. When the string exceeds 80 bytes, the leading 80 bytes are used for text look-up. When no corresponding text entry could be found, the text passed in sName will be returned. Otherwise, the text from the text entry corresponding to the requested language will be returned. When no text has been defined for the target language, the text passed in sName will be returned.
For more information about how the internal text cache is organized see Text cache documentation in the User's Guide .
// DSC_Language=English
Translate("This is an error message"); // -->This is an error message!
TranslationLanguage("German");
Translate("This is an error message"); // -->Das ist eine Fehlernachricht!
Translate("This is an error message","English");// -->This is an error message!
// no translation to Spanish available
Translate("This is an error message","Spanish");// -->This is an error message
When the function name is not unique in the given context (e.g. because another Translate member has been defined for the class), the function name has to be prefixed with the class name ( SystemClass ::Translate(...) )
Implementation overview
- Translate to default language
SystemClass :: Translate ( ntext ) - Translate to specific language
SystemClass :: Translate ( ntext, lang )
Implementation details
-
Translate to default language
NString SystemClass  :: Translate ( NString &ntext )
By default the function translates to the application language, which is taken from the system or which may have been set in DSC_Language option variable.
In order to change the default translation language, one may call TranslationLanguage() .
- ntext
- Text string
The text string contains text with any kind of character encoding.
to list
- ntext
- Text string
-
Translate to specific language
NString SystemClass  :: Translate ( NString &ntext, NString &lang )
In order to translate ntext into a specific language, the language name may be passed in lang . In this case the text is not translated to the current translation language, but to the language passed in lang .
- ntext
- Text string
The text string contains text with any kind of character encoding.
- lang
- Language name
The language name is the official English name for the required language. Language names always start with capital letters.
to list
- ntext
- Text string