Jump to content
Colduction

_GetLanguage() | Supports more countries

Recommended Posts

Hello AutoIt Programmers, i was working on my project and i reffered to @KBLayout, @MUILang & @OSLang then i saw that code example of this macro is not too complete, i decided to share my customized _GetLanguage() for you:

#include <MsgBoxConstants.au3>

MsgBox($MB_SYSTEMMODAL, "", "The language of the OS is: " & _GetLanguage() & " (" & LCIDToLocaleName("0x" & @OSLang) & ")")

; Retrieve the language of the operating system.
Func _GetLanguage()
    Switch @OSLang
        Case "0004"
            Return "Chinese - Simplified"
        Case "0401"
            Return "Arabic - Saudi Arabia"
        Case "0402"
            Return "Bulgarian - Bulgaria"
        Case "0403"
            Return "Catalan - Spain"
        Case "0404"
            Return "Chinese (Traditional) - Taiwan"
        Case "0405"
            Return "Czech - Czech Republic"
        Case "0406"
            Return "Danish - Denmark"
        Case "0407"
            Return "German - Germany"
        Case "0408"
            Return "Greek - Greece"
        Case "0409"
            Return "English - United States"
        Case "040A"
            Return "Spanish - Spain"
        Case "040B"
            Return "Finnish - Finland"
        Case "040C"
            Return "French - France"
        Case "040D"
            Return "Hebrew - Israel"
        Case "040E"
            Return "Hungarian - Hungary"
        Case "040F"
            Return "Icelandic - Iceland"
        Case "0410"
            Return "Italian - Italy"
        Case "0411"
            Return "Japanese - Japan"
        Case "0412"
            Return "Korean - Korea"
        Case "0413"
            Return "Dutch - Netherlands"
        Case "0414"
            Return "Norwegian (Bokmål) - Norway"
        Case "0415"
            Return "Polish - Poland"
        Case "0416"
            Return "Portuguese - Brazil"
        Case "0417"
            Return "Romansh - Switzerland"
        Case "0418"
            Return "Romanian - Romania"
        Case "0419"
            Return "Russian - Russia"
        Case "041A"
            Return "Croatian - Croatia"
        Case "041B"
            Return "Slovak - Slovakia"
        Case "041C"
            Return "Albanian - Albania"
        Case "041D"
            Return "Swedish - Sweden"
        Case "041E"
            Return "Thai - Thailand"
        Case "041F"
            Return "Turkish - Turkey"
        Case "0420"
            Return "Urdu - Pakistan"
        Case "0421"
            Return "Indonesian - Indonesia"
        Case "0422"
            Return "Ukrainian - Ukraine"
        Case "0423"
            Return "Belarusian - Belarus"
        Case "0424"
            Return "Slovenian - Slovenia"
        Case "0425"
            Return "Estonian - Estonia"
        Case "0426"
            Return "Latvian - Latvia"
        Case "0427"
            Return "Lithuanian - Lithuanian"
        Case "0428"
            Return "Tajik (Cyrillic) - Tajikistan"
        Case "0429"
            Return "Persian - Iran"
        Case "042A"
            Return "Vietnamese - Vietnam"
        Case "042B"
            Return "Armenian - Armenia"
        Case "042C"
            Return "Azeri (Latin) - Azerbaijan"
        Case "042D"
            Return "Basque - Basque"
        Case "042E"
            Return "Upper Sorbian - Germany"
        Case "042F"
            Return "Macedonian - Macedonia"
        Case "0432"
            Return "Setswana / Tswana - South Africa"
        Case "0434"
            Return "isiXhosa - South Africa"
        Case "0435"
            Return "isiZulu - South Africa"
        Case "0436"
            Return "Afrikaans - South Africa"
        Case "0437"
            Return "Georgian - Georgia"
        Case "0438"
            Return "Faroese - Faroe Islands"
        Case "0439"
            Return "Hindi - India"
        Case "043A"
            Return "Maltese - Malta"
        Case "043B"
            Return "Sami (Northern) - Norway"
        Case "043e"
            Return "Malay - Malaysia"
        Case "043F"
            Return "Kazakh - Kazakhstan"
        Case "0440"
            Return "Kyrgyz - Kyrgyzstan"
        Case "0441"
            Return "Swahili - Kenya"
        Case "0442"
            Return "Turkmen - Turkmenistan"
        Case "0443"
            Return "Uzbek (Latin) - Uzbekistan"
        Case "0444"
            Return "Tatar - Russia"
        Case "0445"
            Return "Bangla - Bangladesh"
        Case "0446"
            Return "Punjabi - India"
        Case "0447"
            Return "Gujarati - India"
        Case "0448"
            Return "Oriya - India"
        Case "0449"
            Return "Tamil - India"
        Case "044A"
            Return "Telugu - India"
        Case "044B"
            Return "Kannada - India"
        Case "044C"
            Return "Malayalam - India"
        Case "044D"
            Return "Assamese - India"
        Case "044E"
            Return "Marathi - India"
        Case "044F"
            Return "Sanskrit - India"
        Case "0450"
            Return "Mongolian (Cyrillic) - Mongolia"
        Case "0451"
            Return "Tibetan - China"
        Case "0452"
            Return "Welsh - United Kingdom"
        Case "0453"
            Return "Khmer - Cambodia"
        Case "0454"
            Return "Lao - Lao PDR"
        Case "0456"
            Return "Galician - Spain"
        Case "0457"
            Return "Konkani - India"
        Case "0459"
            Return "(reserved) - (reserved)"
        Case "045A"
            Return "Syriac - Syria"
        Case "045B"
            Return "Sinhala - Sri Lanka"
        Case "045C"
            Return "Cherokee - Cherokee"
        Case "045D"
            Return "Inuktitut (Canadian_Syllabics) - Canada"
        Case "045E"
            Return "Amharic - Ethiopia"
        Case "0461"
            Return "Nepali - Nepal"
        Case "0462"
            Return "Frisian - Netherlands"
        Case "0463"
            Return "Pashto - Afghanistan"
        Case "0464"
            Return "Filipino - Philippines"
        Case "0465"
            Return "Divehi - Maldives"
        Case "0468"
            Return "Hausa - Nigeria"
        Case "046A"
            Return "Yoruba - Nigeria"
        Case "046B"
            Return "Quechua - Bolivia"
        Case "046C"
            Return "Sesotho sa Leboa - South Africa"
        Case "046D"
            Return "Bashkir - Russia"
        Case "046E"
            Return "Luxembourgish - Luxembourg"
        Case "046F"
            Return "Greenlandic - Greenland"
        Case "0470"
            Return "Igbo - Nigeria"
        Case "0473"
            Return "Tigrinya - Ethiopia"
        Case "0475"
            Return "Hawiian - United States"
        Case "0478"
            Return "Yi - China"
        Case "047A"
            Return "Mapudungun - Chile"
        Case "047C"
            Return "Mohawk - Canada"
        Case "047E"
            Return "Breton - France"
        Case "0480"
            Return "Uyghur - China"
        Case "0481"
            Return "Maori - New Zealand"
        Case "0482"
            Return "Occitan - France"
        Case "0483"
            Return "Corsican - France"
        Case "0484"
            Return "Alsatian - France"
        Case "0485"
            Return "Sakha - Russia"
        Case "0486"
            Return "K'iche - Guatemala"
        Case "0487"
            Return "Kinyarwanda - Rwanda"
        Case "0488"
            Return "Wolof - Senegal"
        Case "048C"
            Return "Dari - Afghanistan"
        Case "0491"
            Return "Scottish Gaelic - United Kingdom"
        Case "0492"
            Return "Central Kurdish - Iraq"
        Case "0801"
            Return "Arabic - Iraq"
        Case "0803"
            Return "Valencian - Valencia"
        Case "0804"
            Return "Chinese (Simplified) - China"
        Case "0807"
            Return "German - Switzerland"
        Case "0809"
            Return "English - United Kingdom"
        Case "080A"
            Return "Spanish - Mexico"
        Case "080C"
            Return "French - Belgium"
        Case "0810"
            Return "Italian - Switzerland"
        Case "0813"
            Return "Dutch - Belgium"
        Case "0814"
            Return "Norwegian (Nynorsk) - Norway"
        Case "0816"
            Return "Portuguese - Portugal"
        Case "081A"
            Return "Serbian (Latin) - Serbia and Montenegro"
        Case "081D"
            Return "Swedish - Finland"
        Case "0820"
            Return "Urdu - (reserved)"
        Case "082C"
            Return "Azeri (Cyrillic) - Azerbaijan"
        Case "082E"
            Return "Lower Sorbian - Germany"
        Case "0832"
            Return "Setswana / Tswana - Botswana"
        Case "083B"
            Return "Sami (Northern) - Sweden"
        Case "083C"
            Return "Irish - Ireland"
        Case "083E"
            Return "Malay - Brunei Darassalam"
        Case "0843"
            Return "Uzbek (Cyrillic) - Uzbekistan"
        Case "0845"
            Return "Bangla - Bangladesh"
        Case "0846"
            Return "Punjabi - Pakistan"
        Case "0849"
            Return "Tamil - Sri Lanka"
        Case "0850"
            Return "Mongolian (Mong) - Mongolia"
        Case "0859"
            Return "Sindhi - Pakistan"
        Case "085D"
            Return "Inuktitut (Latin) - Canada"
        Case "085F"
            Return "Tamazight (Latin) - Algeria"
        Case "0867"
            Return "Pular - Senegal"
        Case "086B"
            Return "Quechua - Ecuador"
        Case "0873"
            Return "(reserved) - (reserved)"
        Case "0873"
            Return "Tigrinya - Eritrea"
        Case "0C01"
            Return "Arabic - Egypt"
        Case "0C04"
            Return "Chinese - Hong Kong SAR"
        Case "0C07"
            Return "German - Austria"
        Case "0C09"
            Return "English - Australia"
        Case "0C0A"
            Return "Spanish - Spain"
        Case "0C0C"
            Return "French - Canada"
        Case "0C1A"
            Return "Serbian (Cyrillic) - Serbia and Montenegro"
        Case "0C3B"
            Return "Sami (Northern) - Finland"
        Case "0C6B"
            Return "Quechua - Peru"
        Case "1001"
            Return "Arabic - Libya"
        Case "1004"
            Return "Chinese - Singapore"
        Case "1007"
            Return "German - Luxembourg"
        Case "1009"
            Return "English - Canada"
        Case "100A"
            Return "Spanish - Guatemala"
        Case "100C"
            Return "French - Switzerland"
        Case "101A"
            Return "Croatian (Latin) - Bosnia and Herzegovina"
        Case "103B"
            Return "Sami (Lule) - Norway"
        Case "105F"
            Return "Central Atlas Tamazight (Tifinagh) - Morocco"
        Case "1401"
            Return "Arabic - Algeria"
        Case "1404"
            Return "Chinese - Macao SAR"
        Case "1407"
            Return "German - Liechtenstein"
        Case "1409"
            Return "English - New Zealand"
        Case "140A"
            Return "Spanish - Costa Rica"
        Case "140C"
            Return "French - Luxembourg"
        Case "141A"
            Return "Bosnian (Latin) - Bosnia and Herzegovina"
        Case "143B"
            Return "Sami (Lule) - Sweden"
        Case "1801"
            Return "Arabic - Morocco"
        Case "1809"
            Return "English - Ireland"
        Case "180A"
            Return "Spanish - Panama"
        Case "180C"
            Return "French - Monaco"
        Case "181A"
            Return "Serbian (Latin) - Bosnia and Herzegovina"
        Case "183B"
            Return "Sami (Southern) - Norway"
        Case "1C01"
            Return "Arabic - Tunisia"
        Case "1c09"
            Return "English - South Africa"
        Case "1C0A"
            Return "Spanish - Dominican Republic"
        Case "1C1A"
            Return "Serbian (Cyrillic) - Bosnia and Herzegovina"
        Case "1C3B"
            Return "Sami (Southern) - Sweden"
        Case "2001"
            Return "Arabic - Oman"
        Case "2009"
            Return "English - Jamaica"
        Case "200A"
            Return "Spanish - Venezuela"
        Case "201A"
            Return "Bosnian (Cyrillic) - Bosnia and Herzegovina"
        Case "203B"
            Return "Sami (Skolt) - Finland"
        Case "2401"
            Return "Arabic - Yemen"
        Case "2409"
            Return "English - Caribbean"
        Case "240A"
            Return "Spanish - Colombia"
        Case "241A"
            Return "Serbian (Latin) - Serbia"
        Case "243B"
            Return "Sami (Inari) - Finland"
        Case "2801"
            Return "Arabic - Syria"
        Case "2809"
            Return "English - Belize"
        Case "280A"
            Return "Spanish - Peru"
        Case "281A"
            Return "Serbian (Cyrillic) - Serbia"
        Case "2C01"
            Return "Arabic - Jordan"
        Case "2C09"
            Return "English - Trinidad and Tobago"
        Case "2C0A"
            Return "Spanish - Argentina"
        Case "2C1A"
            Return "Serbian (Latin) - Montenegro"
        Case "3001"
            Return "Arabic - Lebanon"
        Case "3009"
            Return "English - Zimbabwe"
        Case "300A"
            Return "Spanish - Ecuador"
        Case "301A"
            Return "Serbian (Cyrillic) - Montenegro"
        Case "3401"
            Return "Arabic - Kuwait"
        Case "3409"
            Return "English - Philippines"
        Case "340A"
            Return "Spanish - Chile"
        Case "3801"
            Return "Arabic - U.A.E."
        Case "380A"
            Return "Spanish - Uruguay"
        Case "3C01"
            Return "Arabic - Bahrain"
        Case "3C0A"
            Return "Spanish - Paraguay"
        Case "4001"
            Return "Arabic - Qatar"
        Case "4009"
            Return "English - India"
        Case "400A"
            Return "Spanish - Bolivia"
        Case "4409"
            Return "English - Malaysia"
        Case "440A"
            Return "Spanish - El Salvador"
        Case "4809"
            Return "English - Singapore"
        Case "480A"
            Return "Spanish - Honduras"
        Case "4C0A"
            Return "Spanish - Nicaragua"
        Case "500A"
            Return "Spanish - Puerto Rico"
        Case "540A"
            Return "Spanish - United States"
        Case "7C04"
            Return "Chinese - Traditional"
        Case Else
            Return "Other (can't determine with @OSLang directly)"
    EndSwitch
