none
Changing Display Language using VbScript

    Question

  • Hello,

    I am trying to test an app I created in several languages.

      I was wondering if it is possible to do this is vbscript and how I can change the display language each time (Control Panel ->Change display language)

    Essentially

    step 1. Run app

    step 2. Change language

    step 3. Log off /Restart (I understand this is required once the language is changed)

    I have set up steps 1 and 3 and part of step 2 (so that the script remembers which language it needs to change to).  I just can't find a function/method to get the current language and set it to another language. 

    Do I need to change registry keys for this ?

    Thanks for the help

    = KapRS

    Wednesday, January 26, 2011 5:48 AM

All replies

  • You are correct - you will need to change registry keys.  I'm no expert, but I think this will work.  We use a similar method during our imaging process, but I've never done this after the fact.  In theory, it should work.

    Here's the VB Code but you need the accompanying registry information below the code as well:

    'Requires that all variables be defined explictly
    Option Explicit
    
    'Define Variables
    Dim wshShell,oFSO
    Dim Locale, RegionalSettingsFolder, RegionalSettingsFile
    
    'Initialize Variables
    Set wshShell = WScript.CreateObject("WScript.Shell")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    
    ' Path to where the registry files are stored
    RegionalSettingsFolder = "C:\regionalsettings"
    
    ' Change this to the Locale/Region you want like:
    ' EAST, WEST, MOUNTAIN, LONDON, BRUSSELS etc
    Locale = EAST
    
    ' I log most things to the event log versus wscript.echo - feel free to change this
    wshShell.LogEvent 4, "Office Identified: " & Locale
    
    RegionalSettingsFile = WinDir & "\RegionalSettings_" & Locale & ".reg"
    
    If oFSO.FileExists (RegionalSettingsFile) Then
    	' Load Default User Registry Hive for Windows XP
    	wshShell.Run "%comspec% /c REG LOAD HKLM\.DEFAULT ""C:\Documents and Settings\default user\NTUSER.DAT""",0,True
    
    	' Load Default User Registry Hive for Vista, 7 etc
    	'wshShell.Run "%comspec% /c REG LOAD HKLM\.DEFAULT ""C:\users\default\NTUSER.DAT""",0,True
    
    	wshShell.Run "%comspec% /c regedit /s " & RegionalSettingsFile,0,True
    	wshShell.Run "%comspec% /c REG UNLOAD HKLM\.DEFAULT",0,True
    
    	wshShell.LogEvent 4, Locale & " Regional Settings Updated in Default User"
    Else
    	wshShell.LogEvent 4, Locale & " Regional Settings have NOT been updated"
    End If
    
    

     

    Save each one of the registry settings below as separate .REG files using the following naming convention:

    • RegionalSettings_EAST.reg
    • RegionalSettings_LONDON.reg
    • RegionalSettings_WEST.reg

    --------------------------------BRUSSELS------------------------------

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International]
    "iCountry"="32"
    "iCurrDigits"="2"
    "iCurrency"="3"
    "iDate"="1"
    "iDigits"="2"
    "iLZero"="1"
    "iMeasure"="0"
    "iNegCurr"="8"
    "iTime"="0"
    "iTLZero"="1"
    "Locale"="00000409"
    "s1159"="AM"
    "s2359"="PM"
    "sCountry"="Belgium"
    "sCurrency"="€"
    "sDate"="/"
    "sDecimal"="."
    "sLanguage"="FRB"
    "sList"=","
    "sLongDate"="dddd, dd, MMM, yyyy"
    "sShortDate"="d/M/yyyy"
    "sThousand"="."
    "sTime"=":"
    "sTimeFormat"="HH:mm:ss"
    "iTimePrefix"="0"
    "sMonDecimalSep"=","
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="0"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International\Geo]
    "Nation"="21"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle\scancode]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Preload]
    "2"="00000409"
    "1"="0000080c"
    "3"="00000813"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Substitutes]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="1"
    "Language Hotkey"="1"
    "Layout Hotkey"="2"

    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    "1"="0000080c"
    "2"="00000809"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Software\Microsoft\CTF]
    "Disable Thread Input Manager"=dword:00000000

    [HKEY_LOCAL_MACHINE\.DEFAULT\Software\Microsoft\CTF\LangBar]
    "ShowStatus"=dword:00000004

    [HKEY_LOCAL_MACHINE\.DEFAULT\Software\Microsoft\CTF\Sapilayr]
    "ProfileInitialized"=dword:00000000

    [HKEY_LOCAL_MACHINE\.DEFAULT\Software\Microsoft\CTF\MSUTB]
    "ShowDeskBand"=dword:00000001

    [HKEY_LOCAL_MACHINE\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run]
    "ctfmon.exe"="C:\\WINDOWS\\System32\\ctfmon.exe"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
    "Bias"=dword:ffffffc4
    "StandardName"="Romance Standard Time"
    "StandardBias"=dword:00000000
    "StandardStart"=hex:00,00,0a,00,05,00,03,00,00,00,00,00,00,00,00,00
    "DaylightName"="Romance Daylight Time"
    "DaylightBias"=dword:ffffffc4
    "DaylightStart"=hex:00,00,03,00,05,00,02,00,00,00,00,00,00,00,00,00
    "ActiveTimeBias"=dword:ffffffc4

    ---------------------------------------------------------------------------

    ----------------------------LONDON----------------------------------

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International]
    "iCountry"="44"
    "iCurrDigits"="2"
    "iCurrency"="0"
    "iDate"="1"
    "iDigits"="2"
    "iLZero"="1"
    "iMeasure"="0"
    "iNegCurr"="1"
    "iTime"="1"
    "iTLZero"="1"
    "Locale"="00000809"
    "s1159"="AM"
    "s2359"="PM"
    "sCountry"="United Kingdom"
    "sCurrency"="£"
    "sDate"="/"
    "sDecimal"="."
    "sLanguage"="ENG"
    "sList"=","
    "sLongDate"="dd MMMM yyyy"
    "sShortDate"="d/M/yyyy"
    "sThousand"=","
    "sTime"=":"
    "sTimeFormat"="HH:mm:ss"
    "iTimePrefix"="0"
    "sMonDecimalSep"="."
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="0"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International\Geo]
    "Nation"="242"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle\scancode]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000809"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Substitutes]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="1"
    "Language Hotkey"="1"
    "Layout Hotkey"="2"

    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000809"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
    "Bias"=dword:00000000
    "StandardName"="GMT Standard Time"
    "StandardBias"=dword:00000000
    "StandardStart"=hex:00,00,0a,00,05,00,02,00,00,00,00,00,00,00,00,00
    "DaylightName"="GMT Daylight Time"
    "DaylightBias"=dword:ffffffc4
    "DaylightStart"=hex:00,00,03,00,05,00,01,00,00,00,00,00,00,00,00,00
    "ActiveTimeBias"=dword:00000000

    ------------------------------------------------------------------------

    ----------------------------US EAST COAST-------------------------

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International]
    "iCountry"="1"
    "iCurrDigits"="2"
    "iCurrency"="0"
    "iDate"="0"
    "iDigits"="2"
    "iLZero"="1"
    "iMeasure"="1"
    "iNegCurr"="0"
    "iTime"="0"
    "iTLZero"="0"
    "Locale"="00000409"
    "s1159"="AM"
    "s2359"="PM"
    "sCountry"="United States"
    "sCurrency"="$"
    "sDate"="/"
    "sDecimal"="."
    "sLanguage"="ENU"
    "sList"=","
    "sLongDate"="dddd, MMMM dd, yyyy"
    "sShortDate"="M/d/yyyy"
    "sThousand"=","
    "sTime"=":"
    "sTimeFormat"="h:mm:ss tt"
    "iTimePrefix"="0"
    "sMonDecimalSep"="."
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="6"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International\Geo]
    "Nation"="244"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle\scancode]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Substitutes]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="3"
    "Language Hotkey"="3"
    "Layout Hotkey"="3"

    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
    "Bias"=dword:0000012c
    "StandardName"="Eastern Standard Time"
    "StandardBias"=dword:00000000
    "StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
    "DaylightName"="Eastern Daylight Time"
    "DaylightBias"=dword:ffffffc4
    "DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
    "ActiveTimeBias"=dword:000000f0

    ------------------------------------------------------------------------

    -------------------------US WEST COAST---------------------------

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International]
    "iCountry"="1"
    "iCurrDigits"="2"
    "iCurrency"="0"
    "iDate"="0"
    "iDigits"="2"
    "iLZero"="1"
    "iMeasure"="1"
    "iNegCurr"="0"
    "iTime"="0"
    "iTLZero"="0"
    "Locale"="00000409"
    "s1159"="AM"
    "s2359"="PM"
    "sCountry"="United States"
    "sCurrency"="$"
    "sDate"="/"
    "sDecimal"="."
    "sLanguage"="ENU"
    "sList"=","
    "sLongDate"="dddd, MMMM dd, yyyy"
    "sShortDate"="M/d/yyyy"
    "sThousand"=","
    "sTime"=":"
    "sTimeFormat"="h:mm:ss tt"
    "iTimePrefix"="0"
    "sMonDecimalSep"="."
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="6"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International\Geo]
    "Nation"="244"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle\scancode]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Substitutes]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="3"
    "Language Hotkey"="3"
    "Layout Hotkey"="3"

    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
    "Bias"=dword:000001e0
    "StandardName"="Pacific Standard Time"
    "StandardBias"=dword:00000000
    "StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
    "DaylightName"="Pacific Daylight Time"
    "DaylightBias"=dword:ffffffc4
    "DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
    "ActiveTimeBias"=dword:000001a4

    ------------------------------------------------------------------------

    --------------------------US Mountain--------------------------------

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International]
    "iCountry"="1"
    "iCurrDigits"="2"
    "iCurrency"="0"
    "iDate"="0"
    "iDigits"="2"
    "iLZero"="1"
    "iMeasure"="1"
    "iNegCurr"="0"
    "iTime"="0"
    "iTLZero"="0"
    "Locale"="00000409"
    "s1159"="AM"
    "s2359"="PM"
    "sCountry"="United States"
    "sCurrency"="$"
    "sDate"="/"
    "sDecimal"="."
    "sLanguage"="ENU"
    "sList"=","
    "sLongDate"="dddd, MMMM dd, yyyy"
    "sShortDate"="M/d/yyyy"
    "sThousand"=","
    "sTime"=":"
    "sTimeFormat"="h:mm:ss tt"
    "iTimePrefix"="0"
    "sMonDecimalSep"="."
    "sMonThousandSep"=","
    "iNegNumber"="1"
    "sNativeDigits"="0123456789"
    "NumShape"="1"
    "iCalendarType"="1"
    "iFirstDayOfWeek"="6"
    "iFirstWeekOfYear"="0"
    "sGrouping"="3;0"
    "sMonGrouping"="3;0"
    "sPositiveSign"=""
    "sNegativeSign"="-"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\International\Geo]
    "Nation"="244"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\IMEtoggle\scancode]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Substitutes]

    [HKEY_LOCAL_MACHINE\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="3"
    "Language Hotkey"="3"
    "Layout Hotkey"="3"

    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    "1"="00000409"

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
    "Bias"=dword:000001a4
    "StandardName"="Mountain Standard Time"
    "StandardBias"=dword:00000000
    "StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
    "DaylightName"="Mountain Daylight Time"
    "DaylightBias"=dword:ffffffc4
    "DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
    "ActiveTimeBias"=dword:00000168

    -------------------------------------------------------------------------

    • Proposed as answer by JuliusPIV Sunday, February 13, 2011 11:45 PM
    Sunday, February 13, 2011 11:42 PM