O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

GetLocale Function

Syntax

GetLocale(  )

Return Value

A Long indicating the current locale ID.

Description

Gets the current locale ID.

Rules at a Glance

  • A locale ID represents a language as well as regional conventions. It determines such things as keyboard layout, alphabetic sort order, and date, time, number, and currency formats.

  • Appendix D lists valid locale IDs.

Programming Tips and Gotchas

  • If you want to temporarily change the locale, there is no need to call GetLocale and store its returned value before calling SetLocale, since SetLocale returns the value of the previous locale ID.

  • GetLocale returns the locale ID currently in use by the script engine.

  • Although you can set the locale using either a decimal, hexadecimal, or string locale ID, the GetLocale function returns only a decimal locale ID value.

  • The default value of the script engine’s locale ID is determined as follows: When the script engine starts up, the host passes it a locale ID. If the host does not do so, the script engine uses the user’s default locale ID. If there is no user, then the script engine uses the system’s default locale ID.

  • Note that the script engine’s locale ID is different from the system locale ID, the user locale ID, and the host application’s locale ID. The GetLocale function reports the locale ID in use by the script engine only.

VBA/VBScript Differences

The GetLocale function is not supported by VBA.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required