Application :: translate - Fixed text translation
In order to use fixed text strings in a program, the translate() function might be called. The text passed in sName 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
In order to call the translate function, usually one has to write:
odaba::Application::translate(...)
This might become a bit boring when providing multilingual applications. In this case, one may wrap the call in a static C function (e.g. tr()). In order to call the function from within OSI functions, one may call Translate(...) (see SystemClass).
The text string contains text with any kind of character encoding.
Implementation overview
- Translate to default language
Application :: translate ( sText ) - Translate to specific language
Application :: translate ( sText, sLangName )
Implementation details
-
Translate to default language
odaba::String Application  :: translate ( odaba::String &sText )
By defaultthe 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() from within OSI, C++ or C# programs.
- sText
- Text string
The text string contains text with any kind of character encoding.
to list
- sText
- Text string
-
Translate to specific language
odaba::String Application  :: translate ( odaba::String &sText, odaba::String &sLangName )
In order to translate into a specific language, the language name may be passed in sLangName. In this case the text is not translated to the current translation language, but to the language passed in sLangName.
- sText
- Text string
The text string contains text with any kind of character encoding.
- sLangName
- Language name
The language name is the official English name for the required language. Language names always start with capital letters.
to list
- sText
- Text string