Что нового

[Script] System Language

Medic84

Омега
Команда форума
Администратор
Сообщения
1 552
Репутация
328
AutoIt: 3.2.1.2 - 3.3.0.0
Версия: 0.0.1
Категория:
Название: (Script) System Language
Описание: Самый простенький Script. Получение языка операционной системы не в цифрах, а понятным(английским) языком
Пример:
Код:
#include "OSLanguage.au3"
MsgBox(64,"Язык","Язык системы = "& $OSLanguage)

Источник: Medic84

P.S. Файл примера в архиве
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8 175
Репутация
2 333
Re: (UDF) System Language

Вот второй вариант такой функции (работает во все стороны :smile:):

Код:
$sOSLang_Str = _OSGetLangString(-1)
ConsoleWrite("+ [Get @OSLang string] (Default): " & $sOSLang_Str & @CRLF)

$sOSLang_Str = _OSGetLangString("Russian")
ConsoleWrite("> [Get lang code by specific string]: " & $sOSLang_Str & @CRLF)

$sOSLang_Code = _OSGetLangString($sOSLang_Str)
ConsoleWrite("! [Get string by specific lang code]: " & $sOSLang_Code & @CRLF)

Func _OSGetLangString($sOSLang_Code = -1)
	Local $aOSLang_Codes = StringSplit( _
		"0436|41c|0401|0801|0c01|1001|1401|1801|1c01|2001|2401|2801|2c01|3001|3401|3801|3c01|4001|042b|042c|082c|" & _
		"042d|0423|0402|0403|0404|0804|0c04|1004|1404|041a|0405|0406|0413|0813|0409|0809|0c09|1009|1409|1809|1c09|2009|2409|" & _
		"2809|2c09|3009|3409|0425|0438|0429|040b|040c|080c|0c0c|100c|140c|180c|0437|407|0807|0c07|1007|1407|408|040d|0439|" & _
		"040e|040f|0421|0410|0810|0411|043f|0457|0412|0426|0427|042f|043e|083e|044e|0414|0814|0415|0416|0816|0418|0419|044f|" & _
		"081a|0c1a|041b|0424|040a|080a|0c0a|100a|140a|180a|1c0a|200a|240a|280a|2c0a|300a|340a|380a|3c0a|400a|440a|480a|4c0a|" & _
		"500a|0441|041d|081d|0449|0444|041e|041f|0422|0420|0443|0843|042a", "|")
	
	Local $aOSLang_Strings = StringSplit( _
		"Afrikaans|Albanian|Arabic_Saudi_Arabia|Arabic_Iraq|Arabic_Egypt|Arabic_Libya|Arabic_Algeria|Arabic_Morocco|" & _
		"Arabic_Tunisia|Arabic_Oman|Arabic_Yemen|Arabic_Syria|Arabic_Jordan|Arabic_Lebanon|Arabic_Kuwait|Arabic_UAE|" & _
		"Arabic_Bahrain|Arabic_Qatar|Armenian|Azeri_Latin|Azeri_Cyrillic|Basque|Belarusian|Bulgarian|Catalan|Chinese_Taiwan|" & _
		"Chinese_PRC|Chinese_Hong_Kong|Chinese_Singapore|Chinese_Macau|Croatian|Czech|Danish|Dutch_Standard|Dutch_Belgian|" & _
		"English_United_States|English_United_Kingdom|English_Australian|English_Canadian|English_New_Zealand|English_Irish|" & _
		"English_South_Africa|English_Jamaica|English_Caribbean|English_Belize|English_Trinidad|English_Zimbabwe|" & _
		"English_Philippines|Estonian|Faeroese|Farsi|Finnish|French_Standard|French_Belgian|French_Canadian|French_Swiss|" & _
		"French_Luxembourg|French_Monaco|Georgian|German_Standard|German_Swiss|German_Austrian|German_Luxembourg|" & _
		"German_Liechtenstei|Greek|Hebrew|Hindi|Hungarian|Icelandic|Indonesian|Italian_Standard|Italian_Swiss|Japanese|" & _
		"Kazakh|Konkani|Korean|Latvian|Lithuanian|Macedonian|Malay_Malaysia|Malay_Brunei_Darussalam|Marathi|Norwegian_Bokmal|" & _
		"Norwegian_Nynorsk|Polish|Portuguese_Brazilian|Portuguese_Standard|Romanian|Russian|Sanskrit|Serbian_Latin|" & _
		"Serbian_Cyrillic|Slovak|Slovenian|Spanish_Traditional_Sort|Spanish_Mexican|Spanish_Modern_Sort|Spanish_Guatemala|" & _
		"Spanish_Costa_Rica|Spanish_Panama|Spanish_Dominican_Republic|Spanish_Venezuela|Spanish_Colombia|Spanish_Peru|" & _
		"Spanish_Argentina|Spanish_Ecuador|Spanish_Chile|Spanish_Uruguay|Spanish_Paraguay|Spanish_Bolivia|Spanish_El_Salvador|" & _
		"Spanish_Honduras|Spanish_Nicaragua|Spanish_Puerto_Rico|Swahili|Swedish|Swedish_Finland|Tamil|Tatar|Thai|Turkish|" & _
		"Ukrainian|Urdu|Uzbek_Latin|Uzbek_Cyrillic|Vietnamese", "|")
	
	For $i = 1 To $aOSLang_Codes[0]
		If $sOSLang_Code = -1 Then
			If @OSLang = $aOSLang_Codes[$i] Then Return $aOSLang_Strings[$i]
		Else
			If $sOSLang_Code = $aOSLang_Codes[$i] Then Return $aOSLang_Strings[$i]
			If $sOSLang_Code = $aOSLang_Strings[$i] Then Return $aOSLang_Codes[$i]
		EndIf
	Next
	
	Return SetError(1, 0, 0)
EndFunc
 
Верх