2005/5/9

     
 

class Locale

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::util::Locale Class Reference

#include <Locale.h>

Inheritance diagram for acdk::util::Locale:

acdk::lang::Object acdk::lang::Cloneable acdk::io::Serializable acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

This Class represent a specific country an culture.

Classes which can be passed a Locale object tailor their information for a given locale. For instance, currency number formating is handled differently for the USA and France. Locales are made up of a language code, a country code, and an optional set of variant strings.

This class and source comments contains a C++ port of GNU Classpath project (http://www.gnu.org/software/classpath/classpath.html) with following copyright statement:

java.util.Locale: part of the Java Class Libraries project. Copyright (C) 1998 Jochen Hoenicke Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Public Member Functions

 Locale ()
 Locale (IN(RString) language, IN(RString) country)
 Locale (IN(RString) language, IN(RString) country, IN(RString) variant)
RString getLanguage ()
 This method returns the languege code of this locale.

RString getCountry ()
 This method returns the country code of this locale.

RString getVariant ()
 this method returns the variant code of this locale.

virtual int hashCode ()
virtual RString toString ()
 This method gets the string representation of the current locale.

virtual bool equals (IN(acdk::lang::Object) obj)
 Compares two locales.

virtual bool equals (IN(RLocale) other)
void setDefault (IN(RLocale) newLocale)
RString getISO3Languages ()
 This method returns three-letter ISO language abbrevation of this locale.

RString getISO3Country ()
 This method return the three-letter ISO country abbrevation of locale.

RString getDisplayLanguage ()
 This method gets the language name suitable for display to the user, formated for default locale.

RString getDisplayLanguage (IN(RLocale) locale)
 Gets the language name suitable for display to the user, formatted for a specified locale.

RString getDisplayCountry ()
 This method gets the country name suitable for display to the user, formated for default locale.

RString getDisplayCountry (IN(RLocale) locale)
 Gets the country name suitable for display to the user, formatted for a specified locale.

RString getDisplayVariant ()
 Return the variant name of this locale localized tothe given locale.

RString getDisplayVariant (IN(RLocale) locale)
 Gets the country name suitable for display to the user, formatted for a specified locale.

RString getDisplayName ()
 Gets all local compenent suitable for display to the user, formatted for the default locale.

RString getDisplayName (IN(RLocale) locale)
 Gets all local components suitable for display to the user, formatted for a specified locale.

virtual acdk::lang::Object clone ()
 Does the same as Object::clone.

virtual acdk::lang::Object clone (sys::Allocator *alc)

Static Public Member Functions

 OUT (RLocale) getDefault()
RLocale getENGLISH ()
RLocale getFRENCH ()
RLocale getGERMAN ()
RLocale getITALIAN ()
RLocale getJAPANESE ()
RLocale getKOREAN ()
RLocale getCHINESE ()
RLocale getSIMPLIFIED_CHINESE ()
RLocale getTRADITIONAL_CHINESE ()
RLocale getFRANCE ()
RLocale getGERMANY ()
RLocale getITALY ()
RLocale getJAPAN ()
RLocale getKOREA ()
RLocale getCHINA ()
RLocale getPRC ()
RLocale getTAIWAN ()
RLocale getUK ()
RLocale getUS ()
RLocale getCANADA ()
RLocale getCANADA_FRENCH ()
RLocaleArray getAvailableLocals ()
RStringArray getISOCountries ()
RStringArray getISOLanguages ()
RLocale getSystemLocale ()
 retrive the locale from the underlying opertion system If no system locale is available, it returns the en_US locale

RString getSystemLocaleString ()
 retrive the system locale as string Note: this string may not compatible with acdk::util::Locale identifier use getSystemLocale() to retrive an Locale compatible locale.

void setSystemLocale (IN(RLocale) loc, SystemLocaleCategory cat=SysLocaleAll)
 sets the locale of the underlying operation system

void setSystemLocale (IN(RString) localeIdent, SystemLocaleCategory cat=SysLocaleAll)
 set the locale string for the system locale note this string is may be not compatible with acdk::util::Locale identifier

void getSystemLocaleValues (OUT(RString) language, OUT(RString) country, OUT(RString) encoding)
 ask underlying opertion or C lib system locales.

void setSystemLocaleValues (IN(RString) language, IN(RString) country, IN(RString) encoding)
 set the underlying opertion or C lib system locales.

RString getSystemLanguage ()
 ask underlying opertion system locales

RString getSystemCountry ()
 ask underlying opertion system locales

RString getSystemEncoding ()
 ask underlying opertion system locales

RString longLang2ISO (IN(RString) language)
 translate long language identifier to 2 letter iso language identifier returns Nil if not found

RString longCountry2ISO (IN(RString) country)
 translate long country identifier to 2 letter iso country identifier returns Nil if not found

RString isoLang2longLang (IN(RString) language)
 translate iso language identifier to long language identifier return orginal value if not found

RString isoCountry2longCountry (IN(RString) country)
 translate iso country identifier to long country identifier return orginal value if not found


Private Member Functions

RString convertLanguage (IN(RString) language)
bool _equals (IN(RLocale) other)
void _calcHashCode ()

Private Attributes

RString _language
RString _country
RString _variant
int _hashCode

Static Private Attributes

RLocale _defaultLocale
RLocale ENGLISH
 Locale which represents the English language.

RLocale FRENCH
 Locale which represents the French language.

RLocale GERMAN
 Locale which represents the German language.

RLocale ITALIAN
 Locale which represents the Italian language.

RLocale JAPANESE
 Locale which represents the Japanese language.

RLocale KOREAN
 Locale which represents the Korean language.

RLocale CHINESE
 Locale which represents the Chinese language.

RLocale SIMPLIFIED_CHINESE
 Locale which represents the Chinese language as used in China.

RLocale TRADITIONAL_CHINESE
 Locale which represents the Chinese language as used in Taiwan.

RLocale FRANCE
 Locale which represents France.

RLocale GERMANY
 Locale which represents Germany.

RLocale ITALY
 Locale which represents Italy.

RLocale JAPAN
 Locale which represents Japan.

RLocale KOREA
 Locale which represents Korea.

RLocale CHINA
 Locale which represents China.

RLocale PRC
 Locale which represents the People's Republic of China.

RLocale TAIWAN
 Locale which represents Taiwan.

RLocale UK
 Locale which represents the United Kingdom.

RLocale US
 Locale which represents the United States.

RLocale CANADA
 Locale which represents the English speaking portion of Canada.

RLocale CANADA_FRENCH
 Locale which represents the French speaking portion of Canada.


Constructor & Destructor Documentation

acdk::util::Locale::Locale  ) 
 

