Bump version to 24.04.3.4
[LibreOffice.git] / i18nlangtag / source / isolang / mslangid.cxx
blob4e0a5584a28da45ecdf62b276c122a54feb8bd24
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 (primary(nLang) == primary(LANGUAGE_AMHARIC_ETHIOPIA )
416 || primary(nLang) == primary(LANGUAGE_ARABIC_SAUDI_ARABIA )
417 || primary(nLang) == primary(LANGUAGE_ASSAMESE )
418 || primary(nLang) == primary(LANGUAGE_BENGALI )
419 || primary(nLang) == primary(LANGUAGE_BURMESE )
420 || primary(nLang) == primary(LANGUAGE_DHIVEHI )
421 || primary(nLang) == primary(LANGUAGE_FARSI )
422 || primary(nLang) == primary(LANGUAGE_GUJARATI )
423 || primary(nLang) == primary(LANGUAGE_HEBREW )
424 || primary(nLang) == primary(LANGUAGE_HINDI )
425 || primary(nLang) == primary(LANGUAGE_KANNADA )
426 || primary(nLang) == primary(LANGUAGE_KASHMIRI )
427 || primary(nLang) == primary(LANGUAGE_KHMER )
428 || primary(nLang) == primary(LANGUAGE_KONKANI )
429 || primary(nLang) == primary(LANGUAGE_LAO )
430 || primary(nLang) == primary(LANGUAGE_MALAYALAM )
431 || primary(nLang) == primary(LANGUAGE_MANIPURI )
432 || primary(nLang) == primary(LANGUAGE_MARATHI )
433 || primary(nLang) == primary(LANGUAGE_NEPALI )
434 || primary(nLang) == primary(LANGUAGE_ODIA )
435 || primary(nLang) == primary(LANGUAGE_PUNJABI )
436 || primary(nLang) == primary(LANGUAGE_SANSKRIT )
437 || primary(nLang) == primary(LANGUAGE_SINDHI )
438 || primary(nLang) == primary(LANGUAGE_SINHALESE_SRI_LANKA )
439 || primary(nLang) == primary(LANGUAGE_SYRIAC )
440 || primary(nLang) == primary(LANGUAGE_TAMIL )
441 || primary(nLang) == primary(LANGUAGE_TELUGU )
442 || primary(nLang) == primary(LANGUAGE_THAI )
443 || primary(nLang) == primary(LANGUAGE_TIBETAN ) // also LANGUAGE_DZONGKHA
444 || primary(nLang) == primary(LANGUAGE_TIGRIGNA_ETHIOPIA )
445 || primary(nLang) == primary(LANGUAGE_UIGHUR_CHINA )
446 || primary(nLang) == primary(LANGUAGE_URDU_INDIA )
447 || primary(nLang) == primary(LANGUAGE_USER_BODO_INDIA )
448 || primary(nLang) == primary(LANGUAGE_USER_DOGRI_INDIA )
449 || primary(nLang) == primary(LANGUAGE_USER_LIMBU )
450 || primary(nLang) == primary(LANGUAGE_USER_MAITHILI_INDIA )
451 || primary(nLang) == primary(LANGUAGE_USER_NKO )
452 || primary(nLang) == primary(LANGUAGE_USER_SARAIKI )
453 || primary(nLang) == primary(LANGUAGE_YIDDISH ))
455 nScript = css::i18n::ScriptType::COMPLEX;
457 // Western (actually not necessarily Latin but also Cyrillic,
458 // for example)
459 else if (LanguageTag::isOnTheFlyID(nLang))
461 switch (LanguageTag::getOnTheFlyScriptType(nLang))
463 case LanguageTag::ScriptType::CJK :
464 nScript = css::i18n::ScriptType::ASIAN;
465 break;
466 case LanguageTag::ScriptType::CTL :
467 case LanguageTag::ScriptType::RTL :
468 nScript = css::i18n::ScriptType::COMPLEX;
469 break;
470 case LanguageTag::ScriptType::WESTERN :
471 case LanguageTag::ScriptType::UNKNOWN :
472 default:
473 nScript = css::i18n::ScriptType::LATIN;
474 break;
477 else
479 nScript = css::i18n::ScriptType::LATIN;
481 nCachedLang = nLang;
482 nCachedScript = nScript;
483 return nScript;
487 // static
488 bool MsLangId::isNonLatinWestern( LanguageType nLang )
490 if (nLang.anyOf(
491 LANGUAGE_AZERI_CYRILLIC,
492 LANGUAGE_AZERI_CYRILLIC_LSO,
493 LANGUAGE_BELARUSIAN,
494 LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
495 LANGUAGE_BOSNIAN_CYRILLIC_LSO,
496 LANGUAGE_BULGARIAN,
497 LANGUAGE_GREEK,
498 LANGUAGE_MONGOLIAN_CYRILLIC_LSO,
499 LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA,
500 LANGUAGE_RUSSIAN,
501 LANGUAGE_RUSSIAN_MOLDOVA,
502 LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
503 LANGUAGE_SERBIAN_CYRILLIC_LSO,
504 LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO,
505 LANGUAGE_SERBIAN_CYRILLIC_SAM,
506 LANGUAGE_SERBIAN_CYRILLIC_SERBIA,
507 LANGUAGE_UKRAINIAN,
508 LANGUAGE_UZBEK_CYRILLIC,
509 LANGUAGE_UZBEK_CYRILLIC_LSO))
511 return true;
513 if (getScriptType( nLang) != css::i18n::ScriptType::LATIN)
514 return false;
515 LanguageTag aLanguageTag( nLang);
516 if (aLanguageTag.hasScript())
517 return aLanguageTag.getScript() != "Latn";
518 return false;
522 // static
523 bool MsLangId::isLegacy( LanguageType nLang )
525 return nLang.anyOf(
526 LANGUAGE_SERBIAN_CYRILLIC_SAM,
527 LANGUAGE_SERBIAN_LATIN_SAM);
528 /* TODO: activate once dictionary was renamed from pap-AN to
529 * pap-CW, or the pap-CW one supports also pap-AN, see fdo#44112 */
530 //case LANGUAGE_PAPIAMENTU:
534 // static
535 LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang )
537 if (nLang == LANGUAGE_OBSOLETE_USER_LATIN)
538 nLang = LANGUAGE_LATIN;
539 else if (nLang == LANGUAGE_OBSOLETE_USER_LATIN_VATICAN)
540 nLang = LANGUAGE_LATIN;
541 else if (nLang == LANGUAGE_OBSOLETE_USER_MAORI)
542 nLang = LANGUAGE_MAORI_NEW_ZEALAND;
543 else if (nLang == LANGUAGE_OBSOLETE_USER_KINYARWANDA)
544 nLang = LANGUAGE_KINYARWANDA_RWANDA;
545 else if (nLang == LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN)
546 nLang = LANGUAGE_UPPER_SORBIAN_GERMANY;
547 else if (nLang == LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN)
548 nLang = LANGUAGE_LOWER_SORBIAN_GERMANY;
549 else if (nLang == LANGUAGE_OBSOLETE_USER_OCCITAN)
550 nLang = LANGUAGE_OCCITAN_FRANCE;
551 else if (nLang == LANGUAGE_OBSOLETE_USER_BRETON)
552 nLang = LANGUAGE_BRETON_FRANCE;
553 else if (nLang == LANGUAGE_OBSOLETE_USER_KALAALLISUT)
554 nLang = LANGUAGE_KALAALLISUT_GREENLAND;
555 else if (nLang == LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH)
556 nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG;
557 else if (nLang == LANGUAGE_OBSOLETE_USER_KABYLE)
558 nLang = LANGUAGE_TAMAZIGHT_LATIN_ALGERIA;
559 else if (nLang == LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN)
560 nLang = LANGUAGE_CATALAN_VALENCIAN;
561 else if (nLang == LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU)
562 nLang = LANGUAGE_MALAGASY_PLATEAU;
563 else if (nLang == LANGUAGE_GAELIC_SCOTLAND_LEGACY)
564 nLang = LANGUAGE_GAELIC_SCOTLAND;
565 else if (nLang == LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA)
566 nLang = LANGUAGE_TSWANA_BOTSWANA;
567 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA)
568 nLang = LANGUAGE_SERBIAN_LATIN_SERBIA;
569 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO)
570 nLang = LANGUAGE_SERBIAN_LATIN_MONTENEGRO;
571 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA)
572 nLang = LANGUAGE_SERBIAN_CYRILLIC_SERBIA;
573 else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO)
574 nLang = LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO;
575 else if (nLang == LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ)
576 nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
577 else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_CUBA)
578 nLang = LANGUAGE_SPANISH_CUBA;
579 else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA)
580 nLang = LANGUAGE_SPANISH_LATIN_AMERICA;
582 // The following are not strictly obsolete but should be mapped to a
583 // replacement locale when encountered.
585 // no_NO is an alias for nb_NO
586 else if (nLang == LANGUAGE_NORWEGIAN)
587 nLang = LANGUAGE_NORWEGIAN_BOKMAL;
589 // The erroneous Tibetan vs. Dzongkha case, #i53497#
590 // We (and MS) have stored LANGUAGE_TIBETAN_BHUTAN. This will need
591 // special attention if MS one day decides to actually use
592 // LANGUAGE_TIBETAN_BHUTAN for bo-BT instead of having it reserved;
593 // then remove the mapping and hope every dz-BT user used ODF to store
594 // documents ;-)
595 else if (nLang == LANGUAGE_TIBETAN_BHUTAN)
596 nLang = LANGUAGE_DZONGKHA_BHUTAN;
598 // en-GB-oed is deprecated, use en-GB-oxendict instead.
599 else if (nLang == LANGUAGE_USER_ENGLISH_UK_OED)
600 nLang = LANGUAGE_USER_ENGLISH_UK_OXENDICT;
601 return nLang;
604 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */