前往: 導覽, 搜尋

使用 TestComplete 看目前OS語系的範例(讀取regedit)

上網路查了之後發現目前windows 會將語系放在 registry 裡面的

HKEY_CURRENT_USER\Control Panel\International
其中 sLanguage 的Key 代表如下:
Value	 Meaning
CSY	 Czech
DAN	 Danish
DEA	 German (Austrian)
DES	 German (Swiss)
DEU	 German
ELL	 Greek
ENA	 English (Australia)
ENC	 English (Canada)
ENG	 English (U.K.)
ENI	 English (Irish)
ENU	 English (U.S.)
ENZ	 English (New Zealand)
ESM	 Spanish (Mexican)
ESN	 Modern Spanish
ESP	 Castilian Spanish
ETI	 Estonian
FIN	 Finnish
FRA	 French
FRB	 French (Belgian)
FRC	 French (Canadian)
FRS	 French (Swiss)
HUN	 Hungarian
ISL	 Icelandic
ITA	 Italian
ITS	 Italian (Swiss)
NLB	 Dutch (Belgian)
NLD	 Dutch
NON	 Norwegian (Nynorsk)
NOR	 Norwegian (Bokmal)
PLK	 Polish
PTB	 Portuguese (Brazilian)
PTG	 Portuguese
RUS	 Russian
SKY	 Slovak
SVC	 Swedish
SVE	 Swedish
TRK	 Turkish 

在TC裡面的範例:

var result = Storages.Registry(“Control Panel\\International\\”, HKEY_CURRENT_USER);//開啟的路徑
var lan = result.GetOption(“sLanguage”,0);//取得路徑中的值
Log.Message(lan);//show me current language


參考資料:
http://www.windowsitpro.com/article/jsifaq/jsi-tip-0311-regional-settings-in-the-registry-.aspx