SetAutomationLocale
PowerScript function
Description
Sets the language to be used in automation programming for an OLE
object. Call SetAutomationLocale if you have programmed automation
commands in a language other than the user’s locale.
Applies to
OLE objects
Syntax
1 |
olename.SetAutomationLocale ( language, sortorder ) |
Argument |
Description |
---|---|
olename |
The name of the object for which you want to set the |
language |
A value of the LanguageID enumerated datatype specifying Some values of LanguageID are:
You can also specify a language or dialect, such as For the list of language-specific values for LanguageID, |
sortorder |
A value of the LanguageSortID enumerated datatype
|
Return value
Integer.
Returns 0 if it succeeds and -1 if an error occurs.
Usage
For most situations, you do not need to call SetAutomationLocale. If
an automation command fails, PowerBuilder makes additional attempts to
execute it in other languages before it triggers the Error event. It
attempts to execute the command using these languages:
-
The command as is (the command is in a language the server
understands) -
The current locale (if it is different from the user’s default
locale) -
The user’s default locale (LanguageUserDefault!)
-
The system’s default locale (LanguageSystemDefault!)
-
English (LanguageEnglish!)
If PowerBuilder is successful in validating the name in any of the
languages above, it resets the locale to the value that succeeded. While
this may result in the wrong locale in ambiguous cases, it will probably
simplify access to standard Microsoft Office products that ship with both
localized and English function and property names.
If you specify a language with SetAutomationLocale, but the OLE
server does not have function and property names in that language, your
OLE automation commands will fail unless the above procedure finds a
language that works. If you have called SetAutomationLocale,
PowerBuilder’s procedure for finding the correct language can reset it, as
described in the previous paragraph.
Examples
This example sets the language to German for an OLEObject called
oleobj_report:
1 |
oleobj_report.SetAutomationLocale(LanguageGerman!) |
This example sets the language to German for an OLE control
ole_1:
1 |
ole_1.Object.SetAutomationLocale(LanguageGerman!) |