acdk::util::Locale::Locale IN(RString language,
IN(RString country
 

acdk::util::Locale::Locale IN(RString language,
IN(RString country,
IN(RString variant
 


Member Function Documentation

void acdk::util::Locale::_calcHashCode  )  [private]
 

bool acdk::util::Locale::_equals IN(RLocale other  )  [private]
 

virtual acdk::lang::Object acdk::util::Locale::clone sys::Allocator *  alc  )  [virtual]
 

Reimplemented from acdk::lang::Cloneable.

virtual acdk::lang::Object acdk::util::Locale::clone  )  [inline, virtual]
 

Does the same as Object::clone.

Implements acdk::lang::Cloneable.

RString acdk::util::Locale::convertLanguage IN(RString language  )  [private]
 

virtual bool acdk::util::Locale::equals IN(RLocale other  )  [inline, virtual]
 

virtual bool acdk::util::Locale::equals IN(acdk::lang::Object obj  )  [inline, virtual]
 

Compares two locales.

Parameters:
obj the other locale.
Returns:
true, if obj is a Locale with the same language, country, and variant code as this locale, otherwise false.

Reimplemented from acdk::lang::Object.

RLocaleArray acdk::util::Locale::getAvailableLocals  )  [static]
 

RLocale acdk::util::Locale::getCANADA  )  [static]
 

RLocale acdk::util::Locale::getCANADA_FRENCH  )  [static]
 

RLocale acdk::util::Locale::getCHINA  )  [static]
 

RLocale acdk::util::Locale::getCHINESE  )  [static]
 

RString acdk::util::Locale::getCountry  )  [inline]
 

This method returns the country code of this locale.

Returns:
country code portion of this locale, or an empty String if none exists.

RString acdk::util::Locale::getDisplayCountry IN(RLocale locale  ) 
 

Gets the country name suitable for display to the user, formatted for a specified locale.

Parameters:
locale locale to use for formatting.
Returns:
the country name of this locale localized to the given lovale. If the localized is not found, the ISO code is returned.

RString acdk::util::Locale::getDisplayCountry  )  [inline]
 

This method gets the country name suitable for display to the user, formated for default locale.

This has the same effect as getDisplayLanguage(Locale->getDefault())

Returns:
the country name of this locale localized to the default locale. if the localized is not foubd, the ISO code is returned

RString acdk::util::Locale::getDisplayLanguage IN(RLocale locale  ) 
 

Gets the language name suitable for display to the user, formatted for a specified locale.

Parameters:
locale locale to use for formatting.
Returns:
the language name of this locale localized to the given lovale. If the localized is not found, the ISO code is returned.

RString acdk::util::Locale::getDisplayLanguage  )  [inline]
 

