00001 /* 00002 * Copyright (c) 2005 Palmsource, Inc. 00003 * 00004 * This software is licensed as described in the file LICENSE, which 00005 * you should have received as part of this distribution. The terms 00006 * are also available at http://www.openbinder.org/license.html. 00007 * 00008 * This software consists of voluntary contributions made by many 00009 * individuals. For the exact contribution history, see the revision 00010 * history and logs, available at http://www.openbinder.org 00011 */ 00012 00013 #ifndef _LOCALEMGR_H__ 00014 #define _LOCALEMGR_H__ 00015 00016 #include <LocaleMgrTypes.h> 00017 #include <TextMgr.h> // CharEncodingType 00018 00019 /*********************************************************************** 00020 * Locale Manager routines 00021 **********************************************************************/ 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 /* Return the ROM locale in *<oROMLocale>, and the ROM character 00027 encoding as the function result. 00028 */ 00029 CharEncodingType 00030 LmGetROMLocale( LmLocaleType* oROMLocale); 00031 00032 /* Return the current system locale in *<oSystemLocale>, and the 00033 system character encoding as the function result. 00034 */ 00035 CharEncodingType 00036 LmGetSystemLocale( LmLocaleType* oSystemLocale); 00037 00038 /* Return the locale chosen by the user in the Formats panel in *<oFormatsLocale>. 00039 */ 00040 void 00041 LmGetFormatsLocale( LmLocaleType* oFormatsLocale); 00042 00043 /* Set the formats locale to iFormatsLocale, presumably because the user has 00044 identified this as their current locale. Also update various locale-dependent 00045 preferences items (e.g., number format) so that they match <iFormatsLocale>: 00046 */ 00047 status_t 00048 LmSetFormatsLocale( const 00049 LmLocaleType* iFormatsLocale); 00050 00051 /* Convert <iLanguage> into its (lowercase) 7-bit ASCII ISO 639 two-character 00052 representation, and place the result in <oISONameStr> (which must be at least 00053 3 bytes long). 00054 */ 00055 status_t 00056 LmLanguageToISOName(LmLanguageType iLanguage, 00057 char* oISONameStr); 00058 00059 /* Convert <iCountry> into its (lowercase) 7-bit ASCII ISO 3166 two-character 00060 representation, and place the result in <oISONameStr> (which must be at least 00061 3 bytes long). 00062 */ 00063 status_t 00064 LmCountryToISOName( LmCountryType iCountry, 00065 char* oISONameStr); 00066 00067 /* Convert the 7-bit ASCII ISO 639 two-character language code representation 00068 <iISONameStr> into *<oLanguage>. 00069 */ 00070 status_t 00071 LmISONameToLanguage(const 00072 char* iISONameStr, 00073 LmLanguageType* oLanguage); 00074 00075 /* Convert the 7-bit ASCII ISO 3166 two-character country code representation 00076 <iISONameStr> into *<oCountry>. 00077 */ 00078 status_t 00079 LmISONameToCountry( const 00080 char* iISONameStr, 00081 LmCountryType* oCountry); 00082 00083 /* Return the number of known locales (maximum locale index + 1). 00084 */ 00085 uint16_t 00086 LmGetNumLocales(void); 00087 00088 /* Convert <iLocale> to <oLocaleIndex> by locating it within the set of known 00089 locales. 00090 */ 00091 status_t 00092 LmLocaleToIndex( const 00093 LmLocaleType* iLocale, 00094 uint16_t* oLocaleIndex); 00095 00096 /* Convert <iLocale> to <oLocaleIndex> by locating it within the set of known 00097 locales. If an exact match cannot be found, the index of the most similar known 00098 locale to <iLocale> will be returned. This routine is guaranteed to return a 00099 valid locale index. 00100 */ 00101 uint16_t 00102 LmBestLocaleToIndex(const 00103 LmLocaleType* iLocale); 00104 00105 /* Return in <oValue> the setting identified by <iChoice> which is appropriate for 00106 the locale identified by <iLocaleIndex>. Return lmErrSettingDataOverflow if the 00107 data for <iChoice> occupies more than <iValueSize> bytes. Display a non-fatal 00108 error if <iValueSize> is larger than the data for a fixed-size setting. 00109 */ 00110 status_t 00111 LmGetLocaleSetting( uint16_t iLocaleIndex, 00112 LmLocaleSettingChoice iChoice, 00113 void* oValue, 00114 uint16_t iValueSize); 00115 00116 /* Return the <oThousandSeparatorChar> and <oDecimalSeparatorChar> used for 00117 <iNumberFormat>. 00118 */ 00119 #define LocGetNumberSeparators LmGetNumberSeparators 00120 void 00121 LmGetNumberSeparators(NumberFormatType iNumberFormat, 00122 char* oThousandSeparatorChar, 00123 char* oDecimalSeparatorChar); 00124 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif 00129 00130 #endif // _LOCALEMGR_H__