First public contribution.
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\kernel\localise.h
16 // WARNING: This file contains some APIs which are internal and are subject
17 // to change without notice. Such APIs should therefore not be used
18 // outside the Kernel and Hardware Services package.
35 #define TLocaleText TText16
37 #define TLocaleText TText8
41 It is a container for functions to convert from a 8-bit string to a 16-bit(UNICODE) string and vice-versa, and to check
42 whether a character is a legal short character or not.
43 It declares pointers to functions that accomplishes the above tasks.
45 The functions are to be implemented by the locale-DLLs.
47 struct TFatUtilityFunctions // functions to be implemented by locale-DLLs
50 Specifies the action to be taken if an overflow occurs. It can either Leave or Truncate the overflow part.
55 Will leave if an overflow occurs.
59 Will truncate the data if an overflow occurs.
61 EOverflowActionTruncate
64 Function to convert a string from unicode(16-bit)format to a (8-bit) format.
66 @param aForeign 8-bit descriptor that will contain the converted string.
67 @param aUnicode 16-bit descriptor which contains the string to be converted.
68 @param aReplacementForUnconvertibleUnicodeCharacters Any default 8-bit character that will replace any non convertible 16-bit unicode character.
69 @param aOverFlowAction Enum value specifying action to be taken in case of overflow.
73 typedef void (*TConvertFromUnicodeL)(TDes8& aForeign, const TDesC16& aUnicode, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TOverflowAction aOverflowAction);
76 Function to convert a string from (8-bit) format to unicode(16-bit)format.
78 @param aUnicode 16-bit descriptor which will contain the converted string.
79 @param aForeign 8-bit descriptor which contains the string to be converted.
80 @param aOverFlowAction Enum value specifying action to be taken in case of overflow.
84 typedef void (*TConvertToUnicodeL)(TDes16& aUnicode, const TDesC8& aForeign, TOverflowAction aOverflowAction);
87 Function to check whether a character is a legal short name character or not.
89 @param aCharacter The character to apply the check on.
91 @return TBool True If it is a legal short name character
94 typedef TBool (*TIsLegalShortNameCharacter)(TUint aCharacter);
97 A pointer to a function TConvertFromUnicodeL. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
99 @see TConvertFromUnicodeL.
101 TConvertFromUnicodeL iConvertFromUnicodeL;
104 A pointer to a function TConvertToUnicodeL. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
106 @see TConvertToUnicodeL.
108 TConvertToUnicodeL iConvertToUnicodeL;
111 A pointer to a function TIsLegalShortNameCharacter. This is one of the pointers returned when Locl::FatUtilityFunctions is called.
113 @see TIsLegalShortNameCharacter.
115 TIsLegalShortNameCharacter iIsLegalShortNameCharacter;
119 A data structure containing the system's locale settings.
120 The data must be identical to that in TLocale.
125 Integer value specifying country code.
126 The country code is the code used as the international dialling prefix.
127 This code is also used to identify a country by the dialling software.
132 The locale's universal time offset. Offset in seconds from universal time.
133 Time zones east of universal time have positive offsets.
134 Time zones west of universal time have negative offsets.
136 TInt iUniversalTimeOffset;
139 The date format of the Locale. It can be either of the three formats American,European or Japanese.
141 TDateFormat iDateFormat;
144 The time formats as either 12 hour or 24 hour.
146 TTimeFormat iTimeFormat;
149 The currency symbol is located before or after the currency amount.
151 TLocalePos iCurrencySymbolPosition;
154 Whether or not a space is inserted between the currency symbol and the currency value.
155 True if a space exists, False otherwise.
157 TBool iCurrencySpaceBetween;
159 /** The number of decimal places to which currency values are set.*/
160 TInt iCurrencyDecimalPlaces;
163 Indicates how negative currency values are formatted.
165 TNegativeCurrencyFormat iNegativeCurrencyFormat;
168 Sets whether triads are allowed in currency values.
169 True if Triads are allowed, False otherwise.
171 TBool iCurrencyTriadsAllowed;
174 The character to be used to separate groups of three digits to the left of the decimal separator.
175 A thousands separator character is only displayed in currency values if currency triads are allowed.
177 TChar iThousandsSeparator;
180 The character used to separate a whole number from its fractional part.
182 TChar iDecimalSeparator;
185 An array containing the four characters used to separate the day, month and year components of the date.
186 If the four separators are represented by S0, S1, S2 and S3
187 and the three date components are represented by XX, YY and ZZ,
188 then the separators are located: S0 XX S1 YY S2 ZZ S3.
190 TChar iDateSeparator[KMaxDateSeparators];
193 An array containing the four characters used to separate the hour, second and minute components of the time.
194 If the four separators are represented by S0, S1, S2 and S3
195 and the three time components are represented by XX, YY and ZZ,
196 then the separators are located: S0 XX S1 YY S2 ZZ S3.
198 TChar iTimeSeparator[KMaxTimeSeparators];
201 Defines whether the am/pm text is located before or after the time.
203 TLocalePos iAmPmSymbolPosition;
206 Whether or not a space is inserted between the time and the preceding or trailing am/pm text.
207 True if a space exists, False otherwise.
209 TBool iAmPmSpaceBetween;
212 The zones in which daylight saving is in effect.
214 If daylight saving is in effect, one hour is added to the time.
216 A bit mask in which the three least significant bits are defined,
217 indicating which of the three daylight saving zones are adjusted for daylight saving.
218 These bits represent: Northern (non-European countries in the northern hemisphere),
219 Southern (southern hemisphere),
220 and European. see TDaylightSavingZone.
222 @see TDaylightSavingZone.
224 TUint iDaylightSaving;
227 The daylight saving zone in which the home city is located.
229 TDaylightSavingZone iHomeDaylightSavingZone;
232 A bit mask representing the days of the week which are considered as working days.
234 A bit mask of seven bits indicating (by being set) which days are workdays.
235 The least significant bit corresponds to Monday, the next bit to Tuesday and so on.
240 The day which is considered to be the first day of the week.
242 The enumerator symbol names correspond with the days of the week, i.e. EMonday refers to Monday etc.
247 The clock display format as either analog or digital.
249 TClockFormat iClockFormat;
253 The general units of measurement.
255 This should be used when both short and long distances use the same units of measurement.
257 TUnitsFormat iUnitsGeneral;
260 The units of measurement for short distances.
262 Short distances are those which would normally be represented by either metres and centimetres or feet and inches.
264 TUnitsFormat iUnitsDistanceShort;
267 The units of measurement for long distances.
269 Long distances are those which would normally be represented by either miles or kilometres.
271 TUnitsFormat iUnitsDistanceLong;
274 Flags for negative currency values formatting.
276 EFlagNegativeLoseSpace If this flag is set and the currency value being formatted is negative,
277 if there is a space between the currency symbol and the value, that space is lost.
279 EFlagNegativeCurrencySymbolOpposite If this flag is set and the currency value being formatted is negative,
280 the position of the currency symbol is placed in the opposite direction
281 from the position set for the positive currency value.
283 TUint iExtraNegativeCurrencyFormatFlags;
287 An array which contains customisable part of the language downgrade path.
289 TUint16 iLanguageDowngrade[3];
294 The number mode stored in the locale.
296 TDigitType iDigitType;
299 The device time state.
301 TDeviceTimeState iDeviceTimeState;
307 An interface defined to provide support for localisation for components
308 that are too low-level to participate in the normal EPOC localisation
315 Returns the Language type.
317 @return The value corresponding to a particular language as specified in TLanguage.
319 IMPORT_C static TLanguage Language();
322 Returns whether it is a Unicode Build or not.
324 @return True If it is a Unicode Build.
325 @return False Otherwise.
327 IMPORT_C static TBool UniCode();
330 Create the Localisation Table.
332 @param aLocale a pointer to a structure of type SLocaleData.
334 IMPORT_C static void LocaleData(SLocaleData *aLocale);
337 Returns the address of the Currency Symbol.
339 @return const TText16 * Address of the Currency Symbol.
341 IMPORT_C static const TLocaleText* CurrencySymbol();
344 Returns the address of the short date format.
346 @return const TText16 * Address of the Short date format.
348 IMPORT_C static const TLocaleText* ShortDateFormatSpec();
351 Returns the address of the long date format.
353 @return const TText16 * Address of the Long date format.
355 IMPORT_C static const TLocaleText* LongDateFormatSpec();
358 Returns the address of the time format.
360 @return const TText16 * Address of the time format.
362 IMPORT_C static const TLocaleText* TimeFormatSpec();
365 Returns the addresses of the FAT utility functions.
367 @return const TFatUtilityFunctions * Addresses of the FAT utility functions.
369 IMPORT_C static const TFatUtilityFunctions* FatUtilityFunctions();
372 Returns the address of the data suffix table.
374 @return const TText16 * Address of the Date Suffix Table.
376 IMPORT_C static const TLocaleText* const *DateSuffixTable();
379 Returns the address of the day table.
381 @return const TText16 * Address of the Day table.
383 IMPORT_C static const TLocaleText* const *DayTable();
386 Returns the address of the abbreviated day table.
388 @return const TText16 * Address of the abbreviated day table.
390 IMPORT_C static const TLocaleText* const *DayAbbTable();
393 Returns the address of the month table.
395 @return const TText16 * Address of the month table.
397 IMPORT_C static const TLocaleText* const *MonthTable();
400 Returns the address of the abbreviated month table.
402 @return const TText16 * Address of the abbreviated month table.
404 IMPORT_C static const TLocaleText* const *MonthAbbTable();
407 Returns the address of the ampm table.
409 @return const TText16 * Address of the ampm table.
411 IMPORT_C static const TLocaleText* const *AmPmTable();
414 Returns the address of the message table.
416 @return const TText16 * Address of the message table.
418 IMPORT_C static const TLocaleText* const *MsgTable();
421 Returns the address of the locale character set object: contains collation rules etc.
423 @return const LCharSet * Address of the locale character set if its a UNICODE build; NULL otherwise.
425 IMPORT_C static const LCharSet *CharSet();
428 Returns the address of the character type conversion table.
430 @return const TUint8 * Address of the character type conversion table if its a NON-UNICODE build;NULL otherwise
432 IMPORT_C static const TUint8 *TypeTable();
435 Returns the address of the uppercase table.
437 @return const TText16 * Address of the uppercase table if its a NON-UNICODE build;NULL otherwise
440 IMPORT_C static const TLocaleText* UpperTable();
443 Returns the address of the lowercase table.
445 @return const TText16 * Address of the lowercase table if its a NON-UNICODE build;NULL otherwise
449 IMPORT_C static const TLocaleText* LowerTable();
452 Returns the address of the fold table.
454 @return const TText16 * Address of the fold table if its a NON-UNICODE build;NULL otherwise
457 IMPORT_C static const TLocaleText* FoldTable();
460 Returns the address of the collate table.
462 @return const TText16 * Address of the fold table if its a NON-UNICODE build;NULL otherwise
465 IMPORT_C static const TLocaleText* CollTable();
475 static const TLanguage Language;
476 static const TInt CountryCode;
477 static const TInt UniversalTimeOffset;
478 static const TDateFormat DateFormat;
479 static const TTimeFormat TimeFormat;
480 static const TLocaleText * const CurrencySymbol;
481 static const TLocalePos CurrencySymbolPosition;
482 static const TBool CurrencySpaceBetween;
483 static const TInt CurrencyDecimalPlaces;
484 static const TBool CurrencyNegativeInBrackets;
485 static const TBool CurrencyTriadsAllowed;
486 static const TLocaleText* const ShortDateFormatSpec;
487 static const TLocaleText* const LongDateFormatSpec;
488 static const TLocaleText* const TimeFormatSpec;
489 static const TFatUtilityFunctions* const FatUtilityFunctions;
490 static const TLocaleText * const ThousandsSeparator;
491 static const TLocaleText * const DecimalSeparator;
492 static const TLocaleText * const DateSeparator[KMaxDateSeparators];
493 static const TLocaleText * const TimeSeparator[KMaxTimeSeparators];
494 static const TLocalePos AmPmSymbolPosition;
495 static const TBool AmPmSpaceBetween;
496 // static const TUint DaylightSaving;
497 static const TDaylightSavingZone HomeDaylightSavingZone;
498 static const TUint WorkDays;
499 static const TDay StartOfWeek;
500 static const TClockFormat ClockFormat;
501 static const TUnitsFormat UnitsGeneral;
502 static const TUnitsFormat UnitsDistanceLong;
503 static const TUnitsFormat UnitsDistanceShort;
508 Settings for the locale language. They are some text tables of
509 day names, month names etc.
514 /** Text table containing the suffix strings of all days in a month. */
515 static const TLocaleText * const DateSuffixTable[KMaxSuffixes];
516 /** Text table containing the names of days in a week. */
517 static const TLocaleText * const DayTable[KMaxDays];
518 /** Text table containing the abbreviated names of days in a week. */
519 static const TLocaleText * const DayAbbTable[KMaxDays];
520 /** Text table containing the month names. */
521 static const TLocaleText * const MonthTable[KMaxMonths];
522 /** Text table containing the abbreviated month names. */
523 static const TLocaleText * const MonthAbbTable[KMaxMonths];
524 /** Text table containing the am/pm strings. */
525 static const TLocaleText * const AmPmTable[KMaxAmPms];
531 /** Text table containing the default messages for File Server, Sound Driver, and Media Drivers. */
532 static const TLocaleText * const MsgTable[ELocaleMessages_LastMsg];
536 * The LAlphabet class has been abolished in the Unicode build.
537 * Locale-specific character set information is kept in a unique LCharSet
538 * structure (defined in U32STD.H; used by the Exec, Locl, and K classes).
539 * The reason for having an actual object (rather than a class with no
540 * instances but with static members) is so that its address can be
541 * returned by the new Exec function GetLocaleCharSet().
543 extern const LCharSet TheCharSet; // the one and only LCharSet object