This method gets the language name suitable for display to the user, formated for default locale.

This has the same effect as getDisplayLanguage(Locale->getDefault())

Returns:
the language name of this locale localized to the default locale. if the localized is not foubd, the ISO code is returned

RString acdk::util::Locale::getDisplayName IN(RLocale locale  ) 
 

Gets all local components suitable for display to the user, formatted for a specified locale.

For the language component, getDisplayLanguage(Locale) is called. For the country component, getDisplayCountry(Locale) is called. For the variant set component, getDisplayVariant(Locale) is called.

The returned String will be one of the following forms:

language (country, variant) language (country) language (variant) country (variant) language country variant

Parameters:
locale locale to use for formatting
Returns:
String version of this locale, suitable for display to the user.

RString acdk::util::Locale::getDisplayName  )  [inline]
 

Gets all local compenent suitable for display to the user, formatted for the default locale.

For the language component, getDisplayLanguage is called. For the country component, getDisplayCountry is called. For the variant set component, getDisplayVariant is called.

The returned String will be one of the following forms: language (country, variant) language (country) language (varian) country (varian) language country variant

Returns:
RString version of this locale, suitable for display to the user.

RString acdk::util::Locale::getDisplayVariant IN(RLocale locale  ) 
 

Gets the country name suitable for display to the user, formatted for a specified locale.

Parameters:
locale locale to use for formatting.
Returns:
the country name of this locale localized to the given lovale. If the localized is not found, the ISO code is returned.

RString acdk::util::Locale::getDisplayVariant  )  [inline]
 

Return the variant name of this locale localized tothe given locale.

If the localized is not found, the variant code itself is returned. This has the same effect as getDisplayVariant(getDefault())

RLocale acdk::util::Locale::getENGLISH  )  [static]
 

RLocale acdk::util::Locale::getFRANCE  )  [static]
 

RLocale acdk::util::Locale::getFRENCH  )  [static]
 

RLocale acdk::util::Locale::getGERMAN  )  [static]
 

RLocale acdk::util::Locale::getGERMANY  )  [static]
 

RString acdk::util::Locale::getISO3Country  ) 
 

This method return the three-letter ISO country abbrevation of locale.

Exceptions:
MissingResourceException if three-letter code is not known.

RString acdk::util::Locale::getISO3Languages  ) 
 

This method returns three-letter ISO language abbrevation of this locale.

Exceptions:
MissingResourceException if three-letter code is not known.

RStringArray acdk::util::Locale::getISOCountries  )  [static]
 

RStringArray acdk::util::Locale::getISOLanguages  )  [static]
 

RLocale acdk::util::Locale::getITALIAN  )  [static]
 

RLocale acdk::util::Locale::getITALY  )  [static]
 

RLocale acdk::util::Locale::getJAPAN  )  [static]
 

RLocale acdk::util::Locale::getJAPANESE  )  [static]
 

RLocale acdk::util::Locale::getKOREA  )  [static]
 

RLocale acdk::util::Locale::getKOREAN  )  [static]
 

RString acdk::util::Locale::getLanguage  )  [inline]
 

This method returns the languege code of this locale.

Returns:
languege code portion of this locale, or an emty String if none exists.

RLocale acdk::util::Locale::getPRC  )  [static]
 

RLocale acdk::util::Locale::getSIMPLIFIED_CHINESE  )  [static]
 

RString acdk::util::Locale::getSystemCountry  )  [static]
 

ask underlying opertion system locales

Returns:
Nil if not known

RString acdk::util::Locale::getSystemEncoding  )  [static]
 

ask underlying opertion system locales

Returns:
Nil if not known

RString acdk::util::Locale::getSystemLanguage  )  [static]
 

ask underlying opertion system locales

Returns:
Nil if not known

RLocale acdk::util::Locale::getSystemLocale  )  [static]
 

retrive the locale from the underlying opertion system If no system locale is available, it returns the en_US locale

RString acdk::util::Locale::getSystemLocaleString  )  [static]
 

retrive the system locale as string Note: this string may not compatible with acdk::util::Locale identifier use getSystemLocale() to retrive an Locale compatible locale.

void acdk::util::Locale::getSystemLocaleValues OUT(RString language,
OUT(RString country,
OUT(RString encoding
[static]
 

ask underlying opertion or C lib system locales.

This function try to translate the operation system locale indentifier to ACDK Locale identifier

Returns:
Nil in params if not known

RLocale acdk::util::Locale::getTAIWAN  )  [static]
 

RLocale acdk::util::Locale::getTRADITIONAL_CHINESE  )  [static]
 

RLocale acdk::util::Locale::getUK  )  [static]
 

RLocale acdk::util::Locale::getUS  )  [static]
 

