LynnS Posted March 23, 2006 Share Posted March 23, 2006 I have five different scripts that are basically identical except for variables that represent the dialogue screens in different languages. The problem is that when a computer system is installed using the English version of the OS, and then the language/locale is changed for a different language, the "OK", "Yes", "No", etc, buttons still display in English. If the OS was installed in the other language, the buttons display in the correct language (like "Acceptar", "Si", "No", etc for Spanish). Is there a way to force AutoIt's msgbox function to utilize a specific language? Thanks in advance for any help! Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 24, 2006 Share Posted March 24, 2006 (edited) have a look at @OSLang in help file If @OSlang <> "0406" Then;danish ;function elseif @OSlang <> "0436" then;africaans ;function EndIf 040a,080a,0c0a,100a,140a,180a,1c0a,200a, 240a,280a,2c0a,300a,340a,380a,3c0a,400a, 440a,480a,4c0a,500a here's another way expandcollapse popup;function here _Language()) MsgBox(0, "Your OS Language:", _Language()) Func _Language() Select Case StringInStr("0413,0813", @OSLang) Return "Dutch";remove and return function specifally to oslang Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009, _ 2409,2809,2c09,3009,3409", @OSLang) Return "English";remove and return function specifally to oslang Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Return "French";remove and return function specifally to oslang Case StringInStr("0407,0807,0c07,1007,1407", @OSLang) Return "German";remove and return function specifally to oslang Case StringInStr("0410,0810", @OSLang) Return "Italian";remove and return function specifally to oslang Case StringInStr("0414,0814", @OSLang) Return "Norwegian";remove and return function specifally to oslang Case StringInStr("0415", @OSLang) Return "Polish";remove and return function specifally to oslang Case StringInStr("0416,0816", @OSLang) Return "Portuguese";remove and return function specifally to oslang Case StringInStr("040a,080a,0c0a,100a,140a,180a,1c0a,200a, _ 240a,280a,2c0a,300a,340a,380a,3c0a,400a, _ 440a,480a,4c0a,500a", @OSLang) Return "Spanish";remove and return function specifally to oslang Case StringInStr("041d,081d", @OSLang) Return "Swedish";remove and return function specifally to oslang Case Else Return "Other (can determine with @OSLang directly" EndSelect EndFunc Edited March 24, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
LynnS Posted March 24, 2006 Author Share Posted March 24, 2006 That gets me the language of the OS that is currently installed... But is there a way to force the autoit script/executable to use a particular language set? Link to comment Share on other sites More sharing options...
CyberSlug Posted March 24, 2006 Share Posted March 24, 2006 (edited) Use an ini file to store the translations..... Code and ini example below: $lang = "Spanish" ;$lang = _Language(); from slightly_abnormal or the help file MsgBox(0x1000, "", Translate("Hi")) MsgBox(0x1000, "", Translate("Bye")) Func Translate($txt) Return IniRead(@ScriptDir & "\LangInfo.ini", $lang, $txt, $txt) EndFunc [English] Hi= Hello Bye=Goodbye [spanish] Hi =Hola Bye=Adios [German] Hi=guten Tag Bye=auf WiedersehenOr you could organize the INI the following way, but I think the above makes more sense: [Hi] English= Spanish= German= [bye] English= Spanish= German= Edited March 24, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
LynnS Posted March 24, 2006 Author Share Posted March 24, 2006 That's a nice way to have multiple languages for each string of text... But the "OK" button still displays as "OK" instead of "Acceptar". I am trying to get the buttons for the different types of message boxes to appear in the correct language (per the install script) instead of what language the computer system is configured to use. The way it currently appears: The way I need it to apepar: Link to comment Share on other sites More sharing options...
Josbe Posted March 24, 2006 Share Posted March 24, 2006 That's a nice way to have multiple languages for each string of text... But the "OK" button still displays as "OK" instead of "Acceptar". I am trying to get the buttons for the different types of message boxes to appear in the correct language (per the install script) instead of what language the computer system is configured to use. The way it currently appears: The way I need it to apepar: Yes, the fact is OS Language. Like alternative, you can create your own Msgbox with the GUI features. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
CyberSlug Posted March 24, 2006 Share Posted March 24, 2006 I get what you are saying. I read your second post in this thread instead of the original AutoIt just calls the standard Windows MsgBox function to display message boxes.... Do the message boxes in notepad, mspaint, wordpad, etc. show English or the the correct language? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
LynnS Posted March 24, 2006 Author Share Posted March 24, 2006 They show English there as well. I think that I'll have to make them deal with English buttons (if they're using an English-based OS install). Thanks for the help everyone. Link to comment Share on other sites More sharing options...
LynnS Posted August 18, 2006 Author Share Posted August 18, 2006 (edited) All, I found that if the XP OS image was installed in English, and then the MultiLingual Pack installed, the location in the registry that controls how the dialog screens are displayed is locaed here: HKCU\Control Panel\Desktop", "MultiUILanguageId" A normal English install of the XP OS (without the language pack) does not have this particular value in the registry. So I populated a language variable $lang using the _Language() function "Slightly_Abnormal" shared, then I add the following lines, and run it back through an equivelant language function, but instead of searching against @OSLang, I did it against my $test variable. $test = RegRead("HKCU\Control Panel\Desktop", "MultiUILanguageId") $guierror = @error If $guierror == -1 OR $guierror == 1 Then Return "English" ; If we cannot read the registry value $test = StringRight($test, 4) ; match only the last 4 numbers Hope this helps someone else. Thanks "Slighty_Abnormal"... I use your language function all of the time. Edited August 18, 2006 by LynnS Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now