TLocale Class Reference

#include <e32std.h>

Link against: EAACPlusAudioControllerUtility.lib

class TLocale
Public Member Enumerations
enumanonymous { EFlagNegativeLoseSpace, EFlagNegativeCurrencySymbolOpposite }
enumTDeviceTimeState { EDeviceUserTime, ENITZNetworkTimeSync }
enumTNegativeCurrencyFormat { ELeadingMinusSign, EInBrackets, ETrailingMinusSign, EInterveningMinusSign }
Public Member Functions
TLocale()
TLocale(TInt)
TBool AmPmSpaceBetween()
TLocalePos AmPmSymbolPosition()
TClockFormat ClockFormat()
TInt CountryCode()
TInt CurrencyDecimalPlaces()
TBool CurrencyNegativeInBrackets()
TBool CurrencySpaceBetween()
TLocalePos CurrencySymbolPosition()
TBool CurrencyTriadsAllowed()
TDateFormat DateFormat()
TChar DateSeparator(TInt)
TUint DaylightSaving()
TChar DecimalSeparator()
TDeviceTimeState DeviceTime()
TDigitType DigitType()
IMPORT_C voidFormatCurrency(TDes &, TInt)
IMPORT_C voidFormatCurrency(TDes &, TInt64)
IMPORT_C voidFormatCurrency(TDes &, TDesOverflow &, TInt)
IMPORT_C voidFormatCurrency(TDes &, TDesOverflow &, TInt64)
TDaylightSavingZone HomeDaylightSavingZone()
TLanguage LanguageDowngrade(TInt)
TNegativeCurrencyFormat NegativeCurrencyFormat()
TBool NegativeCurrencySymbolOpposite()
TBool NegativeLoseSpace()
TBool QueryHomeHasDaylightSavingOn()
IMPORT_C voidRefresh()
TInt RegionCode()
IMPORT_C TIntSet()
voidSetAmPmSpaceBetween(TBool)
voidSetAmPmSymbolPosition(TLocalePos)
voidSetClockFormat(TClockFormat)
voidSetCountryCode(TInt)
voidSetCurrencyDecimalPlaces(TInt)
voidSetCurrencyNegativeInBrackets(TBool)
voidSetCurrencySpaceBetween(TBool)
voidSetCurrencySymbolPosition(TLocalePos)
voidSetCurrencyTriadsAllowed(TBool)
voidSetDateFormat(TDateFormat)
voidSetDateSeparator(const TChar &, TInt)
voidSetDecimalSeparator(const TChar &)
voidSetDefaults()
voidSetDeviceTime(TDeviceTimeState)
voidSetDigitType(TDigitType)
voidSetLanguageDowngrade(TInt, TLanguage)
voidSetNegativeCurrencyFormat(TNegativeCurrencyFormat)
voidSetNegativeCurrencySymbolOpposite(TBool)
voidSetNegativeLoseSpace(TBool)
voidSetStartOfWeek(TDay)
voidSetThousandsSeparator(const TChar &)
voidSetTimeFormat(TTimeFormat)
voidSetTimeSeparator(const TChar &, TInt)
voidSetUnitsDistanceLong(TUnitsFormat)
voidSetUnitsDistanceShort(TUnitsFormat)
voidSetUnitsGeneral(TUnitsFormat)
voidSetWorkDays(TUint)
TDay StartOfWeek()
TChar ThousandsSeparator()
TTimeFormat TimeFormat()
TChar TimeSeparator(TInt)
TUnitsFormat UnitsDistanceLong()
TUnitsFormat UnitsDistanceShort()
TUnitsFormat UnitsGeneral()
TTimeIntervalSeconds UniversalTimeOffset()
TUint WorkDays()

Detailed Description

Sets and gets the system's locale settings.

Symbian OS maintains the locale information internally. On construction, this object is initialized with the system information for all locale items.

Member Enumeration Documentation

Enum anonymous

Flags for negative currency values formatting

EnumeratorValueDescription
EFlagNegativeLoseSpace0x00000001

If this flag is set and the currency value being formatted is negative, if there is a space between the currency symbol and the value, that space is lost.

EFlagNegativeCurrencySymbolOpposite0x00000002

If this flag is set and the currency value being formatted is negative, the position of the currency symbol is placed in the opposite direction from the position set for the positive currency value.

Enum TDeviceTimeState

Indicates how the device universal time is maintained

EnumeratorValueDescription
EDeviceUserTime

Universal time is maintained by the device RTC and the user selection of the locale of the device indicating offset from GMT and daylight saving

ENITZNetworkTimeSync

Universal time and offset from GMT is supplied by the mobile network and maintained by device RTC