EndFunc   ;==>_GetLanguage

Func LCIDToLocaleName($iLCID)
    Local $aRet = DllCall("kernel32.dll", "int", "LCIDToLocaleName", "int", $iLCID, "wstr", "", "int", 85, "dword", 0)
    Return $aRet[2]
EndFunc   ;==>LCIDToLocaleName

_GetLanguage.au3

Source: AutoIt Help File (ScITE Editor (F1))

I hope you enjoy this tiny code.


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites
#include <MsgBoxConstants.au3>
#include <APILocaleConstants.au3>
#include <WinAPILocale.au3>

$iID = _WinAPI_GetSystemDefaultUILanguage()
MsgBox($MB_SYSTEMMODAL, "", "The language of the OS is: " & _WinAPI_GetLocaleInfo($iID, $LOCALE_SLANGUAGE) & " (" & LCIDToLocaleName($iID) & ")")

$iID = _WinAPI_GetSystemDefaultLCID()
MsgBox($MB_SYSTEMMODAL, "", "The user language of the OS is: " & _WinAPI_GetLocaleInfo($iID, $LOCALE_SLANGUAGE) & " (" & LCIDToLocaleName($iID) & ")")

Func LCIDToLocaleName($iLCID)
    Local $aRet = DllCall("kernel32.dll", "int", "LCIDToLocaleName", "int", $iLCID, "wstr", "", "int", 85, "dword", 0)
    Return $aRet[2]
