Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

5    Locale Manager Types

Text and Localization

Exploring Palm OS®

This chapter describes the types and constants declared in LocaleMgrTypes.h. It covers:

Locale Manager Structures and Types
Locale Manager Constants

For more information on the Locale Manager, see the chapter "Localized Applications".

Locale Manager Structures and Types ^TOP^

CountryType Typedef ^TOP^

Purpose

Legacy type that defines an old style of country code constants. Use LmCountryType instead.

Declared In

LocaleMgrTypes.h

Prototype

typedef uint8_t CountryType

LanguageType Typedef ^TOP^

Purpose

Legacy type that defines an old style of language code constants. Use LmLanguageType instead.

Declared In

LocaleMgrTypes.h

Prototype

typedef uint8_t LanguageType

LmCountryType Typedef ^TOP^

Purpose

Identifies a country in the ISO 3166 standard.

Declared In

LocaleMgrTypes.h

Prototype

typedef uint16_t LmCountryType

Comments

The country type constants have the following format:

cCountryName

where CountryName is the name of the country. There is one constant for each country identified in the ISO 3166 standard, which currently defines 239 countries.

The following table shows examples of the country type constants. For a complete list, see the LocaleMgrTypes.h file.

Constant

Value

Description

cAustralia

'AU'

Australia

cAustria

'AT'

Austria

cBelgium

'BE'

Belgium

LmLanguageType Typedef ^TOP^

Purpose

Identifies a language in the ISO 639 standard.

Declared In

LocaleMgrTypes.h

Prototype

typedef uint16_t LmLanguageType

Comments

The language type constants have the following format:

lLanguageName

where LanguageName is the name of the language. There is one constant for each language specified in the ISO 639 standard, which currently defines 137 languages.

The following table shows examples of the language type constants. For a complete list, see the LocaleMgrTypes.h file.

Constant

Value

Description

lEnglish

'en'

English

lFrench

'fr'

French

lGerman

'de'

German

LmLocaleType Struct ^TOP^

Purpose

Defines the country and language used in a locale.

Declared In

LocaleMgrTypes.h

Prototype

struct _LmLocaleType {
   LmLanguageType language;
   LmCountryType country;
} 
typedef struct _LmLocaleType LmLocaleType

Fields

language
An LmLanguageType constant that identifies the language spoken in the current locale.
country
An LmCountryType constant that identifies the locale's country, which helps to identify the language dialect. For example, a language of lEnglish specifies a different dialect if the country is cUnitedKingdom than if it is cUnitedStates.

NumberFormatType Typedef ^TOP^

Purpose

Specifies how numbers are formatted.

Declared In

LocaleMgrTypes.h

Prototype

typedef Enum8 NumberFormatType

Comments

The NumberFormatType constants values are not public because you should never have to check them directly. Retrieve the NumberFormatType from the preference or the locale and pass it directly to LmGetNumberSeparators() to retrieve the appropriate separator characters for thousands and decimals.

See Also

"Numbers"

Locale Manager Constants ^TOP^

LmLocaleSettingChoice Typedef ^TOP^

Purpose

Defines constants that you can pass to the LmGetLocaleSetting() function to specify which locale setting to retrieve.

Declared In

LocaleMgrTypes.h

Prototype

typedef uint16_t LmLocaleSettingChoice

Constants