Enum TNegativeCurrencyFormat

Indicates how negative currency values are formatted.

EnumeratorValueDescription
ELeadingMinusSign

A minus sign is inserted before the currency symbol and value.

EInBrackets

The currency value and symbol are enclosed in brackets (no minus sign is used).

ETrailingMinusSign

A minus sign is inserted after the currency symbol and value.

EInterveningMinusSign

A minus sign is inserted between the currency symbol and the value.

Constructor & Destructor Documentation

TLocale ( )

IMPORT_CTLocale()

TLocale ( TInt )

TLocale(TInt)[inline]

Member Function Documentation

AmPmSpaceBetween ( )

TBool AmPmSpaceBetween()const [inline]

Tests whether or not a space is inserted between the time and the preceding or trailing am/pm text.

Returns: True if a space is inserted between the time and am/pm text; false if not.

AmPmSymbolPosition ( )

TLocalePos AmPmSymbolPosition()const [inline]

Gets the am/pm text position (before or after the time value).

Returns: The am/pm text position (0 before, 1 after).

ClockFormat ( )

TClockFormat ClockFormat()const [inline]

Gets the clock display format.

Returns: The clock display format.

CountryCode ( )

TInt CountryCode()const [inline]

Gets the code which is used to select country-specific locale data.

The country code is the code used as the international dialling prefix. This code is also used to identify a country by the dialling software.

Returns: The country code.

CurrencyDecimalPlaces ( )

TInt CurrencyDecimalPlaces()const [inline]

Gets the number of decimal places to which currency values are set.

Returns: The number of decimal places.

CurrencyNegativeInBrackets ( )

TBool CurrencyNegativeInBrackets()const [inline]

Deprecated

Gets whether negative currency values are enclosed in brackets rather than being preceded by a minus sign.

This is deprecated, use NegativeCurrencyFormat() instead.

See also: TLocale::NegativeCurrencyFormat

Returns: True if negative currency is enclosed in brackets and has no minus sign; false if negative currency has a minus sign and is not enclosed in brackets.

CurrencySpaceBetween ( )

TBool CurrencySpaceBetween()const [inline]

Gets whether or not a space is inserted between the currency symbol and the currency value.

For negative currency values, the space can be removed using SetNegativeLoseSpace().

See also: TLocale::SetNegativeLoseSpace

Returns: True if a space is inserted; false if not.

CurrencySymbolPosition ( )

TLocalePos CurrencySymbolPosition()const [inline]

Gets the currency symbol position.

For negative currency values, this position may be reversed using SetNegativeCurrencySymbolOpposite().

See also: TLocale::SetNegativeCurrencySymbolOpposite

Returns: The currency symbol position.

CurrencyTriadsAllowed ( )

TBool CurrencyTriadsAllowed()const [inline]

Gets whether triads are allowed in currency values. Triads are groups of three digits separated by the thousands separator.

Returns: True if triads are allowed; false if not.

DateFormat ( )

TDateFormat DateFormat()const [inline]

Gets the date format.

Returns: The date format.

DateSeparator ( TInt )

TChar DateSeparator(TIntaIndex)const [inline]

Gets one of the four characters used to separate the day, month and year components of the date.

If the four separators are represented by S0, S1, S2 and S3 and the three date components are represented by XX, YY and ZZ, then the separators are located: S0 XX S1 YY S2 ZZ S3.

ParameterDescription
aIndexAn index indicating which of the four separators is being accessed. This must be a value between zero and three inclusive.

Returns: A date separator character as determined by the value of aIndex.

DaylightSaving ( )

TUint DaylightSaving()const [inline]

Gets the zones in which daylight saving is in effect.

If daylight saving is in effect, one hour is added to the time.

Use TLocale::QueryHomeHasDaylightSavingOn() to find out whether daylight saving is in effect for the home city. This is because the daylight saving setting for the home city may differ from that of the zone in which home is located.

See also: TLocale::QueryHomeHasDaylightSavingOn TDaylightSavingZone

Deprecated

Use the timezone server to retrieve information on timezones and DST. This method will always indicate that DST is inactive, in order to preserve compatibility.

Returns: A bit mask in which the three least significant bits are defined, indicating which of the three daylight saving zones are adjusted for daylight saving. These bits represent: Northern (non-European countries in the northern hemisphere), Southern (southern hemisphere), and European.

DecimalSeparator ( )

TChar DecimalSeparator()const [inline]

Gets the character used to separate a whole number from its fractional part.

Returns: The character used as the decimal separator.

DeviceTime ( )

TDeviceTimeState DeviceTime()const [inline]

Gets the device time state.

