Community articlegetCurrentThreadStringValue method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method has a dual purpose. It can retrieve the language that the API uses when reporting errors, and it can retrieve the time zone that the API uses in all of its date and time operations.
The method takes a key as a parameter and returns the corresponding value. The key "Locale" returns the language (in the form of a Locale Name), and the key "TimeZoneId" returns the time zone. The values that are returned are either the values that are set by default on API startup, or the values set by one of setCurrentThreadStringValue, setCurrentThreadLocale, or setDefaultLocale.
The supported languages and the corresponding Locale Names are listed in Table 1. The supported time zones are the time zones in the International Components for Unicode (ICU)external link library, which correspond to Olson time zone data.

Method

   public void getCurrentThreadStringValue(
      String key,
      StringHolder valueHolder
   ) throws UWIException;


Parameters

Table 1. get current thread string value parameters
ExpressionTypeDescription
key StringMust be "Locale" to retrieve the language that the API uses for error reporting, or "TimeZoneId" to retrieve the time zone that the API uses in all of its date and time operations.
valueHolderStringHolderA com.PureEdge.StringHolder object that will contain the string value for the locale or time zone.


Returns

Returns nothing. Throws a UWIException if an error occurs.

Notes

The API can report errors in the following languages:
Table 2. API errors for various 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


Example

The sample method returns the locale and time zone information in the form of a key/value string.
public String getLocaleAndTimezone()
{
  LocalizationManager theManager;
  StringHolder locale = new StringHolder();
  StringHolder timezone = new StringHolder();
  String s;
 
  try
  {
    theManager.getCurrentThreadStringValue("Locale", locale);
    theManager.getCurrentThreadStringValue("TimeZoneId", timezone);
  }
  catch (UWIException e)
  {
    return(e.Message());
  }
  
  s = "Locale=" + locale.value + ";TimeZoneId=" + timezone.value;
  return s;
}