Location:
e32std.h
Link against: euser.lib
TLocale
Supported from 5.0
Sets and gets the system’s locale settings.
The operating system maintains the locale information internally. On construction, this object is initialized with the system information for all locale items.
Defined in TLocale
:
AmPmSpaceBetween()
, AmPmSymbolPosition()
, ClockFormat()
, CountryCode()
, CurrencyDecimalPlaces()
, CurrencyNegativeInBrackets()
, CurrencySpaceBetween()
, CurrencySymbolPosition()
, CurrencyTriadsAllowed()
, DateFormat()
, DateSeparator()
, DaylightSaving()
, DecimalSeparator()
, EInBrackets
, EInterveningMinusSign
, ELeadingMinusSign
, ETrailingMinusSign
, FormatCurrency()
, HomeDaylightSavingZone()
, NegativeCurrencyFormat()
, NegativeCurrencySymbolOpposite()
, NegativeLoseSpace()
, QueryHomeHasDaylightSavingOn()
, Refresh()
, Set()
, SetAmPmSpaceBetween()
, SetAmPmSymbolPosition()
, SetClockFormat()
, SetCountryCode()
, SetCurrencyDecimalPlaces()
, SetCurrencyNegativeInBrackets()
, SetCurrencySpaceBetween()
, SetCurrencySymbolPosition()
, SetCurrencyTriadsAllowed()
, SetDateFormat()
, SetDateSeparator()
, SetDaylightSaving()
, SetDecimalSeparator()
, SetHomeDaylightSavingZone()
, SetNegativeCurrencyFormat()
, SetNegativeCurrencySymbolOpposite()
, SetNegativeLoseSpace()
, SetStartOfWeek()
, SetThousandsSeparator()
, SetTimeFormat()
, SetTimeSeparator()
, SetUnitsDistanceLong()
, SetUnitsDistanceShort()
, SetUnitsGeneral()
, SetUniversalTimeOffset()
, SetWorkDays()
, StartOfWeek()
, TLocale()
, TNegativeCurrencyFormat
, ThousandsSeparator()
, TimeFormat()
, TimeSeparator()
, UnitsDistanceLong()
, UnitsDistanceShort()
, UnitsGeneral()
, UniversalTimeOffset()
, WorkDays()
TLocale();
Constructs this object with settings which are taken from the system's locale settings.
Note that a single copy of the locale information is
maintained by the system. When an application constructs a this object, it
contains a copy of the system information. This copy may be refreshed under
application control with TLocale::Refresh()
, and the settings may
be saved to the system with TLocale::Set()
. However, the settings
are never updated by the system apart from under application control. This
enables applications to guarantee that consistent locale information is
used.
void Set() const;
Transfers the locale settings from this object to the system.
After this function has been called, other applications may
use the new settings for newly-constructed TLocale
objects, or if
they use TLocale::Refresh()
, to refresh their settings from the
system copy.
TInt CountryCode() const;
Returns 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.
|
void SetCountryCode(TInt aCode);
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.
|
TLocalePos CurrencySymbolPosition() const;
Returns the currency symbol position. The currency symbol can be located before or after the currency value.
Note:
For negative currency values, this position may be reversed
using SetNegativeCurrencySymbolOpposite()
.
|
void SetCurrencySymbolPosition(TLocalePos aPos);
Sets the currency symbol position. The currency symbol can be located either before or after the currency value.
|
TBool CurrencySpaceBetween() const;
Returns whether or not a space is inserted between the currency symbol and the currency value.
Note:
For negative currency values, the space can be removed using
SetNegativeLoseSpace()
.
|
void SetCurrencySpaceBetween(TBool aSpace);
Sets whether a space must be inserted between the currency symbol and the currency amount.
|
TInt CurrencyDecimalPlaces() const;
Returns the number of decimal places to which currency values are set.
|
void SetCurrencyDecimalPlaces(TInt aPlaces);
Sets the number of decimal places to which currency values should be set.
|
TBool CurrencyNegativeInBrackets() const;
Withdrawn in 6.1
Returns whether negative currency values are enclosed in brackets rather than being preceded by a minus sign.
Note:
From v6.1 onwards, use NegativeCurrencyFormat()
instead.
|
void SetCurrencyNegativeInBrackets(TBool aBool);
Withdrawn in 6.1
Sets whether negative currency values are enclosed in brackets rather than being preceded by a minus sign.
Note:
From v6.1 onwards, use
SetNegativeCurrencyFormat()
instead.
|
TBool CurrencyTriadsAllowed() const;
Returns whether triads are allowed in currency values. Triads are groups of three digits separated by the thousands separator.
|
void SetCurrencyTriadsAllowed(TBool aBool);
Sets whether triads are allowed in currency values.
|
void FormatCurrency(TDes& aText, TInt aAmount);
Supported from 6.1
Renders a currency value as text, based on the locale's currency and numeric format settings.
These settings include the currency
symbol, the symbol's position and the way negative values are formatted. If the
descriptor aText
is not long enough to hold the formatted value, a
panic (USER 11) occurs.
|
void FormatCurrency(TDes& aText, TInt64 aAmount);
Supported from 6.1
Renders a currency value as text, based on the locale's currency and numeric format settings.
These settings include the currency
symbol, the symbol's position and the way negative values are formatted. If the
descriptor aText
is not long enough to hold the formatted value, a
panic (USER 11) occurs. This function is provided for very
large currency values.
|
void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt aAmount);
Supported from 6.1
Renders a currency value as text, based on the locale's currency and numeric format settings.
These settings include the currency
symbol, the symbol's position and the way negative values are formatted. If
aText
is not long enough to hold the formatted currency value, the
overflow handler's Overflow()
function is
called.
|
void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt64 aAmount);
Supported from 6.1
Renders a currency value as text, based on the locale's currency and numeric format settings.
These settings include the currency
symbol, the symbol's position and the way negative values are formatted. If
aText
is not long enough to hold the formatted currency value, the
overflow handler's Overflow()
function is called. This function is
provided for very large currency values.
|
TNegativeCurrencyFormat NegativeCurrencyFormat() const;
Supported from 6.1
Gets the negative currency format.
|
void SetNegativeCurrencyFormat(TNegativeCurrencyFormat aNegativeCurrencyFormat);
Supported from 6.1
Sets the negative currency format.
|
TBool NegativeLoseSpace()
Supported from 6.1
Returns whether negative currency values lose the space between the currency symbol and the value.
|
void SetNegativeLoseSpace(TBool aBool);
Supported from 6.1
Sets whether negative currency values lose the space between the currency symbol and the value.
|
TBool NegativeCurrencySymbolOpposite() const;
Supported from 6.1
Returns 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()
).
|
void SetNegativeCurrencySymbolOpposite(TBool aBool);
Supported from 6.1
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()
).
|
TChar ThousandsSeparator() const;
Returns the character used to separate groups of three digits to the left of the decimal separator.
Notes:
A thousands separator character is only displayed in currency values if currency triads are allowed.
|
void SetThousandsSeparator(const TChar& aChar);
Sets the character to be used to separate groups of three digits to the left of the decimal separator.
Notes
A thousands separator character is only displayed in currency values if currency triads are allowed.
|
TChar DecimalSeparator() const;
Returns the character used to separate a whole number from its fractional part.
|
void SetDecimalSeparator(const TChar& aChar);
Sets the character to be used to separate a whole number from its fractional part.
|
TChar DateSeparator(TInt aIndex) const;
Returns 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.
|
|
void SetDateSeparator(const TChar& aChar,TInt aIndex);
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.
|
TDateFormat DateFormat() const;
Returns the date format.
|
void SetDateFormat(TDateFormat aFormat);
Sets the date format.
|
TTimeFormat TimeFormat() const;
Returns the time format. This indicates whether the 12 or 24 hour clock format is used.
|
void SetTimeFormat(TTimeFormat aFormat);
Sets the time format. This indicates whether the 12 or 24 hour clock format is to be used.
|
TChar TimeSeparator(TInt aIndex) const;
Returns 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.
|
|
void SetTimeSeparator(const TChar& aChar,TInt aIndex);
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.
|
TBool AmPmSpaceBetween() const;
Determines whether or not a space is inserted between the time and preceding or trailing am/pm text.
|
void SetAmPmSpaceBetween(TBool aSpace);
Sets whether a space must be inserted between the time and preceding or trailing am/pm text.
|
TLocalePos AmPmSymbolPosition() const;
Returns the am/pm text position. The am/pm text is located before or after the time value.
|
void SetAmPmSymbolPosition(TLocalePos aPos);
Sets the am/pm text position. The am/pm text can be located either before or after the time value.
|
TClockFormat ClockFormat() const;
Returns the clock display format.
|
void SetClockFormat(TClockFormat aFormat);
Sets the clock display format.
|
TUint WorkDays() const;
Returns a bit mask representing the days of the week which are considered as working days.
|
void SetWorkDays(TUint aMask);
Sets the days of the week which are considered as working days.
|
TDay StartOfWeek() const;
Returns the day which is considered the first day of the week.
|
void SetStartOfWeek(TDay aDay);
Sets the day which is considered to be the first day of the week.
|
TTimeIntervalSeconds UniversalTimeOffset() const;
Returns the locale’s universal time offset.
|
void SetUniversalTimeOffset(const TTimeIntervalSeconds& anOffset);
Sets the locale’s universal time offset.
|
TUint DaylightSaving() const;
Returns the daylight saving zones in which daylight saving is in effect. The function returns a bit mask in which the three least significant bits are defined. These bits represent Northern (non-European countries in the northern hemisphere), Southern (southern hemisphere), and European.
Notes
If daylight saving is in effect, one hour is added to the time.
Use TLocale::QueryHomeHasDaylightSavingOn()
rather than this function to get 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.
|
void SetDaylightSaving(TUint aDaylightSaving);
Sets the daylight saving zones in which daylight saving is in effect. The function uses a bit mask in which the three least significant bits are defined plus a fourth bit for home. These bits represent European, Northern (non-European countries in the northern hemisphere) and Southern (southern hemisphere).
Notes
The daylight saving setting for the home city normally corresponds to the setting for the zone in which home is located. However they may differ.
Assuming home is located in Europe,
to set home and unset Europe, use
TLocale::SetDaylightSaving(EDstHome)
. In this case, the home bit
overrides the Europe bit.
to unset home and set Europe, home must be removed from
the Europe daylight saving zone. First set both home and Europe by using
TLocale::SetDaylightSaving(EDstEurope)
. Then, remove home from
Europe by using TLocale::SetHomeDaylightSavingZone(EDstNone)
. Home
daylight saving is now unset while Europe remains set.
|
TBool QueryHomeHasDaylightSavingOn() const;
Determines whether or not daylight saving is set for the home city.
|
TDaylightSavingZone HomeDaylightSavingZone() const;
Returns the daylight saving zone in which the home city is located.
|
void SetHomeDaylightSavingZone(TDaylightSavingZone aZone);
Sets the daylight saving zone in which the home city is located.
|
TUnitsFormat UnitsGeneral() const;
Returns the general units of measurement. This function should be used when both short and long distances use the same units of measurement.
|
void SetUnitsGeneral(TUnitsFormat aFormat);
Sets the general units of measurement. This function should be used when both short and long distances use the same units of measurement.
|
TUnitsFormat UnitsDistanceShort() const;
Returns the units of measurement for short distances. Short distances are those which would normally be represented by either meters and centimetres or feet and inches.
|
void SetUnitsDistanceShort(TUnitsFormat aFormat);
Sets the units of measurement for short distances. Short distances are those which would normally be represented by either meters and centimetres or feet and inches.
|
TUnitsFormat UnitsDistanceLong() const;
Returns the units of measurement for long distances. Long distances are those which would normally be represented by either miles or kilometres.
|
void SetUnitsDistanceLong(TUnitsFormat aFormat);
Sets the units of measurement for long distances. Long distances are those which would normally be represented by either miles or kilometres.
|
TNegativeCurrencyFormat
Supported from 6.1
Indicates how negative currency values are formatted.
|