summaryrefslogtreecommitdiff
path: root/i18nlangtag/source/isolang/mslangid.cxx
blob: d44256de4117cd0bd8d727c092abb324e6144ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>

#include "i18nlangtag/mslangid.hxx"

// Only very limited few functions that are guaranteed to not be called from
// LanguageTag may use LanguageTag ...
#include "i18nlangtag/languagetag.hxx"


LanguageType MsLangId::nConfiguredSystemLanguage   = LANGUAGE_SYSTEM;
LanguageType MsLangId::nConfiguredSystemUILanguage = LANGUAGE_SYSTEM;

LanguageType MsLangId::nConfiguredWesternFallback  = LANGUAGE_SYSTEM;
LanguageType MsLangId::nConfiguredAsianFallback    = LANGUAGE_SYSTEM;
LanguageType MsLangId::nConfiguredComplexFallback  = LANGUAGE_SYSTEM;

// static
void MsLangId::setConfiguredSystemLanguage( LanguageType nLang )
{
    nConfiguredSystemLanguage = nLang;
}


// static
void MsLangId::setConfiguredSystemUILanguage( LanguageType nLang )
{
    nConfiguredSystemUILanguage = nLang;
}

// static
void MsLangId::setConfiguredWesternFallback( LanguageType nLang )
{
    nConfiguredWesternFallback = nLang;
}

// static
void MsLangId::setConfiguredAsianFallback( LanguageType nLang )
{
    nConfiguredAsianFallback = nLang;
}

// static
void MsLangId::setConfiguredComplexFallback( LanguageType nLang )
{
    nConfiguredComplexFallback = nLang;
}

// static
inline LanguageType MsLangId::simplifySystemLanguages( LanguageType nLang )
{
    switch (nLang)
    {
        case LANGUAGE_PROCESS_OR_USER_DEFAULT :
        case LANGUAGE_SYSTEM_DEFAULT :
        case LANGUAGE_SYSTEM :
            nLang = LANGUAGE_SYSTEM;
            break;
        default:
            ;   // nothing
    }
    return nLang;
}

// static
LanguageType MsLangId::getRealLanguage( LanguageType nLang )
{
    switch (simplifySystemLanguages( nLang))
    {
        case LANGUAGE_SYSTEM :
            if (nConfiguredSystemLanguage == LANGUAGE_SYSTEM)
                nLang = getSystemLanguage();
            else
                nLang = nConfiguredSystemLanguage;
            break;
        case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE :
            if (nConfiguredSystemUILanguage == LANGUAGE_SYSTEM)
                nLang = getSystemUILanguage();
            else
                nLang = nConfiguredSystemUILanguage;
            break;
        default:
            /* TODO: would this be useful here? */
            //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
            ;   // nothing
    }
    if (nLang == LANGUAGE_DONTKNOW)
        nLang = LANGUAGE_ENGLISH_US;
    return nLang;
}


// static
LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType )
{
    if (nLang == LANGUAGE_NONE)
        return nLang;

    nLang = getRealLanguage(nLang);
    if (nType != ::com::sun::star::i18n::ScriptType::WEAK && getScriptType(nLang) != nType)
    {
        switch(nType)
        {
            case ::com::sun::star::i18n::ScriptType::ASIAN:
                if (nConfiguredAsianFallback == LANGUAGE_SYSTEM)
                    nLang = LANGUAGE_CHINESE_SIMPLIFIED;
                else
                    nLang = nConfiguredAsianFallback;
                break;
            case ::com::sun::star::i18n::ScriptType::COMPLEX:
                if (nConfiguredComplexFallback == LANGUAGE_SYSTEM)
                    nLang = LANGUAGE_HINDI;
                else
                    nLang = nConfiguredComplexFallback;
                break;
            default:
                if (nConfiguredWesternFallback == LANGUAGE_SYSTEM)
                    nLang = LANGUAGE_ENGLISH_US;
                else
                    nLang = nConfiguredWesternFallback;
                break;
        }
    }
    return nLang;
}


