フリーソフト

« 2007年4月 | トップページ | 2007年6月 »

[BCB] 現在のOSの言語名を取得する

  char *LangName=NULL;

  LCID id=GetUserDefaultLCID();
  int Len=GetLocaleInfo(id,LOCALE_SENGLANGUAGE,NULL,0);
  if (Len>0) {
    LangName=new char[Len+1];
    ZeroMemory(LangName,Len+1);
    GetLocaleInfo(id,LOCALE_SENGLANGUAGE,LangName,Len+1);
  }

LOCALE_SENGLANGUAGEの部分を変えれば、国名(LOCALE_SENGCOUNTRY)や通貨名(LOCALE_SENGCURRNAME)、日付時刻の区切り文字(LOCALE_SDATE、LOCALE_STIME)などの各種ロケール情報を取得できます。

[BCB] OSの言語を判定

LCID LocaleID=GetUserDefaultLCID();

switch (LocaleID) {
case 1025: //Arabic (Saudi Arabia)
case 2049: //Arabic (Iraq)
case 3073: //Arabic (Egypt)
case 4097: //Arabic (Libya)
case 5121: //Arabic (Algeria)
case 6145: //Arabic (Morocco)
case 7169: //Arabic (Tunisia)
case 8193: //Arabic (Oman)
case 9217: //Arabic (Yemen)
case 10241: //Arabic (Syria)
case 11265: //Arabic (Jordan)
case 12289: //Arabic (Lebanon)
case 13313: //Arabic (Kuwait)
case 14337: //Arabic (U.A.E.)
case 15361: //Arabic (Bahrain)
case 16385: //Arabic (Qatar)
case 1026: //Bulgarian
case 1027: //Catalan
case 1028: //Chinese (Taiwan)
case 2052: //Chinese (PRC)
case 3076: //Chinese (Hong Kong)
case 4100: //Chinese (Singapore)
case 1029: //Czech
case 1030: //Danish
case 1031: //German (Standard)
case 2055: //German (Swiss)
case 3079: //German (Austrian)
case 4103: //German (Luxembourg)
case 5127: //German (Liechtenstein)
case 1032: //Greek
case 1033: //English (United States)
case 2057: //English (United Kingdom)
case 3081: //English (Australian)
case 4105: //English (Canadian)
case 5129: //English (New Zealand)
case 6153: //English (Ireland)
case 7177: //English (South Africa)
case 8201: //English (Jamaica)
case 9225: //English (Caribbean)
case 10249: //English (Belize)
case 11273: //English (Trinidad)
case 1034: //Spanish (Traditional Sort)
case 2058: //Spanish (Mexican)
case 3082: //Spanish (Modern Sort)
case 4106: //Spanish (Guatemala)
case 5130: //Spanish (Costa Rica)
case 6154: //Spanish (Panama)
case 7178: //Spanish (Dominican Republic)
case 8202: //Spanish (Venezuela)
case 9226: //Spanish (Colombia)
case 10250: //Spanish (Peru)
case 11274: //Spanish (Argentina)
case 12298: //Spanish (Ecuador)
case 13322: //Spanish (Chile)
case 14346: //Spanish (Uruguay)
case 15370: //Spanish (Paraguay)
case 16394: //Spanish (Bolivia)
case 17418: //Spanish (El Salvador)
case 18442: //Spanish (Honduras)
case 19466: //Spanish (Nicaragua)
case 20490: //Spanish (Puerto Rico)
case 1035: //Finnish
case 1036: //French (Standard)
case 2060: //French (Belgian)
case 3084: //French (Canadian)
case 4108: //French (Swiss)
case 5132: //French (Luxembourg)
case 1037: //Hebrew
case 1038: //Hungarian
case 1039: //Icelandic
case 1040: //Italian (Standard)
case 2064: //Italian (Swiss)
case 1041: //Japanese
case 1042: //Korean
case 2066: //Korean (Johab)
case 1043: //Dutch (Standard)
case 2067: //Dutch (Belgian)
case 1044: //Norwegian (Bokmal)
case 2068: //Norwegian (Nynorsk)
case 1045: //Polish
case 1046: //Portuguese (Brazil)
case 2070: //Portuguese (Portugal)
case 1048: //Romanian
case 1049: //Russian
case 1050: //Croatian
case 2074: //Serbian (Latin)
case 3098: //Serbian (Cyrillic)
case 1051: //Slovak
case 1052: //Albanian
case 1053: //Swedish
case 2077: //Swedish (Finland)
case 1054: //Thai
case 1055: //Turkish
case 1057: //Indonesian
case 1058: //Ukrainian
case 1059: //Belarusian
case 1060: //Slovenian
case 1061: //Estonian
case 1062: //Latvian
case 1063: //Lithuanian
case 1065: //Farsi
case 1066: //Vietnamese
case 1069: //Basque
case :1078 //Afrikaans
case 1080: //Faeroese
}

« 2007年4月 | トップページ | 2007年6月 »