#define lmChoiceCountryName ((LmLocaleSettingChoice)5)
A string buffer of size kMaxCountryNameLen+1 containing the name of the locale's country.
#define lmChoiceCurrencyDecimalPlaces ((LmLocaleSettingChoice)15)
A uint16_t containing the number of decimal places that monetary values are typically given.
#define lmChoiceCurrencyName ((LmLocaleSettingChoice)12)
A string buffer of size kMaxCurrencyNameLen+1 bytes containing the name of the currency used in this locale.
#define lmChoiceCurrencySymbol ((LmLocaleSettingChoice)13)
A string buffer of size kMaxCurrencySymbolLen+1 bytes containing the symbol used to denote monetary values in this locale.
#define lmChoiceDateFormat ((LmLocaleSettingChoice)6)
A DateFormatType containing the short date format used in this locale. For example:
95/12/31
#define lmChoiceInboundDefaultVObjectEncoding ((LmLocaleSettingChoice)23)
A CharEncodingType containing the inbound encoding for vObjects with no CHARSET property.
#define lmChoiceLocale ((LmLocaleSettingChoice)1)
An LmLocaleType structure containing the locale's language and country codes.
#define lmChoiceLongDateFormat ((LmLocaleSettingChoice)7)
A DateFormatType containing the long date format used in this locale. For example:
31 Dec 1995
#define lmChoiceMeasurementSystem ((LmLocaleSettingChoice)16)
A MeasurementSystemType containing the measurement system (metric system or English system) used in this locale.
#define lmChoiceNumberFormat ((LmLocaleSettingChoice)11)
A NumberFormatType containing the format used for numbers, with regards to the thousands separator and the decimal point, in this locale.
#define lmChoiceOutboundVObjectEncoding ((LmLocaleSettingChoice)22)
A CharEncodingType containing the outbound encoding for vObjects.
#define lmChoicePrimaryEmailEncoding ((LmLocaleSettingChoice)20)
A CharEncodingType containing the first attempt at email encoding.
#define lmChoicePrimarySMSEncoding ((LmLocaleSettingChoice)18)
A CharEncodingType containing the first attempt at SMS encoding.
#define lmChoiceSecondaryEmailEncoding ((LmLocaleSettingChoice)21)
A CharEncodingType containing the second attempt at email encoding.
#define lmChoiceSecondarySMSEncoding ((LmLocaleSettingChoice)19)
A CharEncodingType containing the second attempt at SMS encoding.
#define lmChoiceSupportsLunarCalendar ((LmLocaleSettingChoice)17)
A Boolean that specifies if the locale uses the Chinese Lunar Calendar. If true, the locale uses the calendar.
#define lmChoiceTimeFormat ((LmLocaleSettingChoice)8)
A TimeFormatType containing the format used for time values in this locale.
#define lmChoiceTimeZone ((LmLocaleSettingChoice)10)
An int16_t containing the locale's default time zone given as the number of minutes east of Greenwich Mean Time (GMT).
#define lmChoiceUniqueCurrencySymbol ((LmLocaleSettingChoice)14)
A string buffer of size kMaxCurrencySymbolLen+1 bytes containing the unique symbol for monetary values.
For example, the symbol $ is used both for US dollars and Portuguese escudos. The unique currency symbol for US dollars is US$.
#define lmChoiceWeekStartDay ((LmLocaleSettingChoice)9)
A uint16_t containing the first day of the week (Sunday or Monday) in this locale. Days of the week are numbered from 0 to 6 starting with Sunday = 0.

Locale Manager Errors ^TOP^

Purpose

Error constants used by the Locale Manager.

Declared In

LocaleMgrTypes.h
#define lmErrBadLocaleIndex (lmErrorClass | 2)
A locale index is out of range.
#define lmErrBadLocaleSettingChoice (lmErrorClass | 3)
An unrecognized value was used for a LmLocaleSettingChoice constant.
#define lmErrSettingDataOverflow (lmErrorClass | 4)
The buffer passed to LmGetLocaleSetting() is too small for the specified value.
#define lmErrUnknownLocale (lmErrorClass | 1)
An unrecognized value was passed for a LmLocaleType structure. Note that Palm OS® does not provide locales for all valid country and language combinations. For example, there currently is no locale defined for cIsrael and lHebrew.

Locale Manager Size Constants ^TOP^

Purpose

Specify the size of strings to allocate for some of the locale settings.

Declared In

LocaleMgrTypes.h

Constants

#define kMaxCountryNameLen 31
The maximum length of a country name string.
#define kMaxCurrencyNameLen 31
The maximum length of a currency name string.
#define kMaxCurrencySymbolLen 10
The maximum length of a currency symbol string.

Comments

These constants do not count the terminating null character. Therefore, you need to allocate a string of size kMaxCountryNameLen+1 to hold a country name, for example.

Locale Wildcard Constants ^TOP^

Purpose

Constants that can be used as wildcard values when searching for a locale using LmLocaleToIndex() or LmBestLocaleToIndex().

Declared In

LocaleMgrTypes.h

Constants

#define lmAnyCountry ((LmCountryType)'\?\?')
Specifies any country.
#define lmAnyLanguage ((LmLanguageType)'\?\?')
Specifies any language.

See Also

LmLanguageType, LmBestLocaleToIndex(), LmLocaleToIndex()