// static
::com::sun::star::lang::Locale MsLangId::Conversion::convertLanguageToLocale(
        LanguageType nLang, bool bResolveSystem )
{
    ::com::sun::star::lang::Locale aLocale;
    if (!bResolveSystem && simplifySystemLanguages( nLang) == LANGUAGE_SYSTEM)
        ;   // nothing => empty locale
    else
    {
        // Still resolve LANGUAGE_DONTKNOW if resolving is not requested,
        // but not LANGUAGE_SYSTEM or others.
        LanguageType nOrigLang = nLang;
        if (bResolveSystem || nLang == LANGUAGE_DONTKNOW)
            nLang = MsLangId::getRealLanguage( nLang);
        convertLanguageToLocaleImpl( nLang, aLocale, true);
        if (bResolveSystem && aLocale.Language.isEmpty() && simplifySystemLanguages( nOrigLang) == LANGUAGE_SYSTEM)
        {
            // None found but resolve requested, last resort is "en-US".
            aLocale.Language = "en";
            aLocale.Country  = "US";
            aLocale.Variant  = OUString();
        }
    }
    return aLocale;
}


// static
LanguageType MsLangId::Conversion::convertLocaleToLanguage(
        const ::com::sun::star::lang::Locale& rLocale )
{
    // empty language => LANGUAGE_SYSTEM
    if (rLocale.Language.isEmpty())
        return LANGUAGE_SYSTEM;

    return convertLocaleToLanguageImpl( rLocale);
}


// static
::com::sun::star::lang::Locale MsLangId::getFallbackLocale(
            const ::com::sun::star::lang::Locale & rLocale )
{
    // empty language => LANGUAGE_SYSTEM
    if (rLocale.Language.isEmpty())
        return Conversion::lookupFallbackLocale( Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM, true));
    else
        return Conversion::lookupFallbackLocale( rLocale);
}

// static
bool MsLangId::isRightToLeft( LanguageType nLang )
{
    switch( nLang & LANGUAGE_MASK_PRIMARY )
    {
        case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_HEBREW              & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_YIDDISH             & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_URDU_PAKISTAN       & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_FARSI               & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_KASHMIRI            & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_SINDHI              & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_UIGHUR_CHINA        & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_USER_KYRGYZ_CHINA   & LANGUAGE_MASK_PRIMARY :
        case LANGUAGE_USER_NKO            & LANGUAGE_MASK_PRIMARY :
            return true;

        default:
            break;
    }
    switch (nLang)
    {
        case LANGUAGE_USER_KURDISH_IRAN:
        case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
        case LANGUAGE_KURDISH_ARABIC_IRAQ:
        case LANGUAGE_KURDISH_ARABIC_LSO:
        case LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ:
            return true;

        default:
            break;
    }
    return false;
}

// static
bool MsLangId::isSimplifiedChinese( LanguageType nLang )
{
    return isChinese(nLang) && !isTraditionalChinese(nLang);
}

// static
bool MsLangId::isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale )
{
    return rLocale.Language == "zh" && !isTraditionalChinese(rLocale);
}

// static
bool MsLangId::isTraditionalChinese( LanguageType nLang )
{
    bool bRet = false;
    switch (nLang)
    {
        case LANGUAGE_CHINESE_TRADITIONAL:
        case LANGUAGE_CHINESE_HONGKONG:
        case LANGUAGE_CHINESE_MACAU:
            bRet = true;
        default:
            break;
    }
    return bRet;
}

// static
bool MsLangId::isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale )
{
    return rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO");
}

//static
bool MsLangId::isChinese( LanguageType nLang )
{
    return MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_CHINESE) ||
        MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_YUE_CHINESE_HONGKONG);
}

//static
bool MsLangId::isKorean( LanguageType nLang )
{
    return MsLangId::getPrimaryLanguage(nLang) == MsLangId::getPrimaryLanguage(LANGUAGE_KOREAN);
}

// static
bool MsLangId::isCJK( LanguageType nLang )
{
    switch (nLang & LANGUAGE_MASK_PRIMARY)
    {
        case LANGUAGE_CHINESE              & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_YUE_CHINESE_HONGKONG & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_JAPANESE             & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_KOREAN               & LANGUAGE_MASK_PRIMARY:
            return true;
        default:
            break;
    }
    return false;
}

