1449ab281SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3449ab281SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4449ab281SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5449ab281SAndrew Rist  * distributed with this work for additional information
6449ab281SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7449ab281SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8449ab281SAndrew Rist  * "License"); you may not use this file except in compliance
9449ab281SAndrew Rist  * with the License.  You may obtain a copy of the License at
10449ab281SAndrew Rist  *
11449ab281SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12449ab281SAndrew Rist  *
13449ab281SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14449ab281SAndrew Rist  * software distributed under the License is distributed on an
15449ab281SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16449ab281SAndrew Rist  * KIND, either express or implied.  See the License for the
17449ab281SAndrew Rist  * specific language governing permissions and limitations
18449ab281SAndrew Rist  * under the License.
19449ab281SAndrew Rist  *
20449ab281SAndrew Rist  *************************************************************/
21449ab281SAndrew Rist 
22449ab281SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
26cdf0e10cSrcweir #include <rtl/ustring.hxx>
27cdf0e10cSrcweir #include <rtl/string.hxx>
28cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
29cdf0e10cSrcweir #include <rtl/strbuf.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "i18npool/mslangid.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // =======================================================================
34cdf0e10cSrcweir 
35cdf0e10cSrcweir struct IsoLangEngEntry
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     LanguageType        mnLang;
38cdf0e10cSrcweir     sal_Char            maCountry[3];
39cdf0e10cSrcweir };
40cdf0e10cSrcweir 
41cdf0e10cSrcweir struct IsoLangNoneStdEntry
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     LanguageType        mnLang;
44cdf0e10cSrcweir     sal_Char            maLangStr[4];
45cdf0e10cSrcweir     sal_Char            maCountry[9];
46cdf0e10cSrcweir };
47cdf0e10cSrcweir 
48cdf0e10cSrcweir struct IsoLangOtherEntry
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     LanguageType        mnLang;
51cdf0e10cSrcweir     const sal_Char*     mpLangStr;
52cdf0e10cSrcweir };
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // -----------------------------------------------------------------------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // Entries for languages are lower case, for countries upper case, as
57cdf0e10cSrcweir // recommended by rfc4646 (obsoletes rfc3066 (obsoletes rfc1766)).
58cdf0e10cSrcweir // convertIsoNamesToLanguage() is case insensitive
59cdf0e10cSrcweir //
60cdf0e10cSrcweir // Sort order: Most used first.
61cdf0e10cSrcweir //
62cdf0e10cSrcweir // The default entry for a LangID <-> ISO mapping has to be first. For
63cdf0e10cSrcweir // conversion of legacy mappings one LangID can map to multiple ISO codes, and
64cdf0e10cSrcweir // one ISO code combination can map to multiple LangIDs. For compatibility with
65cdf0e10cSrcweir // already existing calls it can also be a sequence as follows:
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // LANGUAGE_ENGLISH,    "en", ""
68cdf0e10cSrcweir // LANGUAGE_ENGLISH_US, "en", "US"
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // Here, in a convertIsoNamesToLanguage() call "en-US" is converted to
71cdf0e10cSrcweir // LANGUAGE_ENGLISH_US and "en" is converted to LANGUAGE_ENGLISH. A call with
72cdf0e10cSrcweir // "en-ZZ" (not in table) would result in LANGUAGE_ENGLISH because the first
73cdf0e10cSrcweir // entry matching the language and not having a country is returned, regardless
74cdf0e10cSrcweir // of whether being sorted before or after other entries of the same language
75cdf0e10cSrcweir // with some country. To obtain a _locale_ (not language only) in the order
76cdf0e10cSrcweir // given, convertLocaleToLanguageWithFallback() must be called.
77cdf0e10cSrcweir 
78cdf0e10cSrcweir // If the sequence instead was
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // LANGUAGE_ENGLISH_US, "en", "US"
81cdf0e10cSrcweir // LANGUAGE_ENGLISH,    "en", ""
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // in a convertIsoNamesToLanguage() call "en-US" is still converted to
84cdf0e10cSrcweir // LANGUAGE_ENGLISH_US, but "en" is _also_ converted to LANGUAGE_ENGLISH_US
85cdf0e10cSrcweir // because no country was passed and it is the first entry to match the
86cdf0e10cSrcweir // language, see code. A call with "en-ZZ" (not in table) would still result in
87cdf0e10cSrcweir // LANGUAGE_ENGLISH.
88cdf0e10cSrcweir 
89cdf0e10cSrcweir /* erAck: 2007-07-05T20:01+0200  TODO: The entire suite's "primary language
90cdf0e10cSrcweir  * only" usage and locale fall back should be cleaned up and made consistent. I
91cdf0e10cSrcweir  * strongly doubt that most callers exactly expect the behavior described.
92cdf0e10cSrcweir  * Currently these primary LangIDs are used literally in OOo code:
93cdf0e10cSrcweir  * LANGUAGE_ENGLISH LANGUAGE_CHINESE LANGUAGE_MALAY
94cdf0e10cSrcweir  * LANGUAGE_AZERI LANGUAGE_URDU LANGUAGE_KASHMIRI
95cdf0e10cSrcweir  */
96cdf0e10cSrcweir 
97cdf0e10cSrcweir static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     // MS-LANGID codes               ISO639-1/2/3 ISO3166
100cdf0e10cSrcweir     { LANGUAGE_ENGLISH,                     "en", ""   },
101cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "en", "US" },
102cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "en", "GB" },
103cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "en", "AU" },
104cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CAN,                 "en", "CA" },
105cdf0e10cSrcweir     { LANGUAGE_FRENCH,                      "fr", "FR" },
106cdf0e10cSrcweir     { LANGUAGE_FRENCH,                      "fr", ""   },
107cdf0e10cSrcweir     { LANGUAGE_GERMAN,                      "de", "DE" },
108cdf0e10cSrcweir     { LANGUAGE_ITALIAN,                     "it", "IT" },
109cdf0e10cSrcweir     { LANGUAGE_DUTCH,                       "nl", "NL" },
110cdf0e10cSrcweir     { LANGUAGE_SPANISH_MODERN,              "es", "ES" },
111cdf0e10cSrcweir     { LANGUAGE_SPANISH_DATED,               "es", "ES" },
112cdf0e10cSrcweir     { LANGUAGE_PORTUGUESE,                  "pt", "PT" },
113cdf0e10cSrcweir     { LANGUAGE_PORTUGUESE_BRAZILIAN,        "pt", "BR" },
114cdf0e10cSrcweir     { LANGUAGE_DANISH,                      "da", "DK" },
115cdf0e10cSrcweir     { LANGUAGE_GREEK,                       "el", "GR" },
116cdf0e10cSrcweir     { LANGUAGE_CHINESE,                     "zh", ""   },
117cdf0e10cSrcweir     { LANGUAGE_CHINESE_SIMPLIFIED,          "zh", "CN" },
118cdf0e10cSrcweir     { LANGUAGE_CHINESE_TRADITIONAL,         "zh", "TW" },
119cdf0e10cSrcweir     { LANGUAGE_CHINESE_HONGKONG,            "zh", "HK" },
120cdf0e10cSrcweir     { LANGUAGE_CHINESE_SINGAPORE,           "zh", "SG" },
121cdf0e10cSrcweir     { LANGUAGE_CHINESE_MACAU,               "zh", "MO" },
122cdf0e10cSrcweir     { LANGUAGE_ENGLISH_HONG_KONG_SAR,       "en", "HK" },
123cdf0e10cSrcweir     { LANGUAGE_JAPANESE,                    "ja", "JP" },
124cdf0e10cSrcweir     { LANGUAGE_KOREAN,                      "ko", "KR" },
125cdf0e10cSrcweir     { LANGUAGE_KOREAN_JOHAB,                "ko", "KR" },
126cdf0e10cSrcweir     { LANGUAGE_USER_KOREAN_NORTH,           "ko", "KP" },
127cdf0e10cSrcweir     { LANGUAGE_SWEDISH,                     "sv", "SE" },
128cdf0e10cSrcweir     { LANGUAGE_SWEDISH_FINLAND,             "sv", "FI" },
129cdf0e10cSrcweir     { LANGUAGE_FINNISH,                     "fi", "FI" },
130cdf0e10cSrcweir     { LANGUAGE_RUSSIAN,                     "ru", "RU" },
131cdf0e10cSrcweir     { LANGUAGE_TATAR,                       "tt", "RU" },
132cdf0e10cSrcweir     { LANGUAGE_ENGLISH_NZ,                  "en", "NZ" },
133cdf0e10cSrcweir     { LANGUAGE_ENGLISH_EIRE,                "en", "IE" },
134cdf0e10cSrcweir     { LANGUAGE_DUTCH_BELGIAN,               "nl", "BE" },
135cdf0e10cSrcweir     { LANGUAGE_FRENCH_BELGIAN,              "fr", "BE" },
136cdf0e10cSrcweir     { LANGUAGE_FRENCH_CANADIAN,             "fr", "CA" },
137cdf0e10cSrcweir     { LANGUAGE_FRENCH_SWISS,                "fr", "CH" },
138cdf0e10cSrcweir     { LANGUAGE_GERMAN_SWISS,                "de", "CH" },
139cdf0e10cSrcweir     { LANGUAGE_GERMAN_AUSTRIAN,             "de", "AT" },
140cdf0e10cSrcweir     { LANGUAGE_ITALIAN_SWISS,               "it", "CH" },
141cdf0e10cSrcweir     { LANGUAGE_ALBANIAN,                    "sq", "AL" },
142cdf0e10cSrcweir     { LANGUAGE_ARABIC_SAUDI_ARABIA,         "ar", "SA" },
143cdf0e10cSrcweir     { LANGUAGE_ARABIC_EGYPT,                "ar", "EG" },
144cdf0e10cSrcweir     { LANGUAGE_ARABIC_UAE,                  "ar", "AE" },
145cdf0e10cSrcweir     { LANGUAGE_ARABIC_IRAQ,                 "ar", "IQ" },
146cdf0e10cSrcweir     { LANGUAGE_ARABIC_LIBYA,                "ar", "LY" },
147cdf0e10cSrcweir     { LANGUAGE_ARABIC_ALGERIA,              "ar", "DZ" },
148cdf0e10cSrcweir     { LANGUAGE_ARABIC_MOROCCO,              "ar", "MA" },
149cdf0e10cSrcweir     { LANGUAGE_ARABIC_TUNISIA,              "ar", "TN" },
150cdf0e10cSrcweir     { LANGUAGE_ARABIC_OMAN,                 "ar", "OM" },
151cdf0e10cSrcweir     { LANGUAGE_ARABIC_YEMEN,                "ar", "YE" },
152cdf0e10cSrcweir     { LANGUAGE_ARABIC_SYRIA,                "ar", "SY" },
153cdf0e10cSrcweir     { LANGUAGE_ARABIC_JORDAN,               "ar", "JO" },
154cdf0e10cSrcweir     { LANGUAGE_ARABIC_LEBANON,              "ar", "LB" },
155cdf0e10cSrcweir     { LANGUAGE_ARABIC_KUWAIT,               "ar", "KW" },
156cdf0e10cSrcweir     { LANGUAGE_ARABIC_BAHRAIN,              "ar", "BH" },
157cdf0e10cSrcweir     { LANGUAGE_ARABIC_QATAR,                "ar", "QA" },
158cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_CHAD,            "ar", "TD" },
159cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_COMOROS,         "ar", "KM" },
160cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_DJIBOUTI,        "ar", "DJ" },
161cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_ERITREA,         "ar", "ER" },
162cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_ISRAEL,          "ar", "IL" },
163cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_MAURITANIA,      "ar", "MR" },
164cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_PALESTINE,       "ar", "PS" },
165cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_SOMALIA,         "ar", "SO" },
166cdf0e10cSrcweir     { LANGUAGE_USER_ARABIC_SUDAN,           "ar", "SD" },
167cdf0e10cSrcweir     { LANGUAGE_ARABIC_PRIMARY_ONLY,         "ar", ""   },
168cdf0e10cSrcweir     { LANGUAGE_BASQUE,                      "eu", ""   },
169cdf0e10cSrcweir     { LANGUAGE_BULGARIAN,                   "bg", "BG" },
170cdf0e10cSrcweir     { LANGUAGE_CZECH,                       "cs", "CZ" },
171cdf0e10cSrcweir     { LANGUAGE_CZECH,                       "cz", ""   },
172cdf0e10cSrcweir     { LANGUAGE_ENGLISH_JAMAICA,             "en", "JM" },
173cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "en", "BS" },   // not 100%, because AG is Bahamas
174cdf0e10cSrcweir     { LANGUAGE_ENGLISH_BELIZE,              "en", "BZ" },
175cdf0e10cSrcweir     { LANGUAGE_ENGLISH_TRINIDAD,            "en", "TT" },
176cdf0e10cSrcweir     { LANGUAGE_ENGLISH_ZIMBABWE,            "en", "ZW" },
177cdf0e10cSrcweir     { LANGUAGE_ENGLISH_INDONESIA,           "en", "ID" },
178cdf0e10cSrcweir     { LANGUAGE_ESTONIAN,                    "et", "EE" },
179cdf0e10cSrcweir     { LANGUAGE_FAEROESE,                    "fo", "FO" },
180cdf0e10cSrcweir     { LANGUAGE_FARSI,                       "fa", "IR" },
181cdf0e10cSrcweir     { LANGUAGE_FRENCH_LUXEMBOURG,           "fr", "LU" },
182cdf0e10cSrcweir     { LANGUAGE_FRENCH_MONACO,               "fr", "MC" },
183cdf0e10cSrcweir     { LANGUAGE_GERMAN_LUXEMBOURG,           "de", "LU" },
184cdf0e10cSrcweir     { LANGUAGE_GERMAN_LIECHTENSTEIN,        "de", "LI" },
185cdf0e10cSrcweir     { LANGUAGE_HEBREW,                      "he", "IL" },   // new: old was "iw"
186cdf0e10cSrcweir     { LANGUAGE_HEBREW,                      "iw", "IL" },   // old: new is "he"
187cdf0e10cSrcweir     { LANGUAGE_HUNGARIAN,                   "hu", "HU" },
188cdf0e10cSrcweir     { LANGUAGE_ICELANDIC,                   "is", "IS" },
189cdf0e10cSrcweir     { LANGUAGE_INDONESIAN,                  "id", "ID" },   // new: old was "in"
190cdf0e10cSrcweir     { LANGUAGE_INDONESIAN,                  "in", "ID" },   // old: new is "id"
191cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN,                   "no", "NO" },
192cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_BOKMAL,            "nb", "NO" },
193cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_NYNORSK,           "nn", "NO" },
194cdf0e10cSrcweir     { LANGUAGE_POLISH,                      "pl", "PL" },
195cdf0e10cSrcweir     { LANGUAGE_RHAETO_ROMAN,                "rm", "CH" },
196cdf0e10cSrcweir     { LANGUAGE_ROMANIAN,                    "ro", "RO" },
197cdf0e10cSrcweir     { LANGUAGE_ROMANIAN_MOLDOVA,            "ro", "MD" },
198cdf0e10cSrcweir     { LANGUAGE_SLOVAK,                      "sk", "SK" },
199cdf0e10cSrcweir     { LANGUAGE_SLOVENIAN,                   "sl", "SI" },
200cdf0e10cSrcweir     { LANGUAGE_SPANISH_MEXICAN,             "es", "MX" },
201cdf0e10cSrcweir     { LANGUAGE_SPANISH_GUATEMALA,           "es", "GT" },
202cdf0e10cSrcweir     { LANGUAGE_SPANISH_COSTARICA,           "es", "CR" },
203cdf0e10cSrcweir     { LANGUAGE_SPANISH_PANAMA,              "es", "PA" },
204cdf0e10cSrcweir     { LANGUAGE_SPANISH_DOMINICAN_REPUBLIC,  "es", "DO" },
205cdf0e10cSrcweir     { LANGUAGE_SPANISH_VENEZUELA,           "es", "VE" },
206cdf0e10cSrcweir     { LANGUAGE_SPANISH_COLOMBIA,            "es", "CO" },
207cdf0e10cSrcweir     { LANGUAGE_SPANISH_PERU,                "es", "PE" },
208cdf0e10cSrcweir     { LANGUAGE_SPANISH_ARGENTINA,           "es", "AR" },
209cdf0e10cSrcweir     { LANGUAGE_SPANISH_ECUADOR,             "es", "EC" },
210cdf0e10cSrcweir     { LANGUAGE_SPANISH_CHILE,               "es", "CL" },
211cdf0e10cSrcweir     { LANGUAGE_SPANISH_URUGUAY,             "es", "UY" },
212cdf0e10cSrcweir     { LANGUAGE_SPANISH_PARAGUAY,            "es", "PY" },
213cdf0e10cSrcweir     { LANGUAGE_SPANISH_BOLIVIA,             "es", "BO" },
214cdf0e10cSrcweir     { LANGUAGE_SPANISH_EL_SALVADOR,         "es", "SV" },
215cdf0e10cSrcweir     { LANGUAGE_SPANISH_HONDURAS,            "es", "HN" },
216cdf0e10cSrcweir     { LANGUAGE_SPANISH_NICARAGUA,           "es", "NI" },
217cdf0e10cSrcweir     { LANGUAGE_SPANISH_PUERTO_RICO,         "es", "PR" },
218cdf0e10cSrcweir     { LANGUAGE_SPANISH_UNITED_STATES,       "es", "US" },
219cdf0e10cSrcweir     { LANGUAGE_SPANISH_LATIN_AMERICA,       "es", ""   },
220cdf0e10cSrcweir     { LANGUAGE_TURKISH,                     "tr", "TR" },
221cdf0e10cSrcweir     { LANGUAGE_UKRAINIAN,                   "uk", "UA" },
222cdf0e10cSrcweir     { LANGUAGE_VIETNAMESE,                  "vi", "VN" },
223cdf0e10cSrcweir     { LANGUAGE_LATVIAN,                     "lv", "LV" },
224cdf0e10cSrcweir     { LANGUAGE_MACEDONIAN,                  "mk", "MK" },
225cdf0e10cSrcweir     { LANGUAGE_MALAY,                       "ms", ""   },
226cdf0e10cSrcweir     { LANGUAGE_MALAY_MALAYSIA,              "ms", "MY" },
227cdf0e10cSrcweir     { LANGUAGE_MALAY_BRUNEI_DARUSSALAM,     "ms", "BN" },
228cdf0e10cSrcweir     { LANGUAGE_ENGLISH_MALAYSIA,            "en", "MY" },
229cdf0e10cSrcweir     { LANGUAGE_THAI,                        "th", "TH" },
230cdf0e10cSrcweir     { LANGUAGE_LITHUANIAN,                  "lt", "LT" },
231cdf0e10cSrcweir     { LANGUAGE_LITHUANIAN_CLASSIC,          "lt", "LT" },
232cdf0e10cSrcweir     { LANGUAGE_CROATIAN,                    "hr", "HR" },   // Croatian in Croatia
233cdf0e10cSrcweir     { LANGUAGE_CROATIAN_BOSNIA_HERZEGOVINA, "hr", "BA" },
234cdf0e10cSrcweir     { LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA,        "bs", "BA" },
235cdf0e10cSrcweir //  { LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_AND_HERZEGOVINA, "bs", "BA" },   // script codes not supported yet
236cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA,        "sr", "RS" },   // Serbian Cyrillic in Serbia
237cdf0e10cSrcweir     { LANGUAGE_SERBIAN_CYRILLIC,                    "sr", "YU" },   // legacy Serbian Cyrillic in Serbia and Montenegro (former Yugoslavia); kludge, needed to be sr_CS instead, sr_CS not supported by ICU 2.6 (3.4 does)
238cdf0e10cSrcweir     { LANGUAGE_SERBIAN_CYRILLIC,                    "sr", "CS" },   // alias to be able to integrate localizations, rsc needs it
239cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO,    "sr", "ME" },
240cdf0e10cSrcweir     { LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "sr", "BA" },
241cdf0e10cSrcweir     { LANGUAGE_SERBIAN,                             "sr", ""   },   // SERBIAN is only LID, MS-LCID not defined (was dupe of CROATIAN)
242cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_LATIN_SERBIA,           "sh", "RS" },   // Serbian Latin in Serbia; kludge, needed to be sr_Latn_RS instead, script codes not supported yet
243cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN,                       "sh", "YU" },   // legacy Serbian Latin in Serbia and Montenegro (former Yugoslavia); kludge, needed to be sr_Latn_CS instead, script codes not supported yet
244cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN,                       "sh", "CS" },   // Serbian Latin in Serbia and Montenegro; kludge, needed to be sr_Latn_CS instead, script codes not supported yet
245cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO,       "sh", "ME" },   // Serbian Latin in Montenegro; kludge, needed to be sr_Latn_ME instead, script codes not supported yet
246cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA,    "sh", "BA" },
247cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN_NEUTRAL,               "sh", ""   },   // kludge, needed to be sr_Latn instead, script codes not supported yet
248cdf0e10cSrcweir     { LANGUAGE_ARMENIAN,                    "hy", "AM" },
249cdf0e10cSrcweir     { LANGUAGE_AZERI,                       "az", ""   },
250cdf0e10cSrcweir     { LANGUAGE_AZERI_LATIN,                 "az", "AZ" },
251cdf0e10cSrcweir //  { LANGUAGE_AZERI_CYRILLIC,              "az", "AZ" },   // script codes not supported yet
252cdf0e10cSrcweir     { LANGUAGE_UZBEK_LATIN,                 "uz", "UZ" },
253cdf0e10cSrcweir //  { LANGUAGE_UZBEK_CYRILLIC,              "uz", "UZ" },   // script codes not supported yet
254cdf0e10cSrcweir     { LANGUAGE_BENGALI_BANGLADESH,          "bn", "BD" },
255cdf0e10cSrcweir     { LANGUAGE_BENGALI,                     "bn", "IN" },
256cdf0e10cSrcweir     { LANGUAGE_BURMESE,                     "my", "MM" },
257cdf0e10cSrcweir     { LANGUAGE_KAZAK,                       "kk", "KZ" },
258cdf0e10cSrcweir     { LANGUAGE_ENGLISH_INDIA,               "en", "IN" },
259cdf0e10cSrcweir     { LANGUAGE_URDU,                        "ur", ""   },
260cdf0e10cSrcweir     { LANGUAGE_URDU_INDIA,                  "ur", "IN" },
261cdf0e10cSrcweir     { LANGUAGE_URDU_PAKISTAN,               "ur", "PK" },
262cdf0e10cSrcweir     { LANGUAGE_HINDI,                       "hi", "IN" },
263cdf0e10cSrcweir     { LANGUAGE_GUJARATI,                    "gu", "IN" },
264cdf0e10cSrcweir     { LANGUAGE_KANNADA,                     "kn", "IN" },
265cdf0e10cSrcweir     { LANGUAGE_ASSAMESE,                    "as", "IN" },
266cdf0e10cSrcweir     { LANGUAGE_KASHMIRI,                    "ks", ""   },
267cdf0e10cSrcweir     { LANGUAGE_KASHMIRI_INDIA,              "ks", "IN" },
268cdf0e10cSrcweir     { LANGUAGE_MALAYALAM,                   "ml", "IN" },
269cdf0e10cSrcweir     { LANGUAGE_MANIPURI,                   "mni", "IN" },
270cdf0e10cSrcweir     { LANGUAGE_MARATHI,                     "mr", "IN" },
271cdf0e10cSrcweir     { LANGUAGE_KONKANI,                    "kok", "IN" },
272cdf0e10cSrcweir     { LANGUAGE_NEPALI,                      "ne", "NP" },
273cdf0e10cSrcweir     { LANGUAGE_NEPALI_INDIA,                "ne", "IN" },
274cdf0e10cSrcweir     { LANGUAGE_ORIYA,                       "or", "IN" },
275cdf0e10cSrcweir     { LANGUAGE_PUNJABI,                     "pa", "IN" },
276cdf0e10cSrcweir     { LANGUAGE_SANSKRIT,                    "sa", "IN" },
277cdf0e10cSrcweir     { LANGUAGE_SINDHI,                      "sd", "IN" },
278cdf0e10cSrcweir     { LANGUAGE_TAMIL,                       "ta", "IN" },
279cdf0e10cSrcweir     { LANGUAGE_TELUGU,                      "te", "IN" },
280cdf0e10cSrcweir     { LANGUAGE_PUNJABI_PAKISTAN,           "lah", "PK" },   // preferring "lah" over "pa" for Western Punjabi, see http://www.ethnologue.com/show_language.asp?code=PNB
281cdf0e10cSrcweir     { LANGUAGE_PUNJABI_PAKISTAN,            "pa", "PK" },
282cdf0e10cSrcweir     { LANGUAGE_SINDHI_PAKISTAN,             "sd", "PK" },
283cdf0e10cSrcweir     { LANGUAGE_BELARUSIAN,                  "be", "BY" },
284cdf0e10cSrcweir     { LANGUAGE_CATALAN,                     "ca", "ES" },   // Spain (default)
285cdf0e10cSrcweir     { LANGUAGE_CATALAN,                     "ca", "AD" },   // Andorra
286*df5bc930SJuergen Schmidt     { LANGUAGE_USER_CATALAN_VALENCIAN_RACV, "ca", "XR" },   // XR: ISO ???? user-assigned; workaround for UI localization only, do not use in document content!
287*df5bc930SJuergen Schmidt     { LANGUAGE_USER_CATALAN_VALENCIAN,      "ca", "XV" },   // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content!
288cdf0e10cSrcweir     { LANGUAGE_CATALAN,                    "qcv", "ES" },   // qcv: ISO 639-3 reserved-for-local-use; UI localization quirk only, do not use in document content!
289cdf0e10cSrcweir //    { LANGUAGE_USER_CATALAN_VALENCIAN,      "ca", "ES" },   // In case MS format files escaped into the wild, map them back.
290cdf0e10cSrcweir     { LANGUAGE_FRENCH_CAMEROON,             "fr", "CM" },
291cdf0e10cSrcweir     { LANGUAGE_FRENCH_COTE_D_IVOIRE,        "fr", "CI" },
292cdf0e10cSrcweir     { LANGUAGE_FRENCH_MALI,                 "fr", "ML" },
293cdf0e10cSrcweir     { LANGUAGE_FRENCH_SENEGAL,              "fr", "SN" },
294cdf0e10cSrcweir     { LANGUAGE_FRENCH_ZAIRE,                "fr", "CD" },   // Democratic Republic Of Congo
295cdf0e10cSrcweir     { LANGUAGE_FRENCH_MOROCCO,              "fr", "MA" },
296cdf0e10cSrcweir     { LANGUAGE_FRENCH_REUNION,              "fr", "RE" },
297cdf0e10cSrcweir     { LANGUAGE_FRENCH_NORTH_AFRICA,         "fr", ""   },
298cdf0e10cSrcweir     { LANGUAGE_FRENCH_WEST_INDIES,          "fr", ""   },   // unknown ISO country code
299cdf0e10cSrcweir     { LANGUAGE_FRISIAN_NETHERLANDS,         "fy", "NL" },
300cdf0e10cSrcweir     { LANGUAGE_GAELIC_IRELAND,              "ga", "IE" },
301cdf0e10cSrcweir     { LANGUAGE_GAELIC_SCOTLAND,             "gd", "GB" },
302cdf0e10cSrcweir     { LANGUAGE_GALICIAN,                    "gl", "ES" },
303cdf0e10cSrcweir     { LANGUAGE_GEORGIAN,                    "ka", "GE" },
304cdf0e10cSrcweir     { LANGUAGE_KHMER,                       "km", "KH" },
305cdf0e10cSrcweir     { LANGUAGE_KIRGHIZ,                     "ky", "KG" },
306cdf0e10cSrcweir     { LANGUAGE_LAO,                         "lo", "LA" },
307cdf0e10cSrcweir     { LANGUAGE_MALTESE,                     "mt", "MT" },
308cdf0e10cSrcweir     { LANGUAGE_MONGOLIAN,                   "mn", "MN" },   // Cyrillic script
309cdf0e10cSrcweir     { LANGUAGE_MONGOLIAN_MONGOLIAN,         "mn", "MN" },
310cdf0e10cSrcweir     { LANGUAGE_RUSSIAN_MOLDOVA,             "mo", "MD" },
311cdf0e10cSrcweir     { LANGUAGE_SWAHILI,                     "sw", "KE" },
312cdf0e10cSrcweir     { LANGUAGE_USER_SWAHILI_TANZANIA,       "sw", "TZ" },
313cdf0e10cSrcweir     { LANGUAGE_TAJIK,                       "tg", "TJ" },
314cdf0e10cSrcweir     { LANGUAGE_TIBETAN,                     "bo", "CN" },   // CN politically correct?
315cdf0e10cSrcweir     { LANGUAGE_DZONGKHA,                    "dz", "BT" },
316cdf0e10cSrcweir     { LANGUAGE_TURKMEN,                     "tk", "TM" },
317cdf0e10cSrcweir     { LANGUAGE_WELSH,                       "cy", "GB" },
318cdf0e10cSrcweir     { LANGUAGE_SESOTHO,                     "st", "ZA" },
319cdf0e10cSrcweir     { LANGUAGE_SEPEDI,                     "nso", "ZA" },
320cdf0e10cSrcweir     { LANGUAGE_SEPEDI,                      "ns", "ZA" },   // fake "ns" for compatibility with existing OOo1.1.x localization to be able to read those documents
321cdf0e10cSrcweir     { LANGUAGE_TSONGA,                      "ts", "ZA" },
322cdf0e10cSrcweir     { LANGUAGE_TSWANA,                      "tn", "ZA" },
323cdf0e10cSrcweir     { LANGUAGE_ENGLISH_SAFRICA,             "en", "ZA" },
324cdf0e10cSrcweir     { LANGUAGE_AFRIKAANS,                   "af", "ZA" },
325cdf0e10cSrcweir     { LANGUAGE_VENDA,                       "ve", "ZA" },   // default 639-1
326cdf0e10cSrcweir     { LANGUAGE_VENDA,                      "ven", "ZA" },   // 639-2 may have been used temporarily since 2004-07-23
327cdf0e10cSrcweir     { LANGUAGE_XHOSA,                       "xh", "ZA" },
328cdf0e10cSrcweir     { LANGUAGE_ZULU,                        "zu", "ZA" },
329cdf0e10cSrcweir     { LANGUAGE_QUECHUA_ECUADOR,             "qu", "EC" },
330cdf0e10cSrcweir     { LANGUAGE_QUECHUA_PERU,                "qu", "PE" },
331cdf0e10cSrcweir     { LANGUAGE_QUECHUA_BOLIVIA,             "qu", "BO" },   // macro: quh-BO, qul-BO
332cdf0e10cSrcweir     { LANGUAGE_PASHTO,                      "ps", "AF" },
333cdf0e10cSrcweir     { LANGUAGE_OROMO,                       "om", "ET" },
334cdf0e10cSrcweir     { LANGUAGE_DHIVEHI,                     "dv", "MV" },
335cdf0e10cSrcweir     { LANGUAGE_UIGHUR_CHINA,                "ug", "CN" },
336cdf0e10cSrcweir     { LANGUAGE_TIGRIGNA_ETHIOPIA,           "ti", "ET" },
337cdf0e10cSrcweir     { LANGUAGE_TIGRIGNA_ERITREA,            "ti", "ER" },
338cdf0e10cSrcweir     { LANGUAGE_AMHARIC_ETHIOPIA,            "am", "ET" },
339cdf0e10cSrcweir     { LANGUAGE_GUARANI_PARAGUAY,           "gug", "PY" },
340cdf0e10cSrcweir     { LANGUAGE_HAWAIIAN_UNITED_STATES,     "haw", "US" },
341cdf0e10cSrcweir     { LANGUAGE_EDO,                        "bin", "NG" },
342cdf0e10cSrcweir     { LANGUAGE_FULFULDE_NIGERIA,            "ff", "NG" },
343cdf0e10cSrcweir     { LANGUAGE_HAUSA_NIGERIA,               "ha", "NG" },
344cdf0e10cSrcweir     { LANGUAGE_USER_HAUSA_GHANA,            "ha", "GH" },
345cdf0e10cSrcweir     { LANGUAGE_IGBO_NIGERIA,                "ig", "NG" },
346cdf0e10cSrcweir     { LANGUAGE_KANURI_NIGERIA,              "kr", "NG" },
347cdf0e10cSrcweir     { LANGUAGE_YORUBA,                      "yo", "NG" },
348cdf0e10cSrcweir     { LANGUAGE_SOMALI,                      "so", "SO" },
349cdf0e10cSrcweir     { LANGUAGE_PAPIAMENTU,                 "pap", "AN" },
350cdf0e10cSrcweir     { LANGUAGE_USER_PAPIAMENTU_ARUBA,      "pap", "AW" },
351cdf0e10cSrcweir     { LANGUAGE_ENGLISH_SINGAPORE,           "en", "SG" },
352cdf0e10cSrcweir     { LANGUAGE_USER_YIDDISH_US,             "yi", "US" },
353cdf0e10cSrcweir     { LANGUAGE_YIDDISH,                     "yi", "IL" },   // new: old was "ji"
354cdf0e10cSrcweir     { LANGUAGE_YIDDISH,                     "ji", "IL" },   // old: new is "yi"
355cdf0e10cSrcweir     { LANGUAGE_SYRIAC,                     "syr", "TR" },   // "TR" according to http://www.ethnologue.com/show_language.asp?code=SYC
356cdf0e10cSrcweir     { LANGUAGE_SINHALESE_SRI_LANKA,         "si", "LK" },
357cdf0e10cSrcweir     { LANGUAGE_CHEROKEE_UNITED_STATES,     "chr", "US" },
358cdf0e10cSrcweir     { LANGUAGE_INUKTITUT_LATIN_CANADA,      "iu", "CA" },
359cdf0e10cSrcweir //  { LANGUAGE_INUKTITUT_SYLLABICS_CANADA,  "iu", "CA" },   // script codes not supported yet
360cdf0e10cSrcweir     { LANGUAGE_SAMI_NORTHERN_NORWAY,        "se", "NO" },
361cdf0e10cSrcweir     { LANGUAGE_SAMI_INARI,                 "smn", "FI" },
362cdf0e10cSrcweir     { LANGUAGE_SAMI_LULE_NORWAY,           "smj", "NO" },
363cdf0e10cSrcweir     { LANGUAGE_SAMI_LULE_SWEDEN,           "smj", "SE" },
364cdf0e10cSrcweir     { LANGUAGE_SAMI_NORTHERN_FINLAND,       "se", "FI" },
365cdf0e10cSrcweir     { LANGUAGE_SAMI_NORTHERN_SWEDEN,        "se", "SE" },
366cdf0e10cSrcweir     { LANGUAGE_SAMI_SKOLT,                 "sms", "FI" },
367cdf0e10cSrcweir     { LANGUAGE_SAMI_SOUTHERN_NORWAY,       "sma", "NO" },
368cdf0e10cSrcweir     { LANGUAGE_SAMI_SOUTHERN_SWEDEN,       "sma", "SE" },
369cdf0e10cSrcweir     { LANGUAGE_USER_SAMI_KILDIN_RUSSIA,    "sjd", "RU" },
370cdf0e10cSrcweir     { LANGUAGE_MAPUDUNGUN_CHILE,           "arn", "CL" },
371cdf0e10cSrcweir     { LANGUAGE_CORSICAN_FRANCE,             "co", "FR" },
372cdf0e10cSrcweir     { LANGUAGE_ALSATIAN_FRANCE,            "gsw", "FR" },   // in fact 'gsw' is Schwyzerduetsch (Swiss German), which is a dialect of Alemannic German, as is Alsatian. They aren't distinct languages and share this code.
373cdf0e10cSrcweir     { LANGUAGE_YAKUT_RUSSIA,               "sah", "RU" },
374cdf0e10cSrcweir     { LANGUAGE_MOHAWK_CANADA,              "moh", "CA" },
375cdf0e10cSrcweir     { LANGUAGE_BASHKIR_RUSSIA,              "ba", "RU" },
376cdf0e10cSrcweir     { LANGUAGE_KICHE_GUATEMALA,            "qut", "GT" },
377cdf0e10cSrcweir     { LANGUAGE_DARI_AFGHANISTAN,           "gbz", "AF" },
378cdf0e10cSrcweir     { LANGUAGE_WOLOF_SENEGAL,               "wo", "SN" },
379cdf0e10cSrcweir     { LANGUAGE_FILIPINO,                   "fil", "PH" },
380cdf0e10cSrcweir     { LANGUAGE_USER_TAGALOG,                "tl", "PH" },
381cdf0e10cSrcweir     { LANGUAGE_ENGLISH_PHILIPPINES,         "en", "PH" },
382cdf0e10cSrcweir //  { LANGUAGE_IBIBIO_NIGERIA,             "nic", "NG" },   // ISO "nic" is only a collective language code
383cdf0e10cSrcweir     { LANGUAGE_YI,                          "ii", "CN" },
384cdf0e10cSrcweir //  { LANGUAGE_TAMAZIGHT_LATIN,            "ber", ""   },   // ISO "ber" only collective!
385cdf0e10cSrcweir //  { LANGUAGE_TAMAZIGHT_ARABIC,           "ber", ""   },   // ISO "ber" only collective!
386cdf0e10cSrcweir     { LANGUAGE_LATIN,                       "la", "VA" },
387cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_LATIN,         "la", "VA" },
388cdf0e10cSrcweir     { LANGUAGE_USER_ESPERANTO,              "eo", ""   },
389cdf0e10cSrcweir     { LANGUAGE_USER_INTERLINGUA,            "ia", ""   },
390cdf0e10cSrcweir     { LANGUAGE_MAORI_NEW_ZEALAND,           "mi", "NZ" },
391cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_MAORI,         "mi", "NZ" },
392cdf0e10cSrcweir     { LANGUAGE_KINYARWANDA_RWANDA,          "rw", "RW" },
393cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_KINYARWANDA,   "rw", "RW" },
394cdf0e10cSrcweir     { LANGUAGE_UPPER_SORBIAN_GERMANY,      "hsb", "DE" },   // MS maps this to 'wen-DE', which is nonsense. 'wen' is a collective language code, 'WEN' is a SIL code, see http://www.ethnologue.com/14/show_iso639.asp?code=wen and http://www.ethnologue.com/14/show_language.asp?code=WEN
395cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN,"hsb", "DE" },
396cdf0e10cSrcweir     { LANGUAGE_LOWER_SORBIAN_GERMANY,      "dsb", "DE" },   // MS maps this to 'wee-DE', which is nonsense. 'WEE' is a SIL code, see http://www.ethnologue.com/14/show_language.asp?code=WEE
397cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN,"dsb", "DE" },
398cdf0e10cSrcweir     { LANGUAGE_OCCITAN_FRANCE,              "oc", "FR" },
399cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_OCCITAN,       "oc", "FR" },
400cdf0e10cSrcweir     { LANGUAGE_USER_KURDISH_TURKEY,         "ku", "TR" },
401cdf0e10cSrcweir     { LANGUAGE_USER_KURDISH_SYRIA,          "ku", "SY" },
402cdf0e10cSrcweir     { LANGUAGE_USER_KURDISH_IRAQ,           "ku", "IQ" },
403cdf0e10cSrcweir     { LANGUAGE_USER_KURDISH_IRAN,           "ku", "IR" },
404cdf0e10cSrcweir     { LANGUAGE_USER_SARDINIAN,              "sc", "IT" },   // macrolanguage code
405cdf0e10cSrcweir     { LANGUAGE_USER_SARDINIAN_CAMPIDANESE, "sro", "IT" },
406cdf0e10cSrcweir     { LANGUAGE_USER_SARDINIAN_GALLURESE,   "sdn", "IT" },
407cdf0e10cSrcweir     { LANGUAGE_USER_SARDINIAN_LOGUDORESE,  "src", "IT" },
408cdf0e10cSrcweir     { LANGUAGE_USER_SARDINIAN_SASSARESE,   "sdc", "IT" },
409cdf0e10cSrcweir     { LANGUAGE_BRETON_FRANCE,               "br", "FR" },
410cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_BRETON,        "br", "FR" },
411cdf0e10cSrcweir     { LANGUAGE_KALAALLISUT_GREENLAND,       "kl", "GL" },
412cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_KALAALLISUT,   "kl", "GL" },
413cdf0e10cSrcweir     { LANGUAGE_USER_SWAZI,                  "ss", "ZA" },
414cdf0e10cSrcweir     { LANGUAGE_USER_NDEBELE_SOUTH,          "nr", "ZA" },
415cdf0e10cSrcweir     { LANGUAGE_USER_TSWANA_BOTSWANA,        "tn", "BW" },
416cdf0e10cSrcweir     { LANGUAGE_USER_MOORE,                 "mos", "BF" },
417cdf0e10cSrcweir     { LANGUAGE_USER_BAMBARA,                "bm", "ML" },
418cdf0e10cSrcweir     { LANGUAGE_USER_AKAN,                   "ak", "GH" },
419cdf0e10cSrcweir     { LANGUAGE_LUXEMBOURGISH_LUXEMBOURG,    "lb", "LU" },
420cdf0e10cSrcweir     { LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH, "lb", "LU" },
421cdf0e10cSrcweir     { LANGUAGE_USER_FRIULIAN,              "fur", "IT" },
422cdf0e10cSrcweir     { LANGUAGE_USER_FIJIAN,                 "fj", "FJ" },
423cdf0e10cSrcweir     { LANGUAGE_USER_AFRIKAANS_NAMIBIA,      "af", "NA" },
424cdf0e10cSrcweir     { LANGUAGE_USER_ENGLISH_NAMIBIA,        "en", "NA" },
425cdf0e10cSrcweir     { LANGUAGE_USER_WALLOON,                "wa", "BE" },
426cdf0e10cSrcweir     { LANGUAGE_USER_COPTIC,                "cop", "EG" },
427cdf0e10cSrcweir     { LANGUAGE_USER_GASCON,                "gsc", "FR" },
428cdf0e10cSrcweir     { LANGUAGE_USER_GERMAN_BELGIUM,         "de", "BE" },
429cdf0e10cSrcweir     { LANGUAGE_USER_CHUVASH,                "cv", "RU" },
430cdf0e10cSrcweir     { LANGUAGE_USER_EWE_GHANA,              "ee", "GH" },
431cdf0e10cSrcweir     { LANGUAGE_USER_ENGLISH_GHANA,          "en", "GH" },
432cdf0e10cSrcweir     { LANGUAGE_USER_SANGO,                  "sg", "CF" },
433cdf0e10cSrcweir     { LANGUAGE_USER_GANDA,                  "lg", "UG" },
434cdf0e10cSrcweir     { LANGUAGE_USER_LINGALA_DRCONGO,        "ln", "CD" },
435cdf0e10cSrcweir     { LANGUAGE_USER_LOW_GERMAN,            "nds", "DE" },
436cdf0e10cSrcweir     { LANGUAGE_USER_HILIGAYNON,            "hil", "PH" },
437cdf0e10cSrcweir     { LANGUAGE_USER_NYANJA,                 "ny", "MW" },
438cdf0e10cSrcweir     { LANGUAGE_USER_KASHUBIAN,             "csb", "PL" },
439cdf0e10cSrcweir     { LANGUAGE_USER_SPANISH_CUBA,           "es", "CU" },
440cdf0e10cSrcweir     { LANGUAGE_USER_QUECHUA_NORTH_BOLIVIA, "qul", "BO" },
441cdf0e10cSrcweir     { LANGUAGE_USER_QUECHUA_SOUTH_BOLIVIA, "quh", "BO" },
442cdf0e10cSrcweir     { LANGUAGE_USER_BODO_INDIA,            "brx", "IN" },
443cdf0e10cSrcweir     { LANGUAGE_USER_DOGRI_INDIA,           "dgo", "IN" },
444cdf0e10cSrcweir     { LANGUAGE_USER_MAITHILI_INDIA,        "mai", "IN" },
445cdf0e10cSrcweir     { LANGUAGE_USER_SANTALI_INDIA,         "sat", "IN" },
446cdf0e10cSrcweir     { LANGUAGE_USER_TETUN,                 "tet", "ID" },
447cdf0e10cSrcweir     { LANGUAGE_USER_TETUN_TIMOR_LESTE,     "tet", "TL" },
448cdf0e10cSrcweir     { LANGUAGE_USER_TOK_PISIN,             "tpi", "PG" },
449cdf0e10cSrcweir     { LANGUAGE_USER_SHUSWAP,               "shs", "CA" },
450cdf0e10cSrcweir     { LANGUAGE_USER_ANCIENT_GREEK,         "grc", "GR" },
451cdf0e10cSrcweir     { LANGUAGE_USER_ASTURIAN,              "ast", "ES" },
452cdf0e10cSrcweir     { LANGUAGE_USER_LATGALIAN,             "ltg", "LV" },
453cdf0e10cSrcweir     { LANGUAGE_USER_MAORE,                 "swb", "YT" },
454cdf0e10cSrcweir     { LANGUAGE_USER_BUSHI,                 "buc", "YT" },
455cdf0e10cSrcweir     { LANGUAGE_USER_TAHITIAN,               "ty", "PF" },
456cdf0e10cSrcweir     { LANGUAGE_USER_MALAGASY_PLATEAU,      "plt", "MG" },
457cdf0e10cSrcweir     { LANGUAGE_USER_BAFIA,                 "ksf", "CM" },
458cdf0e10cSrcweir     { LANGUAGE_USER_GIKUYU,                 "ki", "KE" },
459cdf0e10cSrcweir     { LANGUAGE_USER_RUSYN_UKRAINE,         "rue", "UA" },
460cdf0e10cSrcweir     { LANGUAGE_USER_RUSYN_SLOVAKIA,        "rue", "SK" },
461cdf0e10cSrcweir     { LANGUAGE_USER_LIMBU,                 "lif", "NP" },
462cdf0e10cSrcweir     { LANGUAGE_USER_LOJBAN,                "jbo", ""   },
463cdf0e10cSrcweir     { LANGUAGE_USER_KABYLE,                "kab", "DZ" },
464cdf0e10cSrcweir     { LANGUAGE_USER_HAITIAN,                "ht", "HT" },
465cdf0e10cSrcweir     { LANGUAGE_FRENCH_HAITI,                "fr", "HT" },
466cdf0e10cSrcweir     { LANGUAGE_NONE,                       "zxx", ""   },   // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information
467cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                    "",   ""   }    // marks end of table
468cdf0e10cSrcweir };
469cdf0e10cSrcweir 
470cdf0e10cSrcweir static MsLangId::IsoLangEntry aLastResortFallbackEntry =
471cdf0e10cSrcweir { LANGUAGE_ENGLISH_US, "en", "US" };
472cdf0e10cSrcweir 
473cdf0e10cSrcweir // -----------------------------------------------------------------------
474cdf0e10cSrcweir 
475cdf0e10cSrcweir // In this table are the countries which should mapped to a specific
476cdf0e10cSrcweir // english language
477cdf0e10cSrcweir static IsoLangEngEntry const aImplIsoLangEngEntries[] =
478cdf0e10cSrcweir {
479cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "AO" },         // Angola
480cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "BJ" },         // Benin
481cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "BW" },         // Botswana
482cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "BI" },         // Burundi
483cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "CM" },         // Cameroon
484cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "GA" },         // Gabon
485cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "GM" },         // Gambia
486cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "GH" },         // Ghana
487cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "GN" },         // Guinea
488cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "LS" },         // Lesotho
489cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "MW" },         // Malawi
490cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "MT" },         // Malta
491cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "NA" },         // Namibia
492cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "NG" },         // Nigeria
493cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "UG" },         // Uganda
494cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "ZM" },         // Zambia
495cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "ZW" },         // Zimbabwe
496cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "SZ" },         // Swaziland
497cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "NG" },         // Sierra Leone
498cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "KN" },         // Saint Kitts and Nevis
499cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "SH" },         // St. Helena
500cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "IO" },         // British Indian Oceanic Territory
501cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "FK" },         // Falkland Islands
502cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "GI" },         // Gibraltar
503cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "KI" },         // Kiribati
504cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "VG" },         // Virgin Islands
505cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "MU" },         // Mauritius
506cdf0e10cSrcweir     { LANGUAGE_ENGLISH_UK,                  "FJ" },         // Fiji
507cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "KI" },         // Kiribati
508cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "LR" },         // Liberia
509cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "GU" },         // Guam
510cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "MH" },         // Marshall Islands
511cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "PW" },         // Palau
512cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "AI" },         // Anguilla
513cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "AG" },         // Antigua and Barbuda
514cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "BS" },         // Bahamas
515cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "BB" },         // Barbedos
516cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "BM" },         // Bermuda
517cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "KY" },         // Cayman Islands
518cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "GD" },         // Grenada
519cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "DM" },         // Dominica
520cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "HT" },         // Haiti
521cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "MS" },         // Montserrat
522cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "FM" },         // Micronesia
523cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "VC" },         // St. Vincent / Grenadines
524cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "LC" },         // Saint Lucia
525cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "TC" },         // Turks & Caicos Islands
526cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "GY" },         // Guyana
527cdf0e10cSrcweir     { LANGUAGE_ENGLISH_CARRIBEAN,           "TT" },         // Trinidad and Tobago
528cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "CX" },         // Christmas Islands
529cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "CC" },         // Cocos (Keeling) Islands
530cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "NF" },         // Norfolk Island
531cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "PG" },         // Papua New Guinea
532cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "SB" },         // Solomon Islands
533cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "TV" },         // Tuvalu
534cdf0e10cSrcweir     { LANGUAGE_ENGLISH_AUS,                 "NR" },         // Nauru
535cdf0e10cSrcweir     { LANGUAGE_ENGLISH_NZ,                  "CK" },         // Cook Islands
536cdf0e10cSrcweir     { LANGUAGE_ENGLISH_NZ,                  "NU" },         // Niue
537cdf0e10cSrcweir     { LANGUAGE_ENGLISH_NZ,                  "TK" },         // Tokelau
538cdf0e10cSrcweir     { LANGUAGE_ENGLISH_NZ,                  "TO" },         // Tonga
539cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                    ""   }          // marks end of table
540cdf0e10cSrcweir };
541cdf0e10cSrcweir 
542cdf0e10cSrcweir // -----------------------------------------------------------------------
543cdf0e10cSrcweir 
544cdf0e10cSrcweir static IsoLangNoneStdEntry const aImplIsoNoneStdLangEntries[] =
545cdf0e10cSrcweir {
546cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_BOKMAL,            "no", "BOK"      }, // registered subtags for "no" in rfc1766
547cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_NYNORSK,           "no", "NYN"      }, // registered subtags for "no" in rfc1766
548cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN,               "sr", "latin"    },
549cdf0e10cSrcweir     { LANGUAGE_SERBIAN_CYRILLIC,            "sr", "cyrillic" },
550cdf0e10cSrcweir     { LANGUAGE_AZERI_LATIN,                 "az", "latin"    },
551cdf0e10cSrcweir     { LANGUAGE_AZERI_CYRILLIC,              "az", "cyrillic" },
552cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                    "",   ""         }  // marks end of table
553cdf0e10cSrcweir };
554cdf0e10cSrcweir 
555cdf0e10cSrcweir // -----------------------------------------------------------------------
556cdf0e10cSrcweir 
557cdf0e10cSrcweir // in this table are only names to find the best language
558cdf0e10cSrcweir static IsoLangNoneStdEntry const aImplIsoNoneStdLangEntries2[] =
559cdf0e10cSrcweir {
560cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_BOKMAL,            "no", "bokmaal"  },
561cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_BOKMAL,            "no", "bokmal"   },
562cdf0e10cSrcweir     { LANGUAGE_NORWEGIAN_NYNORSK,           "no", "nynorsk"  },
563cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                    "",   ""         }  // marks end of table
564cdf0e10cSrcweir };
565cdf0e10cSrcweir 
566cdf0e10cSrcweir // -----------------------------------------------------------------------
567cdf0e10cSrcweir 
568cdf0e10cSrcweir // in this table are only names to find the best language
569cdf0e10cSrcweir static IsoLangOtherEntry const aImplOtherEntries[] =
570cdf0e10cSrcweir {
571cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "c"              },
572cdf0e10cSrcweir     { LANGUAGE_CHINESE,                     "chinese"        },
573cdf0e10cSrcweir     { LANGUAGE_GERMAN,                      "german"         },
574cdf0e10cSrcweir     { LANGUAGE_JAPANESE,                    "japanese"       },
575cdf0e10cSrcweir     { LANGUAGE_KOREAN,                      "korean"         },
576cdf0e10cSrcweir     { LANGUAGE_ENGLISH_US,                  "posix"          },
577cdf0e10cSrcweir     { LANGUAGE_CHINESE_TRADITIONAL,         "tchinese"       },
578cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                    NULL             }  // marks end of table
579cdf0e10cSrcweir };
580cdf0e10cSrcweir 
581cdf0e10cSrcweir // =======================================================================
582cdf0e10cSrcweir 
583cdf0e10cSrcweir // static
convertLanguageToIsoNames(LanguageType nLang,rtl::OUString & rLangStr,rtl::OUString & rCountry)584cdf0e10cSrcweir void MsLangId::convertLanguageToIsoNames( LanguageType nLang,
585cdf0e10cSrcweir         rtl::OUString& rLangStr, rtl::OUString& rCountry )
586cdf0e10cSrcweir {
587cdf0e10cSrcweir     if ( nLang == LANGUAGE_SYSTEM )
588cdf0e10cSrcweir         nLang = MsLangId::getSystemLanguage();
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     // Search for LangID (in this table we find only defined ISO combinations)
591cdf0e10cSrcweir     const IsoLangEntry* pEntry = aImplIsoLangEntries;
592cdf0e10cSrcweir     do
593cdf0e10cSrcweir     {
594cdf0e10cSrcweir         if ( pEntry->mnLang == nLang )
595cdf0e10cSrcweir         {
596cdf0e10cSrcweir             rLangStr = rtl::OUString::createFromAscii( pEntry->maLangStr );
597cdf0e10cSrcweir             rCountry = rtl::OUString::createFromAscii( pEntry->maCountry );
598cdf0e10cSrcweir             return;
599cdf0e10cSrcweir         }
600cdf0e10cSrcweir         ++pEntry;
601cdf0e10cSrcweir     }
602cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
603cdf0e10cSrcweir 
604cdf0e10cSrcweir     // Search for LangID if we didn't find a specific ISO combination.
605cdf0e10cSrcweir     // All entries in this table are allowed for mime specifications,
606cdf0e10cSrcweir     // but not defined ISO combinations.
607cdf0e10cSrcweir     const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
608cdf0e10cSrcweir     do
609cdf0e10cSrcweir     {
610cdf0e10cSrcweir         if ( pNoneStdEntry->mnLang == nLang )
611cdf0e10cSrcweir         {
612cdf0e10cSrcweir             rLangStr = rtl::OUString::createFromAscii( pNoneStdEntry->maLangStr );
613cdf0e10cSrcweir             rCountry = rtl::OUString::createFromAscii( pNoneStdEntry->maCountry );
614cdf0e10cSrcweir             return;
615cdf0e10cSrcweir         }
616cdf0e10cSrcweir         ++pNoneStdEntry;
617cdf0e10cSrcweir     }
618cdf0e10cSrcweir     while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     // not found
621cdf0e10cSrcweir     rLangStr = rtl::OUString();
622cdf0e10cSrcweir     rCountry = rtl::OUString();
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir // -----------------------------------------------------------------------
626cdf0e10cSrcweir 
627cdf0e10cSrcweir // static
convertLanguageToIsoNames(LanguageType nLang,rtl::OString & rLangStr,rtl::OString & rCountry)628cdf0e10cSrcweir void MsLangId::convertLanguageToIsoNames( LanguageType nLang,
629cdf0e10cSrcweir         rtl::OString& rLangStr, rtl::OString& rCountry )
630cdf0e10cSrcweir {
631cdf0e10cSrcweir     if ( nLang == LANGUAGE_SYSTEM )
632cdf0e10cSrcweir         nLang = MsLangId::getSystemLanguage();
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     // Search for LangID (in this table we find only defined ISO combinations)
635cdf0e10cSrcweir     const IsoLangEntry* pEntry = aImplIsoLangEntries;
636cdf0e10cSrcweir     do
637cdf0e10cSrcweir     {
638cdf0e10cSrcweir         if ( pEntry->mnLang == nLang )
639cdf0e10cSrcweir         {
640cdf0e10cSrcweir             rLangStr = rtl::OString( pEntry->maLangStr );
641cdf0e10cSrcweir             rCountry = rtl::OString( pEntry->maCountry );
642cdf0e10cSrcweir             return;
643cdf0e10cSrcweir         }
644cdf0e10cSrcweir         ++pEntry;
645cdf0e10cSrcweir     }
646cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
647cdf0e10cSrcweir 
648cdf0e10cSrcweir     // Search for LangID if we didn't find a specific ISO combination.
649cdf0e10cSrcweir     // All entries in this table are allowed for mime specifications,
650cdf0e10cSrcweir     // but not defined ISO combinations.
651cdf0e10cSrcweir     const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
652cdf0e10cSrcweir     do
653cdf0e10cSrcweir     {
654cdf0e10cSrcweir         if ( pNoneStdEntry->mnLang == nLang )
655cdf0e10cSrcweir         {
656cdf0e10cSrcweir             rLangStr = rtl::OString( pNoneStdEntry->maLangStr );
657cdf0e10cSrcweir             rCountry = rtl::OString( pNoneStdEntry->maCountry );
658cdf0e10cSrcweir             return;
659cdf0e10cSrcweir         }
660cdf0e10cSrcweir         ++pNoneStdEntry;
661cdf0e10cSrcweir     }
662cdf0e10cSrcweir     while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
663cdf0e10cSrcweir 
664cdf0e10cSrcweir     // not found
665cdf0e10cSrcweir     rLangStr = rtl::OString();
666cdf0e10cSrcweir     rCountry = rtl::OString();
667cdf0e10cSrcweir }
668cdf0e10cSrcweir 
669cdf0e10cSrcweir // -----------------------------------------------------------------------
670cdf0e10cSrcweir 
lcl_lookupFallbackEntry(LanguageType nLang)671cdf0e10cSrcweir static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry( LanguageType nLang )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir     LanguageType nPrimary = MsLangId::getPrimaryLanguage( nLang);
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     // Search for LangID and remember first lang-only.
676cdf0e10cSrcweir     const MsLangId::IsoLangEntry* pFirstPrimary = NULL;
677cdf0e10cSrcweir     const MsLangId::IsoLangEntry* pEntry = aImplIsoLangEntries;
678cdf0e10cSrcweir     do
679cdf0e10cSrcweir     {
680cdf0e10cSrcweir         if (pEntry->mnLang == nLang)
681cdf0e10cSrcweir         {
682cdf0e10cSrcweir             if (*pEntry->maCountry)
683cdf0e10cSrcweir                 return *pEntry;
684cdf0e10cSrcweir             switch (nLang)
685cdf0e10cSrcweir             {
686cdf0e10cSrcweir                 // These are known to have no country assigned.
687cdf0e10cSrcweir                 case LANGUAGE_BASQUE:
688cdf0e10cSrcweir                 case LANGUAGE_USER_ESPERANTO:
689cdf0e10cSrcweir                 case LANGUAGE_USER_INTERLINGUA:
690cdf0e10cSrcweir                 case LANGUAGE_USER_LOJBAN:
691cdf0e10cSrcweir                     return *pEntry;
692cdf0e10cSrcweir                 default:
693cdf0e10cSrcweir                     ;   // nothing
694cdf0e10cSrcweir             }
695cdf0e10cSrcweir         }
696cdf0e10cSrcweir         if (!pFirstPrimary &&
697cdf0e10cSrcweir                 MsLangId::getPrimaryLanguage( pEntry->mnLang) == nPrimary)
698cdf0e10cSrcweir             pFirstPrimary = pEntry;
699cdf0e10cSrcweir         ++pEntry;
700cdf0e10cSrcweir     }
701cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
702cdf0e10cSrcweir 
703cdf0e10cSrcweir     // Language not found at all => use default.
704cdf0e10cSrcweir     if (!pFirstPrimary)
705cdf0e10cSrcweir         return aLastResortFallbackEntry;
706cdf0e10cSrcweir 
707cdf0e10cSrcweir     // Search for first entry of primary language with any country.
708cdf0e10cSrcweir     pEntry = pFirstPrimary;
709cdf0e10cSrcweir     do
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         if (MsLangId::getPrimaryLanguage( pEntry->mnLang) == nLang)
712cdf0e10cSrcweir         {
713cdf0e10cSrcweir             if (*pEntry->maCountry)
714cdf0e10cSrcweir                 return *pEntry;
715cdf0e10cSrcweir         }
716cdf0e10cSrcweir         ++pEntry;
717cdf0e10cSrcweir     }
718cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
719cdf0e10cSrcweir 
720cdf0e10cSrcweir     return aLastResortFallbackEntry;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
723cdf0e10cSrcweir // static
lookupFallbackLanguage(LanguageType nLang)724cdf0e10cSrcweir LanguageType MsLangId::lookupFallbackLanguage( LanguageType nLang )
725cdf0e10cSrcweir {
726cdf0e10cSrcweir     return lcl_lookupFallbackEntry( nLang).mnLang;
727cdf0e10cSrcweir }
728cdf0e10cSrcweir 
729cdf0e10cSrcweir 
730cdf0e10cSrcweir // static
lookupFallbackLocale(LanguageType nLang)731cdf0e10cSrcweir ::com::sun::star::lang::Locale MsLangId::lookupFallbackLocale( LanguageType nLang )
732cdf0e10cSrcweir {
733cdf0e10cSrcweir     const MsLangId::IsoLangEntry& rEntry = lcl_lookupFallbackEntry( nLang);
734cdf0e10cSrcweir     return ::com::sun::star::lang::Locale(
735cdf0e10cSrcweir             rtl::OUString::createFromAscii( rEntry.maLangStr),
736cdf0e10cSrcweir             rtl::OUString::createFromAscii( rEntry.maCountry),
737cdf0e10cSrcweir             rtl::OUString());
738cdf0e10cSrcweir }
739cdf0e10cSrcweir 
740cdf0e10cSrcweir // -----------------------------------------------------------------------
741cdf0e10cSrcweir 
lcl_lookupFallbackEntry(const::com::sun::star::lang::Locale & rLocale)742cdf0e10cSrcweir static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry(
743cdf0e10cSrcweir         const ::com::sun::star::lang::Locale & rLocale )
744cdf0e10cSrcweir {
745cdf0e10cSrcweir     // language is lower case in table
746cdf0e10cSrcweir     rtl::OUString aLowerLang = rLocale.Language.toAsciiLowerCase();
747cdf0e10cSrcweir     // country is upper case in table
748cdf0e10cSrcweir     rtl::OUString aUpperCountry = rLocale.Country.toAsciiUpperCase();
749cdf0e10cSrcweir     sal_Int32 nCountryLen = aUpperCountry.getLength();
750cdf0e10cSrcweir 
751cdf0e10cSrcweir     // Search for locale and remember first lang-only.
752cdf0e10cSrcweir     const MsLangId::IsoLangEntry* pFirstLang = NULL;
753cdf0e10cSrcweir     const MsLangId::IsoLangEntry* pEntry = aImplIsoLangEntries;
754cdf0e10cSrcweir     do
755cdf0e10cSrcweir     {
756cdf0e10cSrcweir         if (aLowerLang.equalsAscii( pEntry->maLangStr))
757cdf0e10cSrcweir         {
758cdf0e10cSrcweir             if (*pEntry->maCountry)
759cdf0e10cSrcweir             {
760cdf0e10cSrcweir                 if (nCountryLen && aUpperCountry.equalsAscii( pEntry->maCountry))
761cdf0e10cSrcweir                     return *pEntry;
762cdf0e10cSrcweir             }
763cdf0e10cSrcweir             else
764cdf0e10cSrcweir             {
765cdf0e10cSrcweir                 switch (pEntry->mnLang)
766cdf0e10cSrcweir                 {
767cdf0e10cSrcweir                     // These are known to have no country assigned.
768cdf0e10cSrcweir                     case LANGUAGE_BASQUE:
769cdf0e10cSrcweir                     case LANGUAGE_USER_ESPERANTO:
770cdf0e10cSrcweir                     case LANGUAGE_USER_INTERLINGUA:
771cdf0e10cSrcweir                     case LANGUAGE_USER_LOJBAN:
772cdf0e10cSrcweir                         return *pEntry;
773cdf0e10cSrcweir                     default:
774cdf0e10cSrcweir                         ;   // nothing
775cdf0e10cSrcweir                 }
776cdf0e10cSrcweir             }
777cdf0e10cSrcweir             if (!pFirstLang)
778cdf0e10cSrcweir                 pFirstLang = pEntry;
779cdf0e10cSrcweir         }
780cdf0e10cSrcweir         ++pEntry;
781cdf0e10cSrcweir     }
782cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
783cdf0e10cSrcweir 
784cdf0e10cSrcweir     // Language not found at all => use default.
785cdf0e10cSrcweir     if (!pFirstLang)
786cdf0e10cSrcweir         return aLastResortFallbackEntry;
787cdf0e10cSrcweir 
788cdf0e10cSrcweir     // Search for first entry of language with any country.
789cdf0e10cSrcweir     pEntry = pFirstLang;
790cdf0e10cSrcweir     do
791cdf0e10cSrcweir     {
792cdf0e10cSrcweir         if (aLowerLang.equalsAscii( pEntry->maLangStr))
793cdf0e10cSrcweir         {
794cdf0e10cSrcweir             if (*pEntry->maCountry)
795cdf0e10cSrcweir                 return *pEntry;
796cdf0e10cSrcweir         }
797cdf0e10cSrcweir         ++pEntry;
798cdf0e10cSrcweir     }
799cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
800cdf0e10cSrcweir 
801cdf0e10cSrcweir     return aLastResortFallbackEntry;
802cdf0e10cSrcweir }
803cdf0e10cSrcweir 
804cdf0e10cSrcweir // static
lookupFallbackLanguage(const::com::sun::star::lang::Locale & rLocale)805cdf0e10cSrcweir LanguageType MsLangId::lookupFallbackLanguage(
806cdf0e10cSrcweir         const ::com::sun::star::lang::Locale & rLocale )
807cdf0e10cSrcweir {
808cdf0e10cSrcweir     return lcl_lookupFallbackEntry( rLocale).mnLang;
809cdf0e10cSrcweir }
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 
812cdf0e10cSrcweir // static
lookupFallbackLocale(const::com::sun::star::lang::Locale & rLocale)813cdf0e10cSrcweir ::com::sun::star::lang::Locale MsLangId::lookupFallbackLocale(
814cdf0e10cSrcweir         const ::com::sun::star::lang::Locale & rLocale )
815cdf0e10cSrcweir {
816cdf0e10cSrcweir     const MsLangId::IsoLangEntry& rEntry = lcl_lookupFallbackEntry( rLocale);
817cdf0e10cSrcweir     return ::com::sun::star::lang::Locale(
818cdf0e10cSrcweir             rtl::OUString::createFromAscii( rEntry.maLangStr),
819cdf0e10cSrcweir             rtl::OUString::createFromAscii( rEntry.maCountry),
820cdf0e10cSrcweir             rtl::OUString());
821cdf0e10cSrcweir }
822cdf0e10cSrcweir 
823cdf0e10cSrcweir // -----------------------------------------------------------------------
824cdf0e10cSrcweir 
825cdf0e10cSrcweir // static
convertLanguageToIsoString(LanguageType nLang,sal_Unicode cSep)826cdf0e10cSrcweir rtl::OUString MsLangId::convertLanguageToIsoString( LanguageType nLang,
827cdf0e10cSrcweir         sal_Unicode cSep )
828cdf0e10cSrcweir {
829cdf0e10cSrcweir     rtl::OUString   aLangStr;
830cdf0e10cSrcweir     rtl::OUString   aCountry;
831cdf0e10cSrcweir     convertLanguageToIsoNames( nLang, aLangStr, aCountry );
832cdf0e10cSrcweir     if ( aCountry.getLength() )
833cdf0e10cSrcweir     {
834cdf0e10cSrcweir         rtl::OUStringBuffer aBuf( aLangStr);
835cdf0e10cSrcweir         aBuf.append( cSep );
836cdf0e10cSrcweir         aBuf.append( aCountry );
837cdf0e10cSrcweir         return aBuf.makeStringAndClear();
838cdf0e10cSrcweir     }
839cdf0e10cSrcweir     else
840cdf0e10cSrcweir         return aLangStr;
841cdf0e10cSrcweir }
842cdf0e10cSrcweir 
843cdf0e10cSrcweir // -----------------------------------------------------------------------
844cdf0e10cSrcweir 
845cdf0e10cSrcweir // static
convertLanguageToIsoByteString(LanguageType nLang,sal_Char cSep)846cdf0e10cSrcweir rtl::OString MsLangId::convertLanguageToIsoByteString( LanguageType nLang,
847cdf0e10cSrcweir         sal_Char cSep )
848cdf0e10cSrcweir {
849cdf0e10cSrcweir     rtl::OString  aLangStr;
850cdf0e10cSrcweir     rtl::OString  aCountry;
851cdf0e10cSrcweir     convertLanguageToIsoNames( nLang, aLangStr, aCountry );
852cdf0e10cSrcweir     if ( aCountry.getLength() )
853cdf0e10cSrcweir     {
854cdf0e10cSrcweir         rtl::OStringBuffer aBuf( aLangStr);
855cdf0e10cSrcweir         aBuf.append( cSep );
856cdf0e10cSrcweir         aBuf.append( aCountry );
857cdf0e10cSrcweir         return aBuf.makeStringAndClear();
858cdf0e10cSrcweir     }
859cdf0e10cSrcweir     return aLangStr;
860cdf0e10cSrcweir }
861cdf0e10cSrcweir 
862cdf0e10cSrcweir // =======================================================================
863cdf0e10cSrcweir 
864cdf0e10cSrcweir // static
convertIsoNamesToLanguage(const rtl::OUString & rLang,const rtl::OUString & rCountry)865cdf0e10cSrcweir LanguageType MsLangId::convertIsoNamesToLanguage( const rtl::OUString& rLang,
866cdf0e10cSrcweir         const rtl::OUString& rCountry )
867cdf0e10cSrcweir {
868cdf0e10cSrcweir     // language is lower case in table
869cdf0e10cSrcweir     rtl::OUString aLowerLang = rLang.toAsciiLowerCase();
870cdf0e10cSrcweir     // country is upper case in table
871cdf0e10cSrcweir     rtl::OUString aUpperCountry = rCountry.toAsciiUpperCase();
872cdf0e10cSrcweir 
873cdf0e10cSrcweir     //  first look for exact match
874cdf0e10cSrcweir     const IsoLangEntry* pFirstLang = NULL;
875cdf0e10cSrcweir     const IsoLangEntry* pEntry = aImplIsoLangEntries;
876cdf0e10cSrcweir     do
877cdf0e10cSrcweir     {
878cdf0e10cSrcweir         if ( aLowerLang.equalsAscii( pEntry->maLangStr ) )
879cdf0e10cSrcweir         {
880cdf0e10cSrcweir             if ( !aUpperCountry.getLength() ||
881cdf0e10cSrcweir                  aUpperCountry.equalsAscii( pEntry->maCountry ) )
882cdf0e10cSrcweir                 return pEntry->mnLang;
883cdf0e10cSrcweir             if ( !pFirstLang )
884cdf0e10cSrcweir                 pFirstLang = pEntry;
885cdf0e10cSrcweir             else if ( !*pEntry->maCountry )
886cdf0e10cSrcweir                 pFirstLang = pEntry;
887cdf0e10cSrcweir         }
888cdf0e10cSrcweir         ++pEntry;
889cdf0e10cSrcweir     }
890cdf0e10cSrcweir     while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
891cdf0e10cSrcweir 
892cdf0e10cSrcweir     // some eng countries should be mapped to a specific english language
893cdf0e10cSrcweir     if ( aLowerLang.equalsAscii( "en" ) )
894cdf0e10cSrcweir     {
895cdf0e10cSrcweir         const IsoLangEngEntry* pEngEntry = aImplIsoLangEngEntries;
896cdf0e10cSrcweir         do
897cdf0e10cSrcweir         {
898cdf0e10cSrcweir             if ( aUpperCountry.equalsAscii( pEngEntry->maCountry ) )
899cdf0e10cSrcweir                 return pEngEntry->mnLang;
900cdf0e10cSrcweir             ++pEngEntry;
901cdf0e10cSrcweir         }
902cdf0e10cSrcweir         while ( pEngEntry->mnLang != LANGUAGE_DONTKNOW );
903cdf0e10cSrcweir     }
904cdf0e10cSrcweir 
905cdf0e10cSrcweir     // test for specific languages which are not used standard ISO 3166 codes
906cdf0e10cSrcweir     const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
907cdf0e10cSrcweir     do
908cdf0e10cSrcweir     {
909cdf0e10cSrcweir         if ( aLowerLang.equalsAscii( pNoneStdEntry->maLangStr ) )
910cdf0e10cSrcweir         {
911cdf0e10cSrcweir             // The countries in this table are not all in upper case
912cdf0e10cSrcweir             if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
913cdf0e10cSrcweir                 return pNoneStdEntry->mnLang;
914cdf0e10cSrcweir         }
915cdf0e10cSrcweir         ++pNoneStdEntry;
916cdf0e10cSrcweir     }
917cdf0e10cSrcweir     while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
918cdf0e10cSrcweir     pNoneStdEntry = aImplIsoNoneStdLangEntries2;
919cdf0e10cSrcweir     do
920cdf0e10cSrcweir     {
921cdf0e10cSrcweir         if ( aLowerLang.equalsAscii( pNoneStdEntry->maLangStr ) )
922cdf0e10cSrcweir         {
923cdf0e10cSrcweir             // The countries in this table are not all in upper case
924cdf0e10cSrcweir             if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
925cdf0e10cSrcweir                 return pNoneStdEntry->mnLang;
926cdf0e10cSrcweir         }
927cdf0e10cSrcweir         ++pNoneStdEntry;
928cdf0e10cSrcweir     }
929cdf0e10cSrcweir     while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
930cdf0e10cSrcweir 
931cdf0e10cSrcweir     // If the language is correct, than we return the default language
932cdf0e10cSrcweir     if ( pFirstLang )
933cdf0e10cSrcweir         return pFirstLang->mnLang;
934cdf0e10cSrcweir 
935cdf0e10cSrcweir     //  if only the country is set, look for any entry matching the country
936cdf0e10cSrcweir     //  (to allow reading country and language in separate steps, in any order)
937cdf0e10cSrcweir     if ( rCountry.getLength() && !rLang.getLength() )
938cdf0e10cSrcweir     {
939cdf0e10cSrcweir         const IsoLangEntry* pEntry2 = aImplIsoLangEntries;
940cdf0e10cSrcweir         do
941cdf0e10cSrcweir         {
942cdf0e10cSrcweir             if ( aUpperCountry.equalsAscii( pEntry2->maCountry ) )
943cdf0e10cSrcweir                 return pEntry2->mnLang;
944cdf0e10cSrcweir             ++pEntry2;
945cdf0e10cSrcweir         }
946cdf0e10cSrcweir         while ( pEntry2->mnLang != LANGUAGE_DONTKNOW );
947cdf0e10cSrcweir 
948cdf0e10cSrcweir         aLowerLang = aUpperCountry.toAsciiLowerCase();
949cdf0e10cSrcweir     }
950cdf0e10cSrcweir 
951cdf0e10cSrcweir     // Now look for all other definitions, which are not standard
952cdf0e10cSrcweir     const IsoLangOtherEntry* pOtherEntry = aImplOtherEntries;
953cdf0e10cSrcweir     do
954cdf0e10cSrcweir     {
955cdf0e10cSrcweir         if ( aLowerLang.equalsAscii( pOtherEntry->mpLangStr ) )
956cdf0e10cSrcweir             return pOtherEntry->mnLang;
957cdf0e10cSrcweir         ++pOtherEntry;
958cdf0e10cSrcweir     }
959cdf0e10cSrcweir     while ( pOtherEntry->mnLang != LANGUAGE_DONTKNOW );
960cdf0e10cSrcweir 
961cdf0e10cSrcweir     return LANGUAGE_DONTKNOW;
962cdf0e10cSrcweir }
963cdf0e10cSrcweir 
964cdf0e10cSrcweir // -----------------------------------------------------------------------
965cdf0e10cSrcweir 
966cdf0e10cSrcweir // static
convertIsoNamesToLanguage(const rtl::OString & rLang,const rtl::OString & rCountry)967cdf0e10cSrcweir LanguageType MsLangId::convertIsoNamesToLanguage( const rtl::OString& rLang,
968cdf0e10cSrcweir         const rtl::OString& rCountry )
969cdf0e10cSrcweir {
970cdf0e10cSrcweir     rtl::OUString aLang = OStringToOUString( rLang, RTL_TEXTENCODING_ASCII_US);
971cdf0e10cSrcweir     rtl::OUString aCountry = OStringToOUString( rCountry, RTL_TEXTENCODING_ASCII_US);
972cdf0e10cSrcweir     return convertIsoNamesToLanguage( aLang, aCountry);
973cdf0e10cSrcweir }
974cdf0e10cSrcweir 
975cdf0e10cSrcweir // -----------------------------------------------------------------------
976cdf0e10cSrcweir 
977cdf0e10cSrcweir // static
convertIsoStringToLanguage(const rtl::OUString & rString,sal_Unicode cSep)978cdf0e10cSrcweir LanguageType MsLangId::convertIsoStringToLanguage(
979cdf0e10cSrcweir         const rtl::OUString& rString, sal_Unicode cSep )
980cdf0e10cSrcweir {
981cdf0e10cSrcweir     rtl::OUString   aLang;
982cdf0e10cSrcweir     rtl::OUString   aCountry;
983cdf0e10cSrcweir     sal_Int32  nSepPos = rString.indexOf( cSep );
984cdf0e10cSrcweir     if ( nSepPos >= 0 )
985cdf0e10cSrcweir     {
986cdf0e10cSrcweir         aLang = rString.copy( 0, nSepPos );
987cdf0e10cSrcweir         aCountry = rString.copy( nSepPos+1 );
988cdf0e10cSrcweir     }
989cdf0e10cSrcweir     else
990cdf0e10cSrcweir         aLang = rString;
991cdf0e10cSrcweir 
992cdf0e10cSrcweir     return convertIsoNamesToLanguage( aLang, aCountry );
993cdf0e10cSrcweir }
994cdf0e10cSrcweir 
995cdf0e10cSrcweir // -----------------------------------------------------------------------
996cdf0e10cSrcweir 
997cdf0e10cSrcweir // static
convertIsoByteStringToLanguage(const rtl::OString & rString,sal_Char cSep)998cdf0e10cSrcweir LanguageType MsLangId::convertIsoByteStringToLanguage(
999cdf0e10cSrcweir         const rtl::OString& rString, sal_Char cSep )
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir     rtl::OString  aLang;
1002cdf0e10cSrcweir     rtl::OString  aCountry;
1003cdf0e10cSrcweir     sal_Int32  nSepPos = rString.indexOf( cSep );
1004cdf0e10cSrcweir     if ( nSepPos >= 0 )
1005cdf0e10cSrcweir     {
1006cdf0e10cSrcweir         aLang = rString.copy( 0, nSepPos );
1007cdf0e10cSrcweir         aCountry = rString.copy( nSepPos+1 );
1008cdf0e10cSrcweir     }
1009cdf0e10cSrcweir     else
1010cdf0e10cSrcweir         aLang = rString;
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir     return convertIsoNamesToLanguage( aLang, aCountry );
1013cdf0e10cSrcweir }
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir // -----------------------------------------------------------------------
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir struct IsoLangGLIBCModifiersEntry
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir     LanguageType  mnLang;
1020cdf0e10cSrcweir     sal_Char      maLangStr[4];
1021cdf0e10cSrcweir     sal_Char      maCountry[3];
1022cdf0e10cSrcweir     sal_Char      maAtString[9];
1023cdf0e10cSrcweir };
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir static IsoLangGLIBCModifiersEntry const aImplIsoLangGLIBCModifiersEntries[] =
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir     // MS-LANGID codes               ISO639-1/2/3 ISO3166            glibc modifier
1028cdf0e10cSrcweir     { LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "bs", "BA", "cyrillic" },
1029cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_LATIN_SERBIA,           "sr", "RS", "latin" },   // Serbian Latin in Serbia
1030cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN,                       "sr", "CS", "latin" },   // Serbian Latin in Serbia and Montenegro
1031cdf0e10cSrcweir     { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO,       "sr", "ME", "latin" },   // Serbian Latin in Montenegro
1032cdf0e10cSrcweir     { LANGUAGE_SERBIAN_LATIN_NEUTRAL,               "sr", "",   "latin" },
1033cdf0e10cSrcweir     { LANGUAGE_AZERI_CYRILLIC,                      "az", "AZ", "cyrillic" },
1034cdf0e10cSrcweir     { LANGUAGE_UZBEK_CYRILLIC,                      "uz", "UZ", "cyrillic" },
1035cdf0e10cSrcweir     { LANGUAGE_DONTKNOW,                            "",   "",   ""   }       // marks end of table
1036cdf0e10cSrcweir };
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir // convert a unix locale string into LanguageType
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir // static
convertUnxByteStringToLanguage(const rtl::OString & rString)1041cdf0e10cSrcweir LanguageType MsLangId::convertUnxByteStringToLanguage(
1042cdf0e10cSrcweir         const rtl::OString& rString )
1043cdf0e10cSrcweir {
1044cdf0e10cSrcweir     rtl::OString  aLang;
1045cdf0e10cSrcweir     rtl::OString  aCountry;
1046cdf0e10cSrcweir     rtl::OString  aAtString;
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir     sal_Int32  nLangSepPos    = rString.indexOf( (sal_Char)'_' );
1049cdf0e10cSrcweir     sal_Int32  nCountrySepPos = rString.indexOf( (sal_Char)'.' );
1050cdf0e10cSrcweir     sal_Int32  nAtPos         = rString.indexOf( (sal_Char)'@' );
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir     if (nCountrySepPos < 0)
1053cdf0e10cSrcweir         nCountrySepPos = nAtPos;
1054cdf0e10cSrcweir     if (nCountrySepPos < 0)
1055cdf0e10cSrcweir         nCountrySepPos = rString.getLength();
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir     if (nAtPos >= 0)
1058cdf0e10cSrcweir         aAtString = rString.copy( nAtPos+1 );
1059cdf0e10cSrcweir 
1060cdf0e10cSrcweir     if (   ((nLangSepPos >= 0) && (nLangSepPos > nCountrySepPos))
1061cdf0e10cSrcweir         || ((nLangSepPos < 0)) )
1062cdf0e10cSrcweir     {
1063cdf0e10cSrcweir         // eg. "el.sun_eu_greek", "tchinese", "es.ISO8859-15"
1064cdf0e10cSrcweir         aLang    = rString.copy( 0, nCountrySepPos );
1065cdf0e10cSrcweir     }
1066cdf0e10cSrcweir     else if ( nLangSepPos >= 0 )
1067cdf0e10cSrcweir     {
1068cdf0e10cSrcweir         // well formed iso names like "en_US.UTF-8", "sh_BA.ISO8859-2@bosnia"
1069cdf0e10cSrcweir         aLang    = rString.copy( 0, nLangSepPos );
1070cdf0e10cSrcweir         aCountry = rString.copy( nLangSepPos+1, nCountrySepPos - nLangSepPos - 1);
1071cdf0e10cSrcweir     }
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir     //  if there is a glibc modifier, first look for exact match in modifier table
1074cdf0e10cSrcweir     if (aAtString.getLength())
1075cdf0e10cSrcweir     {
1076cdf0e10cSrcweir         // language is lower case in table
1077cdf0e10cSrcweir         rtl::OString aLowerLang = aLang.toAsciiLowerCase();
1078cdf0e10cSrcweir         // country is upper case in table
1079cdf0e10cSrcweir         rtl::OString aUpperCountry = aCountry.toAsciiUpperCase();
1080cdf0e10cSrcweir         const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries;
1081cdf0e10cSrcweir         do
1082cdf0e10cSrcweir         {
1083cdf0e10cSrcweir             if (( aLowerLang.equals( pGLIBCModifiersEntry->maLangStr ) ) &&
1084cdf0e10cSrcweir                ( aAtString.equals( pGLIBCModifiersEntry->maAtString ) ))
1085cdf0e10cSrcweir             {
1086cdf0e10cSrcweir                 if ( !aUpperCountry.getLength() ||
1087cdf0e10cSrcweir                      aUpperCountry.equals( pGLIBCModifiersEntry->maCountry ) )
1088cdf0e10cSrcweir                {
1089cdf0e10cSrcweir                     return pGLIBCModifiersEntry->mnLang;
1090cdf0e10cSrcweir                }
1091cdf0e10cSrcweir             }
1092cdf0e10cSrcweir             ++pGLIBCModifiersEntry;
1093cdf0e10cSrcweir         }
1094cdf0e10cSrcweir         while ( pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW );
1095cdf0e10cSrcweir     }
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir     return convertIsoNamesToLanguage( aLang, aCountry );
1098cdf0e10cSrcweir }
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir // -----------------------------------------------------------------------
1101cdf0e10cSrcweir // pass one IsoLangEntry to the outer world of the resource compiler
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir // static
getIsoLangEntry(size_t nIndex)1104cdf0e10cSrcweir const MsLangId::IsoLangEntry* MsLangId::getIsoLangEntry( size_t nIndex )
1105cdf0e10cSrcweir {
1106cdf0e10cSrcweir     if (nIndex < sizeof( aImplIsoLangEntries) / sizeof( IsoLangEntry))
1107cdf0e10cSrcweir         return &aImplIsoLangEntries[ nIndex];
1108cdf0e10cSrcweir     return 0;
1109cdf0e10cSrcweir }
1110