1 Code for language tags, LanguageTag wrapper for liblangtag and converter between BCP47 language tags, Locale(Language,Country,Variant) and MS-LangIDs.
3 Basic functionality used by almost every other module including comphelper, so even don't use that string helpers in this code to not create circular dependencies. Stick with sal and rtl!
7 If Microsoft introduced a new LCID for a locale that we previously defined as LANGUAGE_USER_..., for example LANGUAGE_CATALAN_VALENCIAN that we had as LANGUAGE_USER_CATALAN_VALENCIAN:
9 * include/i18nlangtag/lang.h
10 ** add the new LANGUAGE_... value as defined by MS, here LANGUAGE_CATALAN_VALENCIAN
11 ** rename the LANGUAGE_USER_... definition to LANGUAGE_OBSOLETE_USER_..., here LANGUAGE_USER_CATALAN_VALENCIAN to LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
12 ** add a #define LANGUAGE_USER_CATALAN_VALENCIAN LANGUAGE_CATALAN_VALENCIAN
13 *** so svtools/source/misc/langtab.src (where the defined name is an identifier) and other places using LANGUAGE_USER_CATALAN_VALENCIAN do not need to be changed
15 * i18nlangtag/source/isolang/isolang.cxx
16 ** insert a mapping with LANGUAGE_CATALAN_VALENCIAN before (!) the existing LANGUAGE_USER_CATALAN_VALENCIAN
17 ** rename the LANGUAGE_USER_CATALAN_VALENCIAN to LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
18 *** so converting the tag maps to the new LANGUAGE_CATALAN_VALENCIAN and converting the old LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN still maps to the tag.
20 * i18nlangtag/source/isolang/mslangid.cxx
21 ** add an entry to MsLangId::getReplacementForObsoleteLanguage() to convert LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN to LANGUAGE_CATALAN_VALENCIAN
25 When changing a (translation's) language tag (for example, 'ca-XV' to 'ca-valencia' or 'sh' to 'sr-Latn'):
27 * solenv/inc/langlist.mk
28 ** replace the tag and sort alphabetically
30 * in translations/source do git mv old-tag new-tag
31 ** note that translations is a git submodule so https://wiki.documentfoundation.org/Development/Submodules applies
33 * i18nlangtag/source/isolang/isolang.cxx
34 ** maintain the old tag's mapping entry in aImplIsoLangEntries to be able to read existing documents using that code
35 ** add the new tag's mapping to aImplBcp47CountryEntries or aImplIsoLangScriptEntries
36 ** change mnOverride from 0 to kSAME in aImplIsoLangScriptEntries or aImplIsoLangEntries
38 * i18nlangtag/source/languagetag/languagetag.cxx
39 ** add the new tag's fallback strings to the fallback of the old tag in LanguageTag::getFallbackStrings()
41 * i18nlangtag/qa/cppunit/test_languagetag.cxx
42 ** add a unit test for the new tag and old tag
44 * instsetoo_native/util/pack.lst
45 ** replace the tag in List_of_languages and sort alphabetically
47 * l10ntools/source/ulfconv/msi-encodinglist.txt
48 ** replace the tag and sort alphabetically
50 * setup_native/source/packinfo/spellchecker_selection.txt
51 ** replace the tag and sort alphabetically
53 If locale data exists:
55 * i18npool/source/localedata/data/*.xml for example i18npool/source/localedata/data/sh_RS.xml
56 ** in the <LC_INFO> element
57 *** change <LangID> to 'qlt'
58 *** after the <Country> element add a <Variant> element with the new full BCP 47 tag, for example 'sr-Latn-RS'
59 **** note that <Variant> has no <VariantID> or <DefaultName> child elements
60 ** if any of the other *.xml files reference the locale in a ref="..." attribute, change those too; note that these references use '_' underscore instead of '-' hyphen just like the file names do
61 ** rename sh_RS.xml to sr_Latn_RS.xml, git mv sh_RS.xml sr_Latn_RS.xml
63 * i18npool/source/localedata/localedata.cxx
64 ** in aLibTable change the entry from old "sh_RS" to new "sr_Latn_RS", do not sort the table
66 * i18npool/Library_localedata_*.mk for example i18npool/Library_localedata_euro.mk
67 ** change the entry for the changed .xml file, for example CustomTarget/i18npool/localedata/localedata_sh_RS to CustomTarget/i18npool/localedata/localedata_sr_Latn_RS, sort the list alphabetically
71 * dictionaries/*/dictionaries.xcu for example dictionaries/sr/dictionaries.xcu
72 ** change the affected <node oor:name="..."> elements to something corresponding, for example <node oor:name="HunSpellDic_sh" ...> to <node oor:name="HunSpellDic_sr_Latn" ...>
73 ** in the "Locales" properties change the <value> element, for example <value>sh-RS</value> to <value>sr-Latn-RS</value>
75 If dictionary is to be renamed, for example ku-TR to kmr-Latn:
77 * dictionaries/*/* for example dictionaries/ku_TR/*
78 ** if appropriate rename *.dic and *.aff files, for example ku_TR.dic to kmr_Latn.dic and ku_TR.aff to kmr_Latn.aff
79 * dictionaries/Dictionary_*.mk for example dictionaries/Dictionary_ku_TR.mk
80 ** rename file, for example to Dictionary_kmr_Latn.mk
81 ** change all locale dependent file names and target, for example *ku_TR* to *kmr_Latn* AND ku-TR to kmr-Latn; note '-' and '_' separators, both are used!
82 * dictionaries/Module_dictionaries.mk
83 ** change Dictionary_* (Dictionary_ku-TR to Dictionary_kmr-Latn) and sort alphabetically
84 * scp2/source/ooo/common_brand.scp
85 ** DosName = "dict-ku-TR";
86 *** change to "dict-kmr-Latn"
87 * scp2/source/ooo/file_ooo.scp
88 ** File gid_File_Extension_Dictionary_Ku_Tr
89 *** change to gid_File_Extension_Dictionary_Kmr_Latn
90 ** Name = "Dictionary/dict-ku-TR.filelist";
91 *** change to "Dictionary/dict-kmr-Latn.filelist"
92 * scp2/source/ooo/module_ooo.scp
93 ** Module gid_Module_Root_Extension_Dictionary_Ku_Tr
94 *** change to gid_Module_Root_Extension_Dictionary_Kmr_Latn
95 ** MOD_NAME_DESC ( MODULE_EXTENSION_DICTIONARY_KU_TR );
96 *** change to MODULE_EXTENSION_DICTIONARY_KMR_LATN
97 ** Files = (gid_File_Extension_Dictionary_Ku_Tr);
98 *** change to gid_File_Extension_Dictionary_Kmr_Latn
99 ** Spellcheckerlanguage = "ku-TR";
100 *** change to "kmr-Latn"
101 * scp2/source/ooo/module_ooo.ulf
102 ** [STR_NAME_MODULE_EXTENSION_DICTIONARY_KU_TR]
103 *** change to STR_NAME_MODULE_EXTENSION_DICTIONARY_KMR_LATN
104 ** en-US = "Kurdish (Turkey)"
105 *** change to "Kurdish, Northern, Latin script"
106 ** [STR_DESC_MODULE_EXTENSION_DICTIONARY_KU_TR]
107 *** change to STR_DESC_MODULE_EXTENSION_DICTIONARY_KMR_LATN
108 ** en-US = "Kurdish (Turkey) spelling dictionary"
109 *** change to "Kurdish, Northern, Latin script spelling dictionary"
110 * setup_native/source/packinfo/packinfo_office.txt
111 ** module = "gid_Module_Root_Extension_Dictionary_Ku_Tr"
112 *** change to "gid_Module_Root_Extension_Dictionary_Kmr_Latn"
113 ** solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"
114 *** change to "...-dict-kmr-Latn"
115 ** packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"
116 *** change to "...-dict-kmr-Latn"
117 ** description = "Ku-TR dictionary for %PRODUCTNAME %PRODUCTVERSION"
118 *** change to "Kmr-Latn dictionary ..."
120 If extras exist, for example extras/source/autotext/*:
122 * extras/Package_autocorr.mk
123 ** replace acor_* entry, for example acor_sh-RS.dat to acor_sr-Latn-RS.dat, sort alphabetically
125 * extras/CustomTarget_autocorr.mk
126 ** in extras_AUTOCORR_LANGS change map entry, for example sh-RS:sh-RS to sr-Latn-RS:sr-Latn-Rs
127 ** in extras_AUTOCORR_XMLFILES change directory entries, for example sh-RS/acor/DocumentList.xml to sr-Latn-RS/acor/DocumentList.xml
129 * rename files accordingly, for example in extras/source/autotext/lang/ git mv sh-RS sr-Latn-RS
131 If helpcontent exists:
133 * helpcontent2/source/auxiliary/*/* for example helpcontent2/source/auxiliary/sh/*
134 ** change Language=..., for example Language=sh to Language=sr-Latn in helpcontent2/source/auxiliary/sh/*.cfg
135 ** rename helpcontent2/source/auxiliary/sh/ git mv sh sr-Latn
139 * scp2/source/ooo/module_langpack.ulf
140 * scp2/source/accessories/module_templates_accessories.ulf
141 * scp2/source/accessories/module_samples_accessories.ulf
142 * scp2/source/extensions/module_extensions_sun_templates.ulf
144 ** If the upper-cased tag appears in any of these, replace it, for example STR_NAME_MODULE_LANGPACK_SH to STR_NAME_MODULE_LANGPACK_SR_LATN