// static
bool MsLangId::isFamilyNameFirst( LanguageType nLang )
{
    return isCJK(nLang) || nLang == LANGUAGE_HUNGARIAN;
}

// static
bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
{
    return isCJK(nLang);
}


// static
bool MsLangId::needsSequenceChecking( LanguageType nLang )
{
    switch (nLang & LANGUAGE_MASK_PRIMARY)
    {
        case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_KHMER   & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_LAO     & LANGUAGE_MASK_PRIMARY:
        case LANGUAGE_THAI    & LANGUAGE_MASK_PRIMARY:
            return true;
        default:
            break;
    }
    return false;
}


// static
sal_Int16 MsLangId::getScriptType( LanguageType nLang )
{
    sal_Int16 nScript;
    switch( nLang )
    {
        // CTL
        case LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA:
        case LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA:
        case LANGUAGE_MONGOLIAN_MONGOLIAN_LSO:
        case LANGUAGE_USER_KURDISH_IRAN:
        case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
        case LANGUAGE_KURDISH_ARABIC_IRAQ:
        case LANGUAGE_KURDISH_ARABIC_LSO:
        case LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ:
        case LANGUAGE_USER_KYRGYZ_CHINA:
            nScript = ::com::sun::star::i18n::ScriptType::COMPLEX;
            break;

        // "Western"
        case LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA:
        case LANGUAGE_MONGOLIAN_CYRILLIC_LSO:
        case LANGUAGE_USER_KURDISH_SYRIA:
        case LANGUAGE_USER_KURDISH_TURKEY:
            nScript = ::com::sun::star::i18n::ScriptType::LATIN;
            break;

// currently not knowing scripttype - defaulted to LATIN:
/*
#define LANGUAGE_ARMENIAN                   0x042B
#define LANGUAGE_INDONESIAN                 0x0421
#define LANGUAGE_KAZAKH                     0x043F
#define LANGUAGE_KONKANI                    0x0457
#define LANGUAGE_MACEDONIAN                 0x042F
#define LANGUAGE_TATAR                      0x0444
*/

        default:
            switch ( nLang & LANGUAGE_MASK_PRIMARY )
            {
                // CJK catcher
                case LANGUAGE_CHINESE              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_YUE_CHINESE_HONGKONG & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_JAPANESE             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_KOREAN               & LANGUAGE_MASK_PRIMARY:
                    nScript = ::com::sun::star::i18n::ScriptType::ASIAN;
                    break;

                    // CTL catcher
                case LANGUAGE_AMHARIC_ETHIOPIA    & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_ASSAMESE            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_BENGALI             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_BURMESE             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_DHIVEHI             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_FARSI               & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_GUJARATI            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_HEBREW              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_HINDI               & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_KANNADA             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_KASHMIRI            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_KHMER               & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_LAO                 & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_MALAYALAM           & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_MANIPURI            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_MARATHI             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_NEPALI              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_ORIYA               & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_PUNJABI             & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_SANSKRIT            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_SINDHI              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_SINHALESE_SRI_LANKA & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_SYRIAC              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_TAMIL               & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_TELUGU              & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_THAI                & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_TIBETAN             & LANGUAGE_MASK_PRIMARY:  // also LANGUAGE_DZONGKHA
                case LANGUAGE_UIGHUR_CHINA        & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_URDU_INDIA          & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_USER_BODO_INDIA     & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_USER_DOGRI_INDIA    & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_USER_LIMBU          & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_USER_MAITHILI_INDIA & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_USER_NKO            & LANGUAGE_MASK_PRIMARY:
                case LANGUAGE_YIDDISH             & LANGUAGE_MASK_PRIMARY:
                    nScript = ::com::sun::star::i18n::ScriptType::COMPLEX;
                    break;

                // Western (actually not necessarily Latin but also Cyrillic,
                // for example)
                default:
                    nScript = ::com::sun::star::i18n::ScriptType::LATIN;
            }
            break;
    }
    return nScript;
}