DeprecatedUse the timezone server to coordinate automatic time adjustment.

Returns: The device time state.

DigitType ( )

TDigitType DigitType()const [inline]

Gets the number mode stored in the locale.

Returns: The number mode for the locale.

FormatCurrency ( TDes &, TInt )

IMPORT_C voidFormatCurrency(TDes &aText,
TIntaAmount
)

FormatCurrency ( TDes &, TInt64 )

IMPORT_C voidFormatCurrency(TDes &aText,
TInt64aAmount
)

FormatCurrency ( TDes &, TDesOverflow &, TInt )

IMPORT_C voidFormatCurrency(TDes &aText,
TDesOverflow &aOverflowHandler,
TIntaAmount
)

FormatCurrency ( TDes &, TDesOverflow &, TInt64 )

IMPORT_C voidFormatCurrency(TDes &aText,
TDesOverflow &aOverflowHandler,
TInt64aAmount
)

HomeDaylightSavingZone ( )

TDaylightSavingZone HomeDaylightSavingZone()const [inline]

Gets the daylight saving zone in which the home city is located.

DeprecatedUse the timezone server to retrieve information on timezones and DST.

Returns: The daylight saving zone in which the home city is located.

LanguageDowngrade ( TInt )

TLanguage LanguageDowngrade(TIntaIndex)const [inline]

Gets the language that is stored at the specified index into the customisable part of the language downgrade path.

The second, third and fourth languages in the language downgrade path can be customised. These can be enquired using this function. The first language in the path is always the language of the current locale, as returned by User::Language().

The languages in the downgrade path are used in turn by the BaflUtils::NearestLanguageFile() function to find the best matching language-specific version of a language-neutral filename.

The full language downgrade path can be retrieved using BaflUtils::GetDowngradePath().

See also: BaflUtils::NearestLanguageFile BaflUtils::GetDowngradePath

ParameterDescription
aIndexAn index into the customisable part of the language downgrade path. Between zero and two inclusive.

Returns: The language at the specified index.

NegativeCurrencyFormat ( )

TNegativeCurrencyFormat NegativeCurrencyFormat()const [inline]

Gets the negative currency format.

Returns: How negative currency values are formatted.

NegativeCurrencySymbolOpposite ( )

TBool NegativeCurrencySymbolOpposite()const [inline]

Gets whether in negative currency values, the position of the currency symbol is set to be the opposite of the position used for non-negative values (before or after the value, as set by SetCurrencySymbolPosition()).

See also: TLocale::SetCurrencySymbolPosition

Returns: True, if the currency symbol position for negative currency values is the opposite of the position set by SetCurrencySymbolPosition(); false, otherwise.

NegativeLoseSpace ( )

TBool NegativeLoseSpace()const [inline]

Gets whether negative currency values lose the space between the currency symbol and the value.

Returns: True, if negative currency values lose the space between the value and the symbol; false, if not.

QueryHomeHasDaylightSavingOn ( )

TBool QueryHomeHasDaylightSavingOn()const [inline]

Tests whether or not daylight saving is set for the home city.

DeprecatedUse the timezone server to retrieve information on timezones and DST. This method will always indicate that DST is inactive, in order to preserve compatibility.

Returns: True if home daylight saving is set; false if not.

Refresh ( )

IMPORT_C voidRefresh()

RegionCode ( )

TInt RegionCode()const [inline]

Set ( )

IMPORT_C TIntSet()const

SetAmPmSpaceBetween ( TBool )

voidSetAmPmSpaceBetween(TBoolaSpace)[inline]

Sets whether a space is inserted between the time and the preceding or trailing am/pm text.

SetAmPmSymbolPosition ( TLocalePos )

voidSetAmPmSymbolPosition(TLocalePosaPos)[inline]

Sets the am/pm text position (before or after the time value).

SetClockFormat ( TClockFormat )

voidSetClockFormat(TClockFormataFormat)[inline]

Sets the clock display format.

ParameterDescription
aFormatThe clock display format.

SetCountryCode ( TInt )

voidSetCountryCode(TIntaCode)[inline]

Sets the value which is used to select country-specific locale data.

This value can be retrieved by using TLocale::CountryCode(). The country code is the code used as the international dialling prefix. This code is also used to identify a country by the dialling software.

See also: TLocale::CountryCode

ParameterDescription
aCodeThe country code.

SetCurrencyDecimalPlaces ( TInt )

voidSetCurrencyDecimalPlaces(TIntaPlaces)[inline]

Sets the number of decimal places to which currency values should be set.

ParameterDescription
aPlacesThe number of decimal places.

SetCurrencyNegativeInBrackets ( TBool )

voidSetCurrencyNegativeInBrackets(TBoolaBool)[inline]

Deprecated

Sets whether negative currency values are enclosed in brackets rather than being preceded by a minus sign.

This is deprecated, use SetNegativeCurrencyFormat() instead.

See also: TLocale::SetNegativeCurrencyFormat

ParameterDescription
aBoolETrue, if a negative currency value must be enclosed in brackets without a minus sign; EFalse, if a negative currency value is preceded by a minus sign without any enclosing brackets.

SetCurrencySpaceBetween ( TBool )

voidSetCurrencySpaceBetween(TBoolaSpace)[inline]

Sets whether a space is inserted between the currency symbol and the currency amount.

ParameterDescription
aSpaceETrue if a space is inserted; EFalse if not.

SetCurrencySymbolPosition ( TLocalePos )

voidSetCurrencySymbolPosition(TLocalePosaPos)[inline]

Sets the currency symbol position.

ParameterDescription
aPosThe currency symbol position.

SetCurrencyTriadsAllowed ( TBool )

voidSetCurrencyTriadsAllowed(TBoolaBool)[inline]

Sets whether triads are allowed in currency values.

ParameterDescription
aBoolETrue if triads are allowed; EFalse if triads not allowed.

SetDateFormat ( TDateFormat )

voidSetDateFormat(TDateFormataFormat)[inline]

Sets the date format.

ParameterDescription
aFormatThe date format to be used.

SetDateSeparator ( const TChar &, TInt )

voidSetDateSeparator(const TChar &aChar,
TIntaIndex
)[inline]

Sets one of the four characters used to separate the day, month and year components of the date.

If the four separators are represented by S0, S1, S2 and S3 and the three date components are represented by XX, YY and ZZ, then the separators are located: S0 XX S1 YY S2 ZZ S3.

ParameterDescription
aCharA date separator character to be used.
aIndexAn index indicating which of the four separators is being accessed. This must be a value between zero and three inclusive.

SetDecimalSeparator ( const TChar & )

voidSetDecimalSeparator(const TChar &aChar)[inline]

Sets the character to be used to separate a whole number from its fractional part.

ParameterDescription
aCharThe character to be used as the decimal separator.

SetDefaults ( )

voidSetDefaults()

SetDeviceTime ( TDeviceTimeState )

voidSetDeviceTime(TDeviceTimeStateaState)[inline]

Sets the device time state.

DeprecatedUse the timezone server to coordinate automatic time adjustment.

ParameterDescription
aStateThe device time state.

SetDigitType ( TDigitType )

voidSetDigitType(TDigitTypeaDigitType)[inline]

Sets the number mode for the locale.

ParameterDescription
aDigitTypeThe number mode to be set.

SetLanguageDowngrade ( TInt, TLanguage )

voidSetLanguageDowngrade(TIntaIndex,
TLanguageaLanguage
)[inline]

Sets a language in the customisable part of the language downgrade path.

See also: BaflUtils::NearestLanguageFile BaflUtils::GetDowngradePath

ParameterDescription
aIndexAn index into the customisable part of the path at which to add the language, a value between zero and two.
aLanguageThe language to add. ELangNone is considered to be the last language in the path, no more will be searched, so can be used to specify that no language downgrade is required.

SetNegativeCurrencyFormat ( TNegativeCurrencyFormat )

voidSetNegativeCurrencyFormat(TNegativeCurrencyFormataNegativeCurrencyFormat)[inline]

Sets the negative currency format.

ParameterDescription
aNegativeCurrencyFormatHow negative currency values are formatted.

SetNegativeCurrencySymbolOpposite ( TBool )

voidSetNegativeCurrencySymbolOpposite(TBoolaBool)[inline]

Sets whether the position of the currency symbol for negative currency values should be the opposite of the position used for non-negative values (before or after the value, as set by SetCurrencySymbolPosition()).

See also: TLocale::SetCurrencySymbolPosition

ParameterDescription
aBoolETrue to set the position of the currency symbol in negative currency values to be the opposite of the position as set using SetCurrencySymbolPosition(). EFalse to leave the position unchanged.

SetNegativeLoseSpace ( TBool )

voidSetNegativeLoseSpace(TBoolaBool)[inline]

Sets whether negative currency values lose the space between the currency symbol and the value.

ParameterDescription
aBoolETrue to set a flag which indicates that negative currency values should lose the space between the value and the symbol. EFalse to unset it.

SetStartOfWeek ( TDay )

voidSetStartOfWeek(TDayaDay)[inline]

Sets the day which is considered to be the first day of the week.

ParameterDescription
aDayThe first day of the week.

SetThousandsSeparator ( const TChar & )

voidSetThousandsSeparator(const TChar &aChar)[inline]

Sets the character to be used to separate groups of three digits to the left of the decimal separator.

A thousands separator character is only displayed in currency values if currency triads are allowed.

ParameterDescription
aCharThe character to be used as the thousands separator.

SetTimeFormat ( TTimeFormat )

voidSetTimeFormat(TTimeFormataFormat)[inline]

Sets the time format (12 or 24 hour).

ParameterDescription
aFormatThe time format.

SetTimeSeparator ( const TChar &, TInt )

voidSetTimeSeparator(const TChar &aChar,
TIntaIndex
)[inline]

Sets one of the four characters used to separate the hour, minute and second components of the date.

If the four separators are represented by S0, S1, S2 and S3 and the three time components are represented by XX, YY and ZZ, then the separators are located: S0 XX S1 YY S2 ZZ S3.

ParameterDescription
aCharA time separator character to be used.
aIndexAn index indicating which of the four separators is being accessed. This must be a value between zero and three inclusive.

SetUnitsDistanceLong ( TUnitsFormat )

voidSetUnitsDistanceLong(TUnitsFormataFormat)[inline]

Sets the units of measurement for long distances.

Long distances are those which would normally be represented by either miles or kilometres.

ParameterDescription
aFormatUnits of measurement for long distances.

SetUnitsDistanceShort ( TUnitsFormat )

voidSetUnitsDistanceShort(TUnitsFormataFormat)[inline]

Sets the units of measurement for short distances.

Short distances are those which would normally be represented by either metres and centimetres or feet and inches.

ParameterDescription
aFormatUnits of measurement for short distances.

SetUnitsGeneral ( TUnitsFormat )

voidSetUnitsGeneral(TUnitsFormataFormat)[inline]

Sets the general units of measurement. This function should be used when both short and long distances use the same units of measurement.

ParameterDescription
aFormatGeneral units of measurement.

SetWorkDays ( TUint )

voidSetWorkDays(TUintaMask)[inline]

Sets the days of the week which are considered as working days.

ParameterDescription
aMaskA bit mask of seven bits indicating (by being set) which days are workdays. The least significant bit corresponds to Monday, the next bit is Tuesday and so on.

StartOfWeek ( )

TDay StartOfWeek()const [inline]

Gets the day which is considered the first day of the week.

Returns: The first day of the week.

ThousandsSeparator ( )

TChar ThousandsSeparator()const [inline]

Gets the character used to separate groups of three digits to the left of the decimal separator.

A thousands separator character is only displayed in currency values if currency triads are allowed.

Returns: The character used as the thousands separator.

TimeFormat ( )

TTimeFormat TimeFormat()const [inline]

Gets the time format (12 or 24 hour).

Returns: The time format.

TimeSeparator ( TInt )

TChar TimeSeparator(TIntaIndex)const [inline]

Gets one of the four characters used to separate the hour, second and minute components of the time.

If the four separators are represented by S0, S1, S2 and S3 and the three time components are represented by XX, YY and ZZ, then the separators are located: S0 XX S1 YY S2 ZZ S3.

ParameterDescription
aIndexAn index indicating which of the four separators is being accessed. This must be a value between zero and three inclusive.

Returns: A time separator character as determined by the value of aIndex.

UnitsDistanceLong ( )

TUnitsFormat UnitsDistanceLong()const [inline]

Gets the units of measurement for long distances.

Long distances are those which would normally be represented by either miles or kilometres.

Returns: Units of measurement for long distances.

UnitsDistanceShort ( )

TUnitsFormat UnitsDistanceShort()const [inline]

Gets the units of measurement for short distances.

Short distances are those which would normally be represented by either metres and centimetres or feet and inches.

Returns: Units of measurement for short distances.

UnitsGeneral ( )

TUnitsFormat UnitsGeneral()const [inline]

Gets the general units of measurement.

This function should be used when both short and long distances use the same units of measurement.

Returns: General units of measurement.

UniversalTimeOffset ( )

TTimeIntervalSeconds UniversalTimeOffset()const [inline]

Gets the locale's universal time offset.

DeprecatedUse User::UTCOffset to get the current offset inclusive of daylight savings time. This function returns the same value, for compatibility.

Returns: Offset in seconds from universal time. Time zones east of universal time have positive offsets. Time zones west of universal time have negative offsets.

WorkDays ( )

TUint WorkDays()const [inline]

Gets a bit mask representing the days of the week which are considered as working days.

Returns: A bit mask of seven bits indicating (by being set) which days are workdays. The least significant bit corresponds to Monday, the next bit to Tuesday and so on.