RString acdk::util::Locale::getVariant  )  [inline]
 

this method returns the variant code of this locale.

virtual int acdk::util::Locale::hashCode  )  [inline, virtual]
 

See also:
serialized_hashCode

Reimplemented from acdk::lang::Object.

RString acdk::util::Locale::isoCountry2longCountry IN(RString country  )  [static]
 

translate iso country identifier to long country identifier return orginal value if not found

RString acdk::util::Locale::isoLang2longLang IN(RString language  )  [static]
 

translate iso language identifier to long language identifier return orginal value if not found

RString acdk::util::Locale::longCountry2ISO IN(RString country  )  [static]
 

translate long country identifier to 2 letter iso country identifier returns Nil if not found

RString acdk::util::Locale::longLang2ISO IN(RString language  )  [static]
 

translate long language identifier to 2 letter iso language identifier returns Nil if not found

acdk::util::Locale::OUT RLocale   )  [static]
 

void acdk::util::Locale::setDefault IN(RLocale newLocale  )  [inline]
 

void acdk::util::Locale::setSystemLocale IN(RString localeIdent,
SystemLocaleCategory  cat = SysLocaleAll
[static]
 

set the locale string for the system locale note this string is may be not compatible with acdk::util::Locale identifier

void acdk::util::Locale::setSystemLocale IN(RLocale loc,
SystemLocaleCategory  cat = SysLocaleAll
[static]
 

sets the locale of the underlying operation system

void acdk::util::Locale::setSystemLocaleValues IN(RString language,
IN(RString country,
IN(RString encoding
[static]
 

set the underlying opertion or C lib system locales.

This function try to translate ACDK Locale identifier to the operation system locale indentifier.

Bug:
not implemented

virtual RString acdk::util::Locale::toString  )  [virtual]
 

This method gets the string representation of the current locale.

This consists of the language, the country, and variant, separated by an underscore. If one of this three component is missing the underscore will also diappear.

Returns:
the string representation of this Locale.

Reimplemented from acdk::lang::Object.


Member Data Documentation

RString acdk::util::Locale::_country [private]
 

RLocale acdk::util::Locale::_defaultLocale [static, private]
 

int acdk::util::Locale::_hashCode [private]
 

RString acdk::util::Locale::_language [private]
 

RString acdk::util::Locale::_variant [private]
 

RLocale acdk::util::Locale::CANADA [static, private]
 

Locale which represents the English speaking portion of Canada.

RLocale acdk::util::Locale::CANADA_FRENCH [static, private]
 

Locale which represents the French speaking portion of Canada.

RLocale acdk::util::Locale::CHINA [static, private]
 

Locale which represents China.

Same as SIMPLIFIED_CHINESE Locale.

RLocale acdk::util::Locale::CHINESE [static, private]
 

Locale which represents the Chinese language.

RLocale acdk::util::Locale::ENGLISH [static, private]
 

Locale which represents the English language.

RLocale acdk::util::Locale::FRANCE [static, private]
 

Locale which represents France.

RLocale acdk::util::Locale::FRENCH [static, private]
 

Locale which represents the French language.

RLocale acdk::util::Locale::GERMAN [static, private]
 

Locale which represents the German language.

RLocale acdk::util::Locale::GERMANY [static, private]
 

Locale which represents Germany.

RLocale acdk::util::Locale::ITALIAN [static, private]
 

Locale which represents the Italian language.

RLocale acdk::util::Locale::ITALY [static, private]
 

Locale which represents Italy.

RLocale acdk::util::Locale::JAPAN [static, private]
 

Locale which represents Japan.

RLocale acdk::util::Locale::JAPANESE [static, private]
 

Locale which represents the Japanese language.

RLocale acdk::util::Locale::KOREA [static, private]
 

Locale which represents Korea.

RLocale acdk::util::Locale::KOREAN [static, private]
 

Locale which represents the Korean language.

RLocale acdk::util::Locale::PRC [static, private]
 

Locale which represents the People's Republic of China.

Same as CHINA Locale.

RLocale acdk::util::Locale::SIMPLIFIED_CHINESE [static, private]
 

Locale which represents the Chinese language as used in China.

RLocale acdk::util::Locale::TAIWAN [static, private]
 

Locale which represents Taiwan.

Same as TRADITIONAL_CHINESE Locale.

RLocale acdk::util::Locale::TRADITIONAL_CHINESE [static, private]
 

Locale which represents the Chinese language as used in Taiwan.

Same as TAIWAN Locale.

RLocale acdk::util::Locale::UK [static, private]
 

Locale which represents the United Kingdom.

RLocale acdk::util::Locale::US [static, private]
 

Locale which represents the United States.