Community articleLocalizationManager_SetDefaultLocale function
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars




Description

This function sets the default language that the API uses for error reporting. If the default is not set, the API uses the language of the operating system. You can override this setting with either LocalizationManager_SetCurrentThreadLocaleLocalizationManager_SetCurrentThreadStringValue.
The API can report errors in the following languages:
Table 1. API supported languages
LanguageLocaleLocale Name
ArabicAlgeriaar_DZ

Bahrain ar_BH

Egyptar_EG

Iraqar_IQ

Jordanar_JO

Kuwaitar_KW

Lebanonar_LB

Libyaar_LY

Moroccoar_MA

Omanar_OM

Qatarar_QA

Saudi Arabiaar_SA

Sudanar_SD

Syriaar_SY

Tunisiaar_TN

United Arab Emiratesar_AE

Yemenar_YE
ChineseSimplified Han, Chinazh_Hans_CN

Simplified Han, Singaporezh_Hans_SG

Traditional Han, Hong Kong S.A.R., Chinazh_Hant_HK

Traditional Han, Taiwanzh_Hant_TW
CroatianCroatiahr_HT
CzechCzech Republiccs_CZ
DanishDenmarkda_DK
DutchBelgiumnl_BE

The Netherlandsnl_NL
EnglishAustraliaen_AU

Belgiumen_BE

Canadaen_CA

Hong Kong S.A.R., Chinaen_HK

Indiaen_IN

Irelanden_IE

New Zealanden_NZ

Philippinesen_PH

Singaporeen_SG

South Africaen_ZA

United Kingdomen_GB

United Statesen_US
FinnishFinlandfi_FI
FrenchBelgiumfr_BE

Canadafr_CA

Francefr_FR

Luxembourgfr_LU

Switzerlandfr_CH
GermanAustriade_AT

Germanyde_DE

Luxembourgde_LU

Switzerlandde_CH
GreekGreeceel_GR
HebrewIsraelhe_IL
HungarianHungaryhu_HU
ItalianItalyit_IT

Switzerlandit_CH
JapaneseJapanja_JP
KoreanSouth Koreako_KR
Norwegian BokmålNorwaynb_NO
PolishPolandpl_PL
PortugueseBrazilpt_BR

Portugalpt_PT
RomanianRomaniaro_RO
RussianRussianru_RU
SlovakSlovakiask_SK
SloveneSloveniasl_SI
SpanishArgentinaes_AR

Boliviaes_BO

Chilees_CL

Colombiaes_CO

Costa Ricaes_CR

Dominican Republices_DO

Ecuadores_EC

El Salvadores_SV

Guatemalaes_GT

Hondurases_HN

Mexicoes_MX

Nicaraguaes_NI

Panamaes_PA

Paraguayes_PY

Perues_PE

Puerto Ricoes_PR

Spaines_ES

United Stateses_US

Uruguayes_UY

Venezuelaes_VE
SwedishSwedensv_SE
TurkishTurkeytr_TR


The locale name consists of two parts: the language code and the country code, as shown
   <language code>_<COUNTRY CODE>

For example, to specify the Japanese locale, you would type:
   jp_JP

If you need a more specific locale, you may add additional codes after the country code. For example, to indicate French in France with a Euro dialect, you would type:
   fr_FR_EU


Function

   r_error LocalizationManager_SetDefaultLocale(
      r_charP theLocale);


Parameters

Table 2. set default locale parameters
ExpressionTypeDescription
theLocaler_charPThe name of the locale.


Returns

OK on success or an error code on failure.

Example

The following function checks the language string to determine which locale to use. It then calls Localization Manger_SetDefaultLocale to set the appropriate locale.
   r_error setDefaultLanguage(r_charP language)
   {
   r_charP locale;
   r_error theError;
 
      if (cp_strcmp(language, "english") == OK)
      {
         if ((theError = LocalizationManager_SetDefaultLocale("en_US")) !=
            OK)
         {
            fprintf(stderr, "LocalizationManager_SetDefaultLocale 
               error %hd./n", error);
            return(NOTOK);
         }
      }
      else
      {
         if ((theError = LocalizationManager_SetDefaultLocale("fr_CA")) !=
            OK)
         {
            fprintf(stderr, "LocalizationManager_SetDefaultLocale 
               error %hd./n", error);
            return(NOTOK);
         }
      }
   }