EndFunc   ;==>LCIDToLocaleName

 


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Colduction
      Hi AutoIt Programmers!, I just looking for a way to change entered keys in English to Russian keys and reverse, i must clear for you to understand. For example:
       
      I write keys on keyboard and i forgot to change input language and then the result will be: Dkflbvbh (Thing we write in fact) ====> Владимир (Thing we want)
       
      And reverse: Владимир  ====> Dkflbvbh

      Is there any solution without writing constant for each words? for example dlls or WinAPIs.
    • By Probudha
      Hi,
      Can some please let me know which programming language is used to develop AutoIt? Client is requesting for it...
    • By Blueman
      Hey Guys,
      Maybe you can help me with something small.
      It is not terrible but it slows down my script and after a while even crash the script.

      First i explain what i have;
      I have a GUI with a lot of GUICtrlCreateInput controls, lets say 600 pieces.
      All the controls are hidden when the GUI is displayed, i have 3 buttons attached to 200 pieces each.
      When i press button-1 the first 200 controls are showed,
      When i press button-2 the first 200 controls are hidden and the next 200 controls are showed,
      etc, etc.
      This is working perfectly but after a while the GUI is getting slower and slower.
      After a while the controls aren't responding anymore and the script crashes.
      When i compile the script to 64-Bits version the speed is a lot better but you can still see the script slowing down each time i use the buttons.
      I think there has to be a buffer somewhere that is filling each time i show and hide the controls, but how can i clear that buffer without restarting the script?
      Deleting and re-creating the controls didn't help, deleting the entire gui (and controls) and re-creating it didn't help also.
      The only thing that is working is restarting the script.

      Thanks guys!

      PS: If you need a working example i can add it to this topic, just let me know. It is not rocket science, i just create the controls and show/hide them with a while loop and 3 buttons.
       
    • By XinYoung
      Hello again 
      I need to click this Submit button, but it's in a lightbox and has no ID (i think) and I can't figure out a way to target it. _IEFormSubmit doesn't work.

       
      Thank you
    • By timmy2
      To change the language used by Windows GUI and the browser (Chrome in my case), the only method I've found that works is to go to Settings > Time & Language > Language > Preferred Language, switch the default from English to Spanish, sign out, and then upon signing in everything will be in Spanish as expected.
      Besides automating the above process is there a more direct way to change Windows' settings using AutoIt?
×
×
  • Create New...