Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / i18nlangtag / source / isolang / mslangid.cxx
blob291f312bf6ca79fa196651c0f0bb953961793120
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
21 #include <sal/log.hxx>
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/i18n/ScriptType.hpp>
25 #include <i18nlangtag/mslangid.hxx>
27 // Only very limited few functions that are guaranteed to not be called from
28 // LanguageTag may use LanguageTag ...
29 #include <i18nlangtag/languagetag.hxx>
32 LanguageType MsLangId::nConfiguredSystemLanguage = LANGUAGE_SYSTEM;
33 LanguageType MsLangId::nConfiguredSystemUILanguage = LANGUAGE_SYSTEM;
35 LanguageType MsLangId::nConfiguredWesternFallback = LANGUAGE_SYSTEM;
36 LanguageType MsLangId::nConfiguredAsianFallback = LANGUAGE_SYSTEM;
37 LanguageType MsLangId::nConfiguredComplexFallback = LANGUAGE_SYSTEM;
39 // static
40 void MsLangId::LanguageTagAccess::setConfiguredSystemLanguage( LanguageType nLang )
42 nConfiguredSystemLanguage = nLang;
46 // static
47 void MsLangId::setConfiguredSystemUILanguage( LanguageType nLang )
49 nConfiguredSystemUILanguage = nLang;
52 // static
53 void MsLangId::setConfiguredWesternFallback( LanguageType nLang )
55 nConfiguredWesternFallback = nLang;
58 // static
59 void MsLangId::setConfiguredAsianFallback( LanguageType nLang )
61 nConfiguredAsianFallback = nLang;
64 // static
65 void MsLangId::setConfiguredComplexFallback( LanguageType nLang )
67 nConfiguredComplexFallback = nLang;
70 // static
71 inline LanguageType MsLangId::simplifySystemLanguages( LanguageType nLang )
73 if (nLang.anyOf( LANGUAGE_PROCESS_OR_USER_DEFAULT,
74 LANGUAGE_SYSTEM_DEFAULT,
75 LANGUAGE_SYSTEM))
76 nLang = LANGUAGE_SYSTEM;
77 return nLang;
80 // static
81 LanguageType MsLangId::getRealLanguage( LanguageType nLang )
83 LanguageType simplifyLang = simplifySystemLanguages( nLang);
84 if (simplifyLang == LANGUAGE_SYSTEM )
85 nLang = getConfiguredSystemLanguage();
86 else if (simplifyLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE)
87 nLang = getConfiguredSystemUILanguage();
88 else
90 /* TODO: would this be useful here? */
91 //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
92 ; // nothing
94 if (nLang == LANGUAGE_DONTKNOW)
95 nLang = LANGUAGE_ENGLISH_US;
96 return nLang;
100 // static
101 LanguageType MsLangId::getConfiguredSystemLanguage()
103 if (nConfiguredSystemLanguage != LANGUAGE_SYSTEM)
104 return nConfiguredSystemLanguage;
105 SAL_WARN("i18nlangtag", "MsLangId::getConfiguredSystemLanguage() - not configured yet");
106 return getSystemLanguage();
110 // static
111 LanguageType MsLangId::getConfiguredSystemUILanguage()
113 if (nConfiguredSystemUILanguage != LANGUAGE_SYSTEM)
114 return nConfiguredSystemUILanguage;
115 SAL_WARN("i18nlangtag", "MsLangId::getConfiguredSystemUILanguage() - not configured yet");
116 return getSystemUILanguage();
120 // static
121 LanguageType MsLangId::getSystemLanguage()
123 return getPlatformSystemLanguage();
127 // static
128 LanguageType MsLangId::getSystemUILanguage()
130 return getPlatformSystemUILanguage();
134 // static
135 LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType )
137 if (nLang == LANGUAGE_NONE)
138 return nLang;
140 nLang = getRealLanguage(nLang);
141 if (nType != css::i18n::ScriptType::WEAK && getScriptType(nLang) != nType)
143 switch(nType)
145 case css::i18n::ScriptType::ASIAN:
146 if (nConfiguredAsianFallback == LANGUAGE_SYSTEM)
147 nLang = LANGUAGE_CHINESE_SIMPLIFIED;
148 else
149 nLang = nConfiguredAsianFallback;
150 break;
151 case css::i18n::ScriptType::COMPLEX:
152 if (nConfiguredComplexFallback == LANGUAGE_SYSTEM)
153 nLang = LANGUAGE_HINDI;
154 else
155 nLang = nConfiguredComplexFallback;
156 break;
157 default:
158 if (nConfiguredWesternFallback == LANGUAGE_SYSTEM)
159 nLang = LANGUAGE_ENGLISH_US;
160 else
161 nLang = nConfiguredWesternFallback;
162 break;
165 return nLang;
168 // static
169 bool MsLangId::usesHyphenation(LanguageType nLang)
171 if (primary(nLang).anyOf(
172 primary(LANGUAGE_ARABIC_PRIMARY_ONLY),
173 primary(LANGUAGE_FARSI),
174 primary(LANGUAGE_KASHMIRI),
175 primary(LANGUAGE_KURDISH_ARABIC_IRAQ),
176 primary(LANGUAGE_PUNJABI),
177 primary(LANGUAGE_SINDHI),
178 primary(LANGUAGE_USER_MALAY_ARABIC_MALAYSIA),
179 primary(LANGUAGE_SOMALI),
180 primary(LANGUAGE_SWAHILI),
181 primary(LANGUAGE_URDU_PAKISTAN),
182 primary(LANGUAGE_PASHTO),
183 primary(LANGUAGE_VIETNAMESE))
184 || isCJK(nLang))
186 return false;
188 return true;
192 // static
193 css::lang::Locale MsLangId::Conversion::convertLanguageToLocale(
194 LanguageType nLang, bool bIgnoreOverride )
196 css::lang::Locale aLocale;
197 // Still resolve LANGUAGE_DONTKNOW if resolving is not requested,
198 // but not LANGUAGE_SYSTEM or others.
199 LanguageType nOrigLang = nLang;
200 nLang = MsLangId::getRealLanguage(nLang);
201 convertLanguageToLocaleImpl( nLang, aLocale, bIgnoreOverride );
202 if (aLocale.Language.isEmpty() && simplifySystemLanguages(nOrigLang) == LANGUAGE_SYSTEM)
204 // None found but resolve requested, last resort is "en-US".
205 aLocale.Language = "en";
206 aLocale.Country = "US";
207 aLocale.Variant.clear();
209 return aLocale;
213 // static
214 LanguageType MsLangId::Conversion::convertLocaleToLanguage(
215 const css::lang::Locale& rLocale )
217 // empty language => LANGUAGE_SYSTEM
218 if (rLocale.Language.isEmpty())
219 return LANGUAGE_SYSTEM;
221 return convertLocaleToLanguageImpl( rLocale);
225 // static
226 css::lang::Locale MsLangId::getFallbackLocale(
227 const css::lang::Locale & rLocale )
229 // empty language => LANGUAGE_SYSTEM
230 if (rLocale.Language.isEmpty())
231 return Conversion::lookupFallbackLocale( Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM, false));
232 else
233 return Conversion::lookupFallbackLocale( rLocale);
236 // static
237 bool MsLangId::isRightToLeft( LanguageType nLang )
239 if (primary(nLang).anyOf(
240 primary(LANGUAGE_ARABIC_SAUDI_ARABIA),
241 primary(LANGUAGE_HEBREW),
242 primary(LANGUAGE_YIDDISH),
243 primary(LANGUAGE_URDU_PAKISTAN),
244 primary(LANGUAGE_FARSI),
245 primary(LANGUAGE_KASHMIRI),
246 primary(LANGUAGE_SINDHI),
247 primary(LANGUAGE_UIGHUR_CHINA),
248 primary(LANGUAGE_USER_KYRGYZ_CHINA),
249 primary(LANGUAGE_USER_NKO),
250 primary(LANGUAGE_USER_SARAIKI)))
252 return true;
254 if (nLang.anyOf(
255 LANGUAGE_USER_KURDISH_IRAN,
256 LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ,
257 LANGUAGE_KURDISH_ARABIC_IRAQ,
258 LANGUAGE_KURDISH_ARABIC_LSO,
259 LANGUAGE_USER_KURDISH_SOUTHERN_IRAN,
260 LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ,
261 LANGUAGE_USER_HUNGARIAN_ROVAS,
262 LANGUAGE_USER_MALAY_ARABIC_MALAYSIA,
263 LANGUAGE_USER_ROHINGYA_HANIFI,
264 LANGUAGE_USER_MALAY_ARABIC_BRUNEI))
266 return true;
268 if (LanguageTag::isOnTheFlyID(nLang))
269 return LanguageTag::getOnTheFlyScriptType(nLang) == LanguageTag::ScriptType::RTL;
270 return false;
273 // static
274 bool MsLangId::isRightToLeftMath( LanguageType nLang )
276 //http://www.w3.org/TR/arabic-math/
277 if (nLang == LANGUAGE_FARSI || nLang == LANGUAGE_ARABIC_MOROCCO)
278 return false;
279 return isRightToLeft(nLang);
282 // static
283 bool MsLangId::isSimplifiedChinese( LanguageType nLang )
285 return isChinese(nLang) && !isTraditionalChinese(nLang);
288 // static
289 bool MsLangId::isSimplifiedChinese( const css::lang::Locale & rLocale )
291 return rLocale.Language == "zh" && !isTraditionalChinese(rLocale);
294 // static
295 bool MsLangId::isTraditionalChinese( LanguageType nLang )
297 return nLang.anyOf(
298 LANGUAGE_CHINESE_TRADITIONAL,
299 LANGUAGE_CHINESE_HONGKONG,
300 LANGUAGE_CHINESE_MACAU);
303 // static
304 bool MsLangId::isTraditionalChinese( const css::lang::Locale & rLocale )
306 return rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO");
309 //static
310 bool MsLangId::isChinese( LanguageType nLang )
312 return MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_CHINESE) ||
313 MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_YUE_CHINESE_HONGKONG);
316 //static
317 bool MsLangId::isKorean( LanguageType nLang )
319 return MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_KOREAN);
322 // static
323 bool MsLangId::isCJK( LanguageType nLang )
325 if (primary(nLang).anyOf(
326 primary(LANGUAGE_CHINESE),
327 primary(LANGUAGE_YUE_CHINESE_HONGKONG),
328 primary(LANGUAGE_JAPANESE),
329 primary(LANGUAGE_KOREAN)))
331 return true;
333 if (LanguageTag::isOnTheFlyID(nLang))
334 return LanguageTag::getOnTheFlyScriptType(nLang) == LanguageTag::ScriptType::CJK;
335 return false;
338 // static
339 bool MsLangId::isFamilyNameFirst( LanguageType nLang )
341 return isCJK(nLang) || nLang == LANGUAGE_HUNGARIAN;
344 // static
345 bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
347 return isCJK(nLang);
351 // static
352 bool MsLangId::needsSequenceChecking( LanguageType nLang )
354 return primary(nLang).anyOf(
355 primary(LANGUAGE_BURMESE),
356 primary(LANGUAGE_KHMER),
357 primary(LANGUAGE_LAO),
358 primary(LANGUAGE_THAI))
359 || nLang.anyOf(
360 LANGUAGE_USER_PALI_THAI);
364 // static
365 sal_Int16 MsLangId::getScriptType( LanguageType nLang )
367 // single-element cache
368 static thread_local LanguageType nCachedLang = LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA;
369 static thread_local sal_Int16 nCachedScript = css::i18n::ScriptType::COMPLEX;
371 if (nCachedLang == nLang)
372 return nCachedScript;
374 sal_Int16 nScript;
376 // CTL
377 if( nLang == LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA
378 || nLang == LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA
379 || nLang == LANGUAGE_MONGOLIAN_MONGOLIAN_LSO
380 || nLang == LANGUAGE_USER_KURDISH_IRAN
381 || nLang == LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ
382 || nLang == LANGUAGE_KURDISH_ARABIC_IRAQ
383 || nLang == LANGUAGE_KURDISH_ARABIC_LSO
384 || nLang == LANGUAGE_USER_KURDISH_SOUTHERN_IRAN
385 || nLang == LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ
386 || nLang == LANGUAGE_USER_KYRGYZ_CHINA
387 || nLang == LANGUAGE_USER_HUNGARIAN_ROVAS
388 || nLang == LANGUAGE_USER_MANCHU
389 || nLang == LANGUAGE_USER_XIBE
390 || nLang == LANGUAGE_USER_MALAY_ARABIC_MALAYSIA
391 || nLang == LANGUAGE_USER_MALAY_ARABIC_BRUNEI
392 || nLang == LANGUAGE_USER_ROHINGYA_HANIFI
393 || nLang == LANGUAGE_USER_PALI_THAI)
395 nScript = css::i18n::ScriptType::COMPLEX;
397 // "Western"
398 else if ( nLang == LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA
399 || nLang == LANGUAGE_MONGOLIAN_CYRILLIC_LSO
400 || nLang == LANGUAGE_USER_KURDISH_SYRIA
401 || nLang == LANGUAGE_USER_KURDISH_TURKEY)
403 nScript = css::i18n::ScriptType::LATIN;
405 // CJK catcher
406 else if ( primary(nLang) == primary(LANGUAGE_CHINESE )
407 || primary(nLang) == primary(LANGUAGE_YUE_CHINESE_HONGKONG )
408 || primary(nLang) == primary(LANGUAGE_JAPANESE )
409 || primary(nLang) == primary(LANGUAGE_KOREAN )
412 nScript = css::i18n::ScriptType::ASIAN;
414 // CTL catcher
415 else if (auto p = primary(nLang);
416 p == primary(LANGUAGE_AMHARIC_ETHIOPIA )
417 || p == primary(LANGUAGE_ARABIC_SAUDI_ARABIA )
418 || p == primary(LANGUAGE_ASSAMESE )
419 || p == primary(LANGUAGE_BENGALI )
420 || p == primary(LANGUAGE_BURMESE )
421 || p == primary(LANGUAGE_DHIVEHI )
422 || p == primary(LANGUAGE_FARSI )
423 || p == primary(LANGUAGE_GUJARATI )
424 || p == primary(LANGUAGE_HEBREW )
425 || p == primary(LANGUAGE_HINDI )
426 || p == primary(LANGUAGE_KANNADA )
427 || p == primary(LANGUAGE_KASHMIRI )
428 || p == primary(LANGUAGE_KHMER )
429 || p == primary(LANGUAGE_KONKANI )
430 || p == primary(LANGUAGE_LAO )
431 || p == primary(LANGUAGE_MALAYALAM )
432 || p == primary(LANGUAGE_MANIPURI )
433 || p == primary(LANGUAGE_MARATHI )
434 || p == primary(LANGUAGE_NEPALI )
435 || p == primary(LANGUAGE_ODIA )
436 || p == primary(LANGUAGE_PUNJABI )
437 || p == primary(LANGUAGE_SANSKRIT )
438 || p == primary(LANGUAGE_SINDHI )
439 || p == primary(LANGUAGE_SINHALESE_SRI_LANKA )
440 || p == primary(LANGUAGE_SYRIAC )
441 || p == primary(LANGUAGE_TAMIL )
442 || p == primary(LANGUAGE_TELUGU )
443 || p == primary(LANGUAGE_THAI )
444 || p == primary(LANGUAGE_TIBETAN ) // also LANGUAGE_DZONGKHA
445 || p == primary(LANGUAGE_TIGRIGNA_ETHIOPIA )
446 || p == primary(LANGUAGE_UIGHUR_CHINA )
447 || p == primary(LANGUAGE_URDU_INDIA )
448 || p == primary(LANGUAGE_USER_BODO_INDIA )
449 || p == primary(LANGUAGE_USER_DOGRI_INDIA )
450 || p == primary(LANGUAGE_USER_LIMBU )
451 || p == primary(LANGUAGE_USER_MAITHILI_INDIA )
452 || p == primary(LANGUAGE_USER_NKO )
453 || p == primary(LANGUAGE_USER_SARAIKI )
454 || p == primary(LANGUAGE_YIDDISH ))
456 nScript = css::i18n::ScriptType::COMPLEX;
458 // Western (actually not necessarily Latin but also Cyrillic,
459 // for example)
460 else if (LanguageTag::isOnTheFlyID(nLang))
462 switch (LanguageTag::getOnTheFlyScriptType(nLang))
464 case LanguageTag::ScriptType::CJK :
465 nScript = css::i18n::ScriptType::ASIAN;
466 break;
467 case LanguageTag::ScriptType::CTL :
468 case LanguageTag::ScriptType::RTL :
469 nScript = css::i18n::ScriptType::COMPLEX;
470 break;
471 case LanguageTag::ScriptType::WESTERN :
472 case LanguageTag::ScriptType::UNKNOWN :
473 default:
474 nScript = css::i18n::ScriptType::LATIN;
475 break;
478 else
480 nScript = css::i18n::ScriptType::LATIN;
482 nCachedLang = nLang;
483 nCachedScript = nScript;
484 return nScript;
488 // static
489 bool MsLangId::isNonLatinWestern( LanguageType nLang )
491 if (nLang.anyOf(
492 LANGUAGE_AZERI_CYRILLIC,
493 LANGUAGE_AZERI_CYRILLIC_LSO,
494 LANGUAGE_BELARUSIAN,
495 LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
496 LANGUAGE_BOSNIAN_CYRILLIC_LSO,
497 LANGUAGE_BULGARIAN,
498 LANGUAGE_GREEK,
499 LANGUAGE_MONGOLIAN_CYRILLIC_LSO,
500 LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA,
501 LANGUAGE_RUSSIAN,
502 LANGUAGE_RUSSIAN_MOLDOVA,
503 LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
504 LANGUAGE_SERBIAN_CYRILLIC_LSO,
505 LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO,
506 LANGUAGE_SERBIAN_CYRILLIC_SAM,
507 LANGUAGE_SERBIAN_CYRILLIC_SERBIA,
508 LANGUAGE_UKRAINIAN,
509 LANGUAGE_UZBEK_CYRILLIC,
510 LANGUAGE_UZBEK_CYRILLIC_LSO))
512 return true;
514 if (getScriptType( nLang) != css::i18n::ScriptType::LATIN)
515 return false;
516 LanguageTag aLanguageTag( nLang);
517 if (aLanguageTag.hasScript())
518 return aLanguageTag.getScript() != "Latn";
519 return false;
523 // static
524 bool MsLangId::isLegacy( LanguageType nLang )
526 return nLang.anyOf(
527 LANGUAGE_SERBIAN_CYRILLIC_SAM,
528 LANGUAGE_SERBIAN_LATIN_SAM);
529 /* TODO: activate once dictionary was renamed from pap-AN to
530 * pap-CW, or the pap-CW one supports also pap-AN, see fdo#44112 */
531 //case LANGUAGE_PAPIAMENTU:
535 // static
536 LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang )
538 if (nLang == LANGUAGE_OBSOLETE_USER_LATIN)
539 nLang = LANGUAGE_LATIN;
540 else if (nLang == LANGUAGE_OBSOLETE_USER_LATIN_VATICAN)
541 nLang = LANGUAGE_LATIN;
542 else if (nLang == LANGUAGE_OBSOLETE_USER_MAORI)
543 nLang = LANGUAGE_MAORI_NEW_ZEALAND;
544 else if (nLang == LANGUAGE_OBSOLETE_USER_KINYARWANDA)
545 nLang = LANGUAGE_KINYARWANDA_RWANDA;
546 else if (nLang == LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN)
547 nLang = LANGUAGE_UPPER_SORBIAN_GERMANY;
548 else if (nLang == LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN)
549 nLang = LANGUAGE_LOWER_SORBIAN_GERMANY;
550 else if (nLang == LANGUAGE_OBSOLETE_USER_OCCITAN)
551 nLang = LANGUAGE_OCCITAN_FRANCE;
552 else if (nLang == LANGUAGE_OBSOLETE_USER_BRETON)
553 nLang = LANGUAGE_BRETON_FRANCE;
554 else if (nLang == LANGUAGE_OBSOLETE_USER_KALAALLISUT)
555 nLang = LANGUAGE_KALAALLISUT_GREENLAND;
556 else if (nLang == LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH)
557 nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG;
558 else if (nLang == LANGUAGE_OBSOLETE_USER_KABYLE)
559 nLang = LANGUAGE_TAMAZIGHT_LATIN_ALGERIA;
560 else if (nLang == LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN)
561 nLang = LANGUAGE_CATALAN_VALENCIAN;
562 else if (nLang == LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU)
563 nLang = LANGUAGE_MALAGASY_PLATEAU;
564 else if (nLang == LANGUAGE_GAELIC_SCOTLAND_LEGACY)
565 nLang = LANGUAGE_GAELIC_SCOTLAND;
566 else if (nLang == LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA)
567 nLang = LANGUAGE_TSWANA_BOTSWANA;
568 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA)
569 nLang = LANGUAGE_SERBIAN_LATIN_SERBIA;
570 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO)
571 nLang = LANGUAGE_SERBIAN_LATIN_MONTENEGRO;
572 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA)
573 nLang = LANGUAGE_SERBIAN_CYRILLIC_SERBIA;
574 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO)
575 nLang = LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO;
576 else if (nLang == LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ)
577 nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
578 else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_CUBA)
579 nLang = LANGUAGE_SPANISH_CUBA;
580 else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA)
581 nLang = LANGUAGE_SPANISH_LATIN_AMERICA;
583 // The following are not strictly obsolete but should be mapped to a
584 // replacement locale when encountered.
586 // no_NO is an alias for nb_NO
587 else if (nLang == LANGUAGE_NORWEGIAN)
588 nLang = LANGUAGE_NORWEGIAN_BOKMAL;
590 // The erroneous Tibetan vs. Dzongkha case, #i53497#
591 // We (and MS) have stored LANGUAGE_TIBETAN_BHUTAN. This will need
592 // special attention if MS one day decides to actually use
593 // LANGUAGE_TIBETAN_BHUTAN for bo-BT instead of having it reserved;
594 // then remove the mapping and hope every dz-BT user used ODF to store
595 // documents ;-)
596 else if (nLang == LANGUAGE_TIBETAN_BHUTAN)
597 nLang = LANGUAGE_DZONGKHA_BHUTAN;
599 // en-GB-oed is deprecated, use en-GB-oxendict instead.
600 else if (nLang == LANGUAGE_USER_ENGLISH_UK_OED)
601 nLang = LANGUAGE_USER_ENGLISH_UK_OXENDICT;
602 return nLang;
605 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */