TExtendedLocale Class Reference

#include <e32std.h>

class TExtendedLocale
Public Member Functions
TExtendedLocale()
IMPORT_C TPtrCGetCurrencySymbol()
TLocale *GetLocale()
IMPORT_C TIntGetLocaleDllName(TLocaleAspect, TDes &)
IMPORT_C TPtrCGetLongDateFormatSpec()
IMPORT_C TCollationMethodGetPreferredCollationMethod(TInt)
IMPORT_C TPtrCGetShortDateFormatSpec()
IMPORT_C TPtrCGetTimeFormatSpec()
IMPORT_C TIntLoadLocale(const TDesC &)
IMPORT_C TIntLoadLocale(const TDesC &, const TDesC &, const TDesC &)
IMPORT_C TIntLoadLocaleAspect(TUint, const TDesC &)
IMPORT_C TIntLoadLocaleAspect(const TDesC &)
IMPORT_C voidLoadSystemSettings()
IMPORT_C TIntSaveSystemSettings()
IMPORT_C TIntSetCurrencySymbol(const TDesC &)

Detailed Description

Extended locale class

This class holds a collection of locale information. It contains a TLocale internally. It has methods to load a locale DLL and to set the system wide locale information.

Constructor & Destructor Documentation

TExtendedLocale ( )

IMPORT_CTExtendedLocale()

Default constructor.

It constructs an empty object

This is an empty copy of TExtendedLocale. To get the system locale you can use TExtendedLocale::LoadSystemSettings. The current settings may be saved to the system with TLocale::SaveSystemSettings().

See also: TExtendedLocale::LoadSystemSettings TExtendedLocale::SaveSystemSettings

Member Function Documentation

GetCurrencySymbol ( )

IMPORT_C TPtrCGetCurrencySymbol()

Get the Currency Symbol from SLocaleLocaleSettings object

Return Value
TPtrC Pointer holding the Currency Symbol

GetLocale ( )

TLocale *GetLocale()[inline]

Get the pointer to the TLocale object contained in this extended locale.

Return Value
Pointer to the TLocale object.

GetLocaleDllName ( TLocaleAspect, TDes & )

IMPORT_C TIntGetLocaleDllName(TLocaleAspectaLocaleDataSet,
TDes &aDllName
)

Returns the name of the DLL containing the given bits of locale information

Given the bits of locale information specified in aLocaleDataSet, it returns the name of the locale DLL storing the information. TExtendedLocale can contain information from different DLLs.

Parameters
aLocaleDataSetThe TLocaleAspect specifying a group of locale properties
aDllNameThe descriptor that will contain the name of DLL containing the specifying bits of locale information (valid if the method is successful)
Return Value
KErrNone if successful, system wide error otherwise

GetLongDateFormatSpec ( )

IMPORT_C TPtrCGetLongDateFormatSpec()

Get the Long Date Format from SLocaleTimeDateFormat object

Return Value
TPtrC Pointer holding the Long Date Format

GetPreferredCollationMethod ( TInt )

IMPORT_C TCollationMethodGetPreferredCollationMethod(TIntindex = 0)

Get the preferred collation method for the preferred charset.

Note that some charsets may contain more than one collation method (e.g "dictionary" v "phonebook" ordering) so an optional index parameter can be used to select between them.

See also: TCollationMethod

Parameters
indexOptional parameter specifying the index of the collation method in the locale to get. This is the responsibility of the caller to make sure that the index is less than the total number of collation methods in the preferred charset in this locale.
Return Value
TCollationMethod representing the requested collation method.
Panic Codes
USER185 In both debug and release builds, if either the current charset is not set up or aIndex is greater than or equal to the total number of collation methods in the preferred charset in this locale.

GetShortDateFormatSpec ( )

IMPORT_C TPtrCGetShortDateFormatSpec()

Get the Short Date Format from SLocaleTimeDateFormat object

Return Value
TPtrC Pointer holding the Short Date Format

GetTimeFormatSpec ( )

IMPORT_C TPtrCGetTimeFormatSpec()

Get the Time Format from SLocaleTimeDateFormat object

Return Value
TPtrC Pointer holding the Time Format

LoadLocale ( const TDesC & )

IMPORT_C TIntLoadLocale(const TDesC &aLocaleDllName)

