Description
Sets the language of PowerBuilder runtime text resources.
Syntax
integer SetLanguage (LanguageType type)
|
Argument |
Description |
|---|---|
|
type |
A value of LanguageType enumerated type that specifies the language type. Value can be one of the following:
|
Return value
Integer.
1 – Success;
-1 – Language file does not exist;
-2 – Language file open failed;
-3 – Language file read failed.
Usage
Runtime text resources display in the new language immediately after
SetLanguage is executed.
Runtime text resources include only application-defined text. They
do not include system-provided UI text, such as message box button labels
(for example, OK and Cancel) or text displayed in system dialog boxes,
such as print dialog boxes, file save/open dialog boxes. The language of
such text is determined by the Windows display language on the client
machine and cannot be changed by calling the SetLanguage
function.
If you call SetLanguage in your application to set the
language type, the application will use the set language type; if the
language package file corresponding to the language type is invalid,
SetLanguage will fail and return an error code.
If the language type is WindowsLanguage!, the Windows Display Language of the client machine will
be used by PowerBuilder Runtime; if the Windows display language is not
one of the language types supported by PowerBuilder Runtime, English (for
EN version) or Japanese (for JP version) will be used by default.
If the language type is Custom!, the user-defined
language (custom.lng) will be used.
-
By default, a
custom.lngfile is provided in thelangfolder (for example, C:\Program Files (x86)\Appeon\Common\PowerBuilder\Runtime 25.1.0.6180\lang). -
Do not change the file name or location of the
custom.lngfile. Only one user-defined language file is allowed. -
Initially, it contains the same content as
english.lngand the text resources of the launcher installer (Text IDs starting with "IDS_INSTALLER_CAL_"). -
Its content format is
Text ID, Text Description. Modify only the text descriptions. Do not modify the text IDs. -
Back up the
custom.lngfile before modifying its content.
Examples
This example sets the language type to the Windows display language of the current client. This is the recommended way.
If the Windows display language is not supported, English (for EN version) or Japanese (for JP version) will be used.
integer li_rtn li_rtn = SetLanguage(WindowsLanguage!)
Alternatively, you can use GetEnvironment to get the
Windows display language first and then set the language type. If the
Windows display language is not one of the language types supported by
PowerBuilder Runtime, GetEnvironment returns
languageEnglish! (for EN version) or
languageJapanese! (for JP version).
environment lenv
LanguageType lt_lang
Integer li_rtn
GetEnvironment(lenv)
Choose Case lenv.Language
Case languageEnglish!
lt_lang = English!
Case languageFrench!
lt_lang = French!
Case languagegerman!
lt_lang = German!
Case languageDutch!
lt_lang = Dutch!
//other supported language types
...
Case Else
lt_lang = English!
End Choose
li_rtn = SetLanguage(lt_lang)This example sets the language type to French.
integer li_rtn li_rtn = SetLanguage(French!)
See also


