Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to set the locale

Use TLocale::Set() to set the system-wide locale settings.

All applications subsequently using locale information will honour these settings. Note that most applications do not need to change the locale settings, they merely honour them. In this case, Refresh() should be used to refresh the contents of a TLocale object with the system's locale settings.

To change the system locale and some of its locale-dependent date and time settings, implement code as follows:

...
    // Get current system locale information
TLocale locale;
    // Change date separators 1 and 2 to hyphens; date separators 0 and 3
    // remain null characters
locale.SetDateSeparator('-',1);
locale.SetDateSeparator('-',2);

    // set the locale to Southern hemisphere with
    // a +10 hour time offset
locale.SetUniversalTimeOffset(36000);
locale.SetHomeDaylightSavingZone(EDstSouthern);

    // Set daylight saving on for the southern hemisphere
locale.SetDaylightSaving(EDstSouthern);

    // set system locale settings
locale.Set();
....