Loads a locale Dll and get the locale information

It loads a locale DLL and it initialises the contents of this TExtendedLocale with the locale information stored in the DLL. The locale information is only stored in this TExtendedLocale. If you want to set the system wide settings with the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings after calling this function.

See also: TExtendedLocale::SaveSystemSettings

Parameters
aLocaleDllNameThe name of the locale DLL to be loaded
Return Value
KErrNone if successful, KErrNotSupported if the DLL name matches the pattern of a new-style locale library, system wide error otherwise

LoadLocale ( const TDesC &, const TDesC &, const TDesC & )

IMPORT_C TIntLoadLocale(const TDesC &aLanguageLocaleDllName,
const TDesC &aRegionLocaleDllName,
const TDesC &aCollationLocaleDllName
)

Loads locale data from three locale dlls, which are language, region, and collation locale dlls

It loads three locale DLLs and it initialises the contents of this TExtendedLocale with the locale information stored in the DLLs. The locale information is only stored in this TExtendedLocale. If you want to set the system wide settings with the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings after calling this function.

If the function fails then it will call LoadSystemSettings() to return its members to a known, good state.

See also: TExtendedLocale::SaveSystemSettings

Parameters
aLanguageLocaleDllNameThe name of the language locale DLL to be loaded
aRegionLocaleDllNameThe name of the region locale DLL to be loaded
aCollationLocaleDllNameThe name of the collation locale DLL to be loaded
Return Value
KErrNone if successful, system wide error if not

LoadLocaleAspect ( TUint, const TDesC & )

IMPORT_C TIntLoadLocaleAspect(TUintaAspectGroup,
const TDesC &aLocaleDllName
)

Loads a DLL and get some locale information

It loads the specified locale DLL and depending on the aAspectGroup it overwrites locale information in this TExtendedLocale with the locale information stored in the DLL. aAspectGroup is a bitmap of TLocaleAspect values specifying what to be overwritten. The locale information is only stored in this TExtendedLocale. If you want to set the system wide settings with the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings after calling this function.

See also: TLocaleAspect TExtendedLocale::SaveSystemSettings

Parameters
aAspectGroupA bitmap of TLocaleAspect values specifying what to be overwritten in this TExtendedLocale. (eg.: ELocaleLanguageSettings | ELocaleTimeDateSettings)
aLocaleDllNameThe name of the locale DLL to be loaded
Return Value
KErrNone if the method is successful, a system wide error code if not

LoadLocaleAspect ( const TDesC & )

IMPORT_C TIntLoadLocaleAspect(const TDesC &aLocaleDllName)

Loads a DLL and get some locale information

It loads the specified locale DLL, and it overwrites locale information in this TExtendedLocale with the locale information stored in the DLL. The locale information is only stored in this TExtendedLocale. If you want to set the system wide settings with the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings after calling this function.

See also: TExtendedLocale::SaveSystemSettings

Parameters
aLocaleDllNameThe name of the locale DLL to be loaded
Return Value
KErrNone if the method is successful, a system wide error code if not

LoadSystemSettings ( )

IMPORT_C voidLoadSystemSettings()

Load system wide locale settings

It initialises this TExtendedLocale with the system wide locale settings. The settings stored in the TExtendedLocale are overwritten with the system wide locale.

See also: TExtendedLocale::SaveSystemSettings

SaveSystemSettings ( )

IMPORT_C TIntSaveSystemSettings()

Make the current locale information system wide

It overwrites the system wide locale information with the locale information stored in this TExtendedLocale. This will generate a notification for system locale changes. In case of an error, the locale might be in an unconsistent state.

Return Value
KErrNone if successful, otherwise one of the other system wide error codes.
Capability
WriteDeviceData

SetCurrencySymbol ( const TDesC & )

IMPORT_C TIntSetCurrencySymbol(const TDesC &aSymbol)

Sets the currency symbol

It sets the currency symbol. The maximum lenght for the currency symbol is KMaxCurrencySymbol. Trying to pass a descriptor longer than that, will result in a panic.

Parameters
aSymbolThe new currency symbol
Return Value
KErrNone if successful, otherwise one of the other system wide error codes.
Panic Codes
USER119, if the length of aSymbol is greater than KMaxCurrencySymbol.
Capability
WriteDeviceData