ICU 64.2  64.2
Namespaces | Typedefs | Enumerations | Functions
uldnames.h File Reference

C API: Provides display names of Locale ids and their components. More...

#include "unicode/utypes.h"
#include "unicode/localpointer.h"
#include "unicode/uscript.h"
#include "unicode/udisplaycontext.h"

Go to the source code of this file.

Namespaces

 icu
 File coll.h.
 

Typedefs

typedef struct ULocaleDisplayNames ULocaleDisplayNames
 C typedef for struct ULocaleDisplayNames. More...
 

Enumerations

enum  UDialectHandling { ULDN_STANDARD_NAMES = 0, ULDN_DIALECT_NAMES }
 Enum used in LocaleDisplayNames::createInstance. More...
 

Functions

ULocaleDisplayNamesuldn_open (const char *locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode)
 Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided dialectHandling. More...
 
void uldn_close (ULocaleDisplayNames *ldn)
 Closes a ULocaleDisplayNames instance obtained from uldn_open(). More...
 
const char * uldn_getLocale (const ULocaleDisplayNames *ldn)
 Returns the locale used to determine the display names. More...
 
UDialectHandling uldn_getDialectHandling (const ULocaleDisplayNames *ldn)
 Returns the dialect handling used in the display names. More...
 
int32_t uldn_localeDisplayName (const ULocaleDisplayNames *ldn, const char *locale, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided locale. More...
 
int32_t uldn_languageDisplayName (const ULocaleDisplayNames *ldn, const char *lang, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided language code. More...
 
int32_t uldn_scriptDisplayName (const ULocaleDisplayNames *ldn, const char *script, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided script. More...
 
int32_t uldn_scriptCodeDisplayName (const ULocaleDisplayNames *ldn, UScriptCode scriptCode, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided script code. More...
 
int32_t uldn_regionDisplayName (const ULocaleDisplayNames *ldn, const char *region, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided region code. More...
 
int32_t uldn_variantDisplayName (const ULocaleDisplayNames *ldn, const char *variant, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided variant. More...
 
int32_t uldn_keyDisplayName (const ULocaleDisplayNames *ldn, const char *key, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided locale key. More...
 
int32_t uldn_keyValueDisplayName (const ULocaleDisplayNames *ldn, const char *key, const char *value, UChar *result, int32_t maxResultSize, UErrorCode *pErrorCode)
 Returns the display name of the provided value (used with the provided key). More...
 
ULocaleDisplayNamesuldn_openForContext (const char *locale, UDisplayContext *contexts, int32_t length, UErrorCode *pErrorCode)
 Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided UDisplayContext settings. More...
 
UDisplayContext uldn_getContext (const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode)
 Returns the UDisplayContext value for the specified UDisplayContextType. More...
 

Detailed Description

C API: Provides display names of Locale ids and their components.

Definition in file uldnames.h.

Typedef Documentation

◆ ULocaleDisplayNames

C typedef for struct ULocaleDisplayNames.

Stable:
ICU 4.4

Definition at line 52 of file uldnames.h.

Enumeration Type Documentation

◆ UDialectHandling

Enum used in LocaleDisplayNames::createInstance.

Stable:
ICU 4.4
Enumerator
ULDN_STANDARD_NAMES 

Use standard names when generating a locale name, e.g.

en_GB displays as 'English (United Kingdom)'.

Stable:
ICU 4.4
ULDN_DIALECT_NAMES 

Use dialect names, when generating a locale name, e.g.

en_GB displays as 'British English'.

Stable:
ICU 4.4

Definition at line 27 of file uldnames.h.

Function Documentation

◆ uldn_close()

void uldn_close ( ULocaleDisplayNames ldn)

Closes a ULocaleDisplayNames instance obtained from uldn_open().

Parameters
ldnthe ULocaleDisplayNames instance to be closed
Stable:
ICU 4.4

◆ uldn_getContext()

UDisplayContext uldn_getContext ( const ULocaleDisplayNames ldn,
UDisplayContextType  type,
UErrorCode pErrorCode 
)

Returns the UDisplayContext value for the specified UDisplayContextType.

Parameters
ldnthe ULocaleDisplayNames instance
typethe UDisplayContextType whose value to return
pErrorCodePointer to UErrorCode input/output status. If at entry this indicates a failure status, the function will do nothing; otherwise this will be updated with any new status from the function.
Returns
the UDisplayContextValue for the specified type.
Stable:
ICU 51

◆ uldn_getDialectHandling()

UDialectHandling uldn_getDialectHandling ( const ULocaleDisplayNames ldn)

Returns the dialect handling used in the display names.

Parameters
ldnthe LocaleDisplayNames instance
Returns
the dialect handling enum
Stable:
ICU 4.4

◆ uldn_getLocale()

const char* uldn_getLocale ( const ULocaleDisplayNames ldn)

Returns the locale used to determine the display names.

This is not necessarily the same locale passed to uldn_open.

Parameters
ldnthe LocaleDisplayNames instance
Returns
the display locale
Stable:
ICU 4.4

◆ uldn_keyDisplayName()

int32_t uldn_keyDisplayName ( const ULocaleDisplayNames ldn,
const char *  key,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided locale key.

Parameters
ldnthe LocaleDisplayNames instance
keythe locale key whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_keyValueDisplayName()

int32_t uldn_keyValueDisplayName ( const ULocaleDisplayNames ldn,
const char *  key,
const char *  value,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

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

Parameters
ldnthe LocaleDisplayNames instance
keythe locale key
valuethe locale key's value
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_languageDisplayName()

int32_t uldn_languageDisplayName ( const ULocaleDisplayNames ldn,
const char *  lang,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided language code.

Parameters
ldnthe LocaleDisplayNames instance
langthe language code whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_localeDisplayName()

int32_t uldn_localeDisplayName ( const ULocaleDisplayNames ldn,
const char *  locale,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided locale.

Parameters
ldnthe LocaleDisplayNames instance
localethe locale whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_open()

ULocaleDisplayNames* uldn_open ( const char *  locale,
UDialectHandling  dialectHandling,
UErrorCode pErrorCode 
)

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

The usual value for dialectHandling is ULOC_STANDARD_NAMES.

Parameters
localethe display locale
dialectHandlinghow to select names for locales
Returns
a ULocaleDisplayNames instance
Parameters
pErrorCodethe status code
Stable:
ICU 4.4

◆ uldn_openForContext()

ULocaleDisplayNames* uldn_openForContext ( const char *  locale,
UDisplayContext contexts,
int32_t  length,
UErrorCode pErrorCode 
)

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

Parameters
localeThe display locale
contextsList of one or more context settings (e.g. for dialect handling, capitalization, etc.
lengthNumber of items in the contexts list
pErrorCodePointer to UErrorCode input/output status. If at entry this indicates a failure status, the function will do nothing; otherwise this will be updated with any new status from the function.
Returns
a ULocaleDisplayNames instance
Stable:
ICU 51

◆ uldn_regionDisplayName()

int32_t uldn_regionDisplayName ( const ULocaleDisplayNames ldn,
const char *  region,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided region code.

Parameters
ldnthe LocaleDisplayNames instance
regionthe region code whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_scriptCodeDisplayName()

int32_t uldn_scriptCodeDisplayName ( const ULocaleDisplayNames ldn,
UScriptCode  scriptCode,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided script code.

Parameters
ldnthe LocaleDisplayNames instance
scriptCodethe script code whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_scriptDisplayName()

int32_t uldn_scriptDisplayName ( const ULocaleDisplayNames ldn,
const char *  script,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided script.

Parameters
ldnthe LocaleDisplayNames instance
scriptthe script whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4

◆ uldn_variantDisplayName()

int32_t uldn_variantDisplayName ( const ULocaleDisplayNames ldn,
const char *  variant,
UChar result,
int32_t  maxResultSize,
UErrorCode pErrorCode 
)

Returns the display name of the provided variant.

Parameters
ldnthe LocaleDisplayNames instance
variantthe variant whose display name to return
resultreceives the display name
maxResultSizethe size of the result buffer
pErrorCodethe status code
Returns
the actual buffer size needed for the display name. If it's greater than maxResultSize, the returned name will be truncated.
Stable:
ICU 4.4