// static
bool MsLangId::isNonLatinWestern( LanguageType nLang )
{
    switch (nLang)
    {
        case LANGUAGE_AZERI_CYRILLIC:
        case LANGUAGE_AZERI_CYRILLIC_LSO:
        case LANGUAGE_BELARUSIAN:
        case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
        case LANGUAGE_BOSNIAN_CYRILLIC_LSO:
        case LANGUAGE_BULGARIAN:
        case LANGUAGE_GREEK:
        case LANGUAGE_MONGOLIAN_CYRILLIC_LSO:
        case LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA:
        case LANGUAGE_RUSSIAN:
        case LANGUAGE_RUSSIAN_MOLDOVA:
        case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
        case LANGUAGE_SERBIAN_CYRILLIC_LSO:
        case LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO:
        case LANGUAGE_SERBIAN_CYRILLIC_SAM:
        case LANGUAGE_SERBIAN_CYRILLIC_SERBIA:
        case LANGUAGE_UKRAINIAN:
        case LANGUAGE_UZBEK_CYRILLIC:
        case LANGUAGE_UZBEK_CYRILLIC_LSO:
            return true;
        default:
            {
                if (getScriptType( nLang) != com::sun::star::i18n::ScriptType::LATIN)
                    return false;
                LanguageTag aLanguageTag( nLang);
                if (aLanguageTag.hasScript())
                    return aLanguageTag.getScript() != "Latn";
            }
    }
    return false;
}


// static
LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang, bool /*bUserInterfaceSelection*/ )
{
    switch (nLang)
    {
        default:
            break;  // nothing
        case LANGUAGE_OBSOLETE_USER_LATIN:
            nLang = LANGUAGE_USER_LATIN_VATICAN;
            break;
        case LANGUAGE_OBSOLETE_USER_MAORI:
            nLang = LANGUAGE_MAORI_NEW_ZEALAND;
            break;
        case LANGUAGE_OBSOLETE_USER_KINYARWANDA:
            nLang = LANGUAGE_KINYARWANDA_RWANDA;
            break;
        case LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN:
            nLang = LANGUAGE_UPPER_SORBIAN_GERMANY;
            break;
        case LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN:
            nLang = LANGUAGE_LOWER_SORBIAN_GERMANY;
            break;
        case LANGUAGE_OBSOLETE_USER_OCCITAN:
            nLang = LANGUAGE_OCCITAN_FRANCE;
            break;
        case LANGUAGE_OBSOLETE_USER_BRETON:
            nLang = LANGUAGE_BRETON_FRANCE;
            break;
        case LANGUAGE_OBSOLETE_USER_KALAALLISUT:
            nLang = LANGUAGE_KALAALLISUT_GREENLAND;
            break;
        case LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH:
            nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG;
            break;
        case LANGUAGE_OBSOLETE_USER_KABYLE:
            nLang = LANGUAGE_TAMAZIGHT_LATIN_ALGERIA;
            break;
        case LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN:
            nLang = LANGUAGE_CATALAN_VALENCIAN;
            break;
        case LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU:
            nLang = LANGUAGE_MALAGASY_PLATEAU;
            break;
        case LANGUAGE_GAELIC_SCOTLAND_LEGACY:
            nLang = LANGUAGE_GAELIC_SCOTLAND;
            break;
        case LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA:
            nLang = LANGUAGE_TSWANA_BOTSWANA;
            break;
        case LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA:
            nLang = LANGUAGE_SERBIAN_LATIN_SERBIA;
            break;
        case LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO:
            nLang = LANGUAGE_SERBIAN_LATIN_MONTENEGRO;
            break;
        case LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA:
            nLang = LANGUAGE_SERBIAN_CYRILLIC_SERBIA;
            break;
        case LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO:
            nLang = LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO;
            break;
        case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
            nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
            break;

        // The following are not strictly obsolete but should be mapped to a
        // replacement locale when encountered.

        // no_NO is an alias for nb_NO
        case LANGUAGE_NORWEGIAN:
            nLang = LANGUAGE_NORWEGIAN_BOKMAL;
            break;

        // #i94435# A Spanish variant that differs only in collation details we
        // do not support.
        case LANGUAGE_SPANISH_DATED:
            nLang = LANGUAGE_SPANISH_MODERN;
            break;
    }
    return nLang;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */