ICU 76.1: icu::LocaleDisplayNames Class Reference

ICU 76.1 76.1

Public Member Functions | Static Public Member Functions
icu::LocaleDisplayNames Class Referenceabstract

Returns display names of Locales and components of Locales. More...

`#include <locdspnm.h>`

Inheritance diagram for icu::LocaleDisplayNames:

## Public Member Functions
virtual | ~LocaleDisplayNames ()
| Destructor.
virtual const Locale & | getLocale () const =0
| Returns the locale used to determine the display names.
virtual UDialectHandling | getDialectHandling () const =0
| Returns the dialect handling used in the display names.
virtual UDisplayContext | getContext (UDisplayContextType type) const =0
| Returns the UDisplayContext value for the specified UDisplayContextType.
virtual UnicodeString & | localeDisplayName (const Locale &locale, UnicodeString &result) const =0
| Returns the display name of the provided locale.
virtual UnicodeString & | localeDisplayName (const char *localeId, UnicodeString &result) const =0
| Returns the display name of the provided locale id.
virtual UnicodeString & | languageDisplayName (const char *lang, UnicodeString &result) const =0
| Returns the display name of the provided language code.
virtual UnicodeString & | scriptDisplayName (const char *script, UnicodeString &result) const =0
| Returns the display name of the provided script code.
virtual UnicodeString & | scriptDisplayName (UScriptCode scriptCode, UnicodeString &result) const =0
| Returns the display name of the provided script code.
virtual UnicodeString & | regionDisplayName (const char *region, UnicodeString &result) const =0
| Returns the display name of the provided region code.
virtual UnicodeString & | variantDisplayName (const char *variant, UnicodeString &result) const =0
| Returns the display name of the provided variant.
virtual UnicodeString & | keyDisplayName (const char *key, UnicodeString &result) const =0
| Returns the display name of the provided locale key.
virtual UnicodeString & | keyValueDisplayName (const char *key, const char *value, UnicodeString &result) const =0
| Returns the display name of the provided value (used with the provided key).
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor.
virtual UClassID | getDynamicClassID () const
| ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.

## Static Public Member Functions
static LocaleDisplayNames * | createInstance (const Locale &locale)
| Convenience overload of `createInstance(const Locale& locale, UDialectHandling dialectHandling)` that specifies STANDARD dialect handling.
static LocaleDisplayNames * | createInstance (const Locale &locale, UDialectHandling dialectHandling)
| Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided dialectHandling.
static LocaleDisplayNames * | createInstance (const Locale &locale, UDisplayContext *contexts, int32_t length)
| Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided UDisplayContext settings.

## Detailed Description

Returns display names of Locales and components of Locales.

For more information on language, script, region, variant, key, and values, see Locale.

Stable
  ICU 4.4

Definition at line 38 of file locdspnm.h.

## Constructor & Destructor Documentation

## ◆ ~LocaleDisplayNames()

virtual icu::LocaleDisplayNames::~LocaleDisplayNames | ( |  | ) |
| virtual

Destructor.

Stable
  ICU 4.4

## Member Function Documentation

## ◆ createInstance() [1/3]

LocaleDisplayNames * icu::LocaleDisplayNames::createInstance | ( | const Locale & | locale | ) |
| inlinestatic

Convenience overload of `createInstance(const Locale& locale, UDialectHandling dialectHandling)` that specifies STANDARD dialect handling.

Parameters

  locale | the display locale

Returns
  a LocaleDisplayNames instance

Stable
  ICU 4.4

Definition at line 201 of file locdspnm.h.

References ULDN_STANDARD_NAMES.

## ◆ createInstance() [2/3]

static LocaleDisplayNames * icu::LocaleDisplayNames::createInstance | ( | const Locale & | locale,
|  | UDialectHandling | dialectHandling )
| static

Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided dialectHandling.

Parameters

  locale | the display locale
  dialectHandling | how to select names for locales

Returns
  a LocaleDisplayNames instance

Stable
  ICU 4.4

## ◆ createInstance() [3/3]

static LocaleDisplayNames * icu::LocaleDisplayNames::createInstance | ( | const Locale & | locale,
|  | UDisplayContext * | contexts,
|  | int32_t | length )
| static

Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided UDisplayContext settings.

Parameters

  locale | the display locale
  contexts | List of one or more context settings (e.g. for dialect handling, capitalization, etc.
  length | Number of items in the contexts list

Returns
  a LocaleDisplayNames instance

Stable
  ICU 51

## ◆ getContext()

virtual UDisplayContext icu::LocaleDisplayNames::getContext | ( | UDisplayContextType | type | ) | const
| pure virtual

Returns the UDisplayContext value for the specified UDisplayContextType.

Parameters

  type | the UDisplayContextType whose value to return

Returns
  the UDisplayContext for the specified type.

Stable
  ICU 51

## ◆ getDialectHandling()

virtual UDialectHandling icu::LocaleDisplayNames::getDialectHandling | ( |  | ) | const
| pure virtual

Returns the dialect handling used in the display names.

Returns
  the dialect handling enum

Stable
  ICU 4.4

## ◆ getLocale()

virtual const Locale & icu::LocaleDisplayNames::getLocale | ( |  | ) | const
| pure virtual

Returns the locale used to determine the display names.

This is not necessarily the same locale passed to `createInstance`.

Returns
  the display locale

Stable
  ICU 4.4

## ◆ keyDisplayName()

virtual UnicodeString & icu::LocaleDisplayNames::keyDisplayName | ( | const char * | key,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided locale key.

Parameters

  key | the locale key name
  result | receives the locale key's display name

Returns
  the display name of the provided locale key

Stable
  ICU 4.4

## ◆ keyValueDisplayName()

virtual UnicodeString & icu::LocaleDisplayNames::keyValueDisplayName | ( | const char * | key,
|  | const char * | value,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided value (used with the provided key).

Parameters

  key | the locale key name
  value | the locale key's value
  result | receives the value's display name

Returns
  the display name of the provided value

Stable
  ICU 4.4

## ◆ languageDisplayName()

virtual UnicodeString & icu::LocaleDisplayNames::languageDisplayName | ( | const char * | lang,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided language code.

Parameters

  lang | the language code
  result | receives the language code's display name

Returns
  the display name of the provided language code

Stable
  ICU 4.4

## ◆ localeDisplayName() [1/2]

virtual UnicodeString & icu::LocaleDisplayNames::localeDisplayName | ( | const char * | localeId,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided locale id.

Parameters

  localeId | the id of the locale whose display name to return
  result | receives the locale's display name

Returns
  the display name of the provided locale

Stable
  ICU 4.4

## ◆ localeDisplayName() [2/2]

virtual UnicodeString & icu::LocaleDisplayNames::localeDisplayName | ( | const Locale & | locale,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided locale.

Parameters

  locale | the locale whose display name to return
  result | receives the locale's display name

Returns
  the display name of the provided locale

Stable
  ICU 4.4

## ◆ regionDisplayName()

virtual UnicodeString & icu::LocaleDisplayNames::regionDisplayName | ( | const char * | region,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided region code.

Parameters

  region | the region code
  result | receives the region code's display name

Returns
  the display name of the provided region code

Stable
  ICU 4.4

## ◆ scriptDisplayName() [1/2]

virtual UnicodeString & icu::LocaleDisplayNames::scriptDisplayName | ( | const char * | script,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided script code.

Parameters

  script | the script code
  result | receives the script code's display name

Returns
  the display name of the provided script code

Stable
  ICU 4.4

## ◆ scriptDisplayName() [2/2]

virtual UnicodeString & icu::LocaleDisplayNames::scriptDisplayName | ( | UScriptCode | scriptCode,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided script code.

Parameters

  scriptCode | the script code number
  result | receives the script code's display name

Returns
  the display name of the provided script code

Stable
  ICU 4.4

## ◆ variantDisplayName()

virtual UnicodeString & icu::LocaleDisplayNames::variantDisplayName | ( | const char * | variant,
|  | UnicodeString & | result ) const
| pure virtual

Returns the display name of the provided variant.

Parameters

  variant | the variant string
  result | receives the variant's display name

Returns
  the display name of the provided variant

Stable
  ICU 4.4

The documentation for this class was generated from the following file:

- common/unicode/locdspnm.h