Fix typo
[LibreOffice.git] / i18nlangtag / README.md
blob8bb608c24e623b157f8aec6c2428c16432e5aa4e
1 # Language Tags
3 Code for language tags, LanguageTag wrapper for liblangtag and converter between BCP47 language tags, Locale(Language,Country,Variant) and MS-LangIDs.
5 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!
9 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`:
11 * `include/i18nlangtag/lang.h`
12     * add the new `LANGUAGE_...` value as defined by MS, here `LANGUAGE_CATALAN_VALENCIAN`
13     * rename the `LANGUAGE_USER_...` definition to `LANGUAGE_OBSOLETE_USER_...`, here `LANGUAGE_USER_CATALAN_VALENCIAN` to `LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN`
14     * add a `#define LANGUAGE_USER_CATALAN_VALENCIAN LANGUAGE_CATALAN_VALENCIAN`
15         * 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
17 * `i18nlangtag/source/isolang/isolang.cxx`
18     * insert a mapping with `LANGUAGE_CATALAN_VALENCIAN` before (!) the existing `LANGUAGE_USER_CATALAN_VALENCIAN`
19     * rename the `LANGUAGE_USER_CATALAN_VALENCIAN` to `LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN`
20         * 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.
22 * `i18nlangtag/source/isolang/mslangid.cxx`
23     * add an entry to `MsLangId::getReplacementForObsoleteLanguage()` to convert `LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN` to `LANGUAGE_CATALAN_VALENCIAN`
26 When changing a (translation's) language tag (for example, `ca-XV` to `ca-valencia` or `sh` to `sr-Latn`):
28 * `solenv/inc/langlist.mk`
29     * replace the tag and sort alphabetically
31 * in `translations/source` do  `git mv old-tag new-tag`
32     * note that translations is a git submodule so <https://wiki.documentfoundation.org/Development/Submodules applies>
34 * `i18nlangtag/source/isolang/isolang.cxx`
35     * maintain the old tag's mapping entry in `aImplIsoLangEntries` to be able to read existing documents using that code
36     * add the new tag's mapping to `aImplBcp47CountryEntries` or `aImplIsoLangScriptEntries`
37     * change `mnOverride` from 0 to `kSAME` in `aImplIsoLangScriptEntries` or `aImplIsoLangEntries`
39 * `i18nlangtag/source/languagetag/languagetag.cxx`
40     * add the new tag's fallback strings to the fallback of the old tag in `LanguageTag::getFallbackStrings()`
42 * `i18nlangtag/qa/cppunit/test_languagetag.cxx`
43     * add a unit test for the new tag and old tag
45 * `l10ntools/source/ulfconv/msi-encodinglist.txt`
46     * replace the tag and sort alphabetically
48 * `setup_native/source/packinfo/spellchecker_selection.txt`
49     * replace the tag and sort alphabetically
51 If locale data exists:
53 * `i18npool/source/localedata/data/*.xml` for example `i18npool/source/localedata/data/sh_RS.xml`
54     * in the `<LC_INFO>` element
55         * change `<LangID>` to `qlt`
56         * after the `<Country>` element add a `<Variant>` element with the new full BCP 47 tag, for example `sr-Latn-RS`
57             * note that `<Variant>` has no `<VariantID>` or `<DefaultName>` child elements
58     * 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
59     * rename `sh_RS.xml` to `sr_Latn_RS.xml`, `git mv sh_RS.xml sr_Latn_RS.xml`
61 * `i18npool/source/localedata/localedata.cxx`
62     * in `aLibTable` change the entry from old `sh_RS` to new `sr_Latn_RS`, do not sort the table
64 * `i18npool/Library_localedata_*.mk`     for example `i18npool/Library_localedata_euro.mk`
65     * 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
67 If dictionary exists:
69 * `dictionaries/*/dictionaries.xcu`      for example `dictionaries/sr/dictionaries.xcu`
70     * change the affected `<node oor:name="...">` elements to something corresponding, for example `<node oor:name="HunSpellDic_sh" ...>` to `<node oor:name="HunSpellDic_sr_Latn" ...>`
71     * in the `Locales` properties change the `<value>` element, for example `<value>sh-RS</value>` to `<value>sr-Latn-RS</value>`
73 If dictionary is to be renamed, for example `ku-TR` to `kmr-Latn`:
75 * `dictionaries/*/*`                     for example `dictionaries/ku_TR/*`
76     * if appropriate rename `*.dic` and `*.aff` files, for example `ku_TR.dic` to `kmr_Latn.dic` and `ku_TR.aff` to `kmr_Latn.aff`
77 * `dictionaries/Dictionary_*.mk`         for example `dictionaries/Dictionary_ku_TR.mk`
78     * rename file, for example to `Dictionary_kmr_Latn.mk`
79     * 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!
80 * `dictionaries/Module_dictionaries.mk`
81     * change `Dictionary_*` (`Dictionary_ku-TR` to `Dictionary_kmr-Latn`) and sort alphabetically
82 * `scp2/source/ooo/common_brand.scp`
83     * `DosName = "dict-ku-TR";`
84         * change to `"dict-kmr-Latn"`
85 * `scp2/source/ooo/file_ooo.scp`
86     * File `gid_File_Extension_Dictionary_Ku_Tr`
87         * change to `gid_File_Extension_Dictionary_Kmr_Latn`
88     * `Name = "Dictionary/dict-ku-TR.filelist";`
89         * change to `"Dictionary/dict-kmr-Latn.filelist"`
90 * `scp2/source/ooo/module_ooo.scp`
91     * Module `gid_Module_Root_Extension_Dictionary_Ku_Tr`
92         * change to `gid_Module_Root_Extension_Dictionary_Kmr_Latn`
93     * `MOD_NAME_DESC` ( `MODULE_EXTENSION_DICTIONARY_KU_TR` );
94         * change to `MODULE_EXTENSION_DICTIONARY_KMR_LATN`
95     * `Files = (gid_File_Extension_Dictionary_Ku_Tr);`
96         * change to `gid_File_Extension_Dictionary_Kmr_Latn`
97     * `Spellcheckerlanguage = "ku-TR";`
98         * change to `"kmr-Latn"`
99 * `scp2/source/ooo/module_ooo.ulf`
100     * [`STR_NAME_MODULE_EXTENSION_DICTIONARY_KU_TR`]
101         * change to `STR_NAME_MODULE_EXTENSION_DICTIONARY_KMR_LATN`
102     * `en-US = "Kurdish (Turkey)"`
103         * change to `"Kurdish, Northern, Latin script"`
104     * [`STR_DESC_MODULE_EXTENSION_DICTIONARY_KU_TR`]
105         * change to `STR_DESC_MODULE_EXTENSION_DICTIONARY_KMR_LATN`
106     * `en-US = "Kurdish (Turkey)` spelling dictionary"
107         * change to `"Kurdish, Northern, Latin script spelling dictionary"`
108 * `setup_native/source/packinfo/packinfo_office.txt`
109     * `module = "gid_Module_Root_Extension_Dictionary_Ku_Tr"`
110         * change to `"gid_Module_Root_Extension_Dictionary_Kmr_Latn"`
111     * `solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"`
112         * change to `"...-dict-kmr-Latn"`
113     * `packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"`
114         * change to `"...-dict-kmr-Latn"`
115     * `description = "Ku-TR dictionary for %PRODUCTNAME %PRODUCTVERSION"`
116         * change to `"Kmr-Latn dictionary ..."`
118 If `extras` exist, for example `extras/source/autotext/*`:
120 * `extras/Package_autocorr.mk`
121     * replace `acor_*` entry, for example `acor_sh-RS.dat` to `acor_sr-Latn-RS.dat`, sort alphabetically
123 * `extras/CustomTarget_autocorr.mk`
124     * in `extras_AUTOCORR_LANGS change` map entry, for example `sh-RS:sh-RS` to `sr-Latn-RS:sr-Latn-Rs`
125     * in `extras_AUTOCORR_XMLFILES` change directory entries, for example `sh-RS/acor/DocumentList.xml` to `sr-Latn-RS/acor/DocumentList.xml`
127 * rename files accordingly, for example in `extras/source/autotext/lang/`  `git mv sh-RS sr-Latn-RS`
129 If `helpcontent` exists:
131 * `helpcontent2/source/auxiliary/*/*`       for example `helpcontent2/source/auxiliary/sh/*`
132     * change `Language=...`, for example `Language=sh` to `Language=sr-Latn` in `helpcontent2/source/auxiliary/sh/*.cfg`
133     * rename `helpcontent2/source/auxiliary/sh/`  `git mv sh sr-Latn`
135 For language packs:
137 * `scp2/source/ooo/module_langpack.ulf`
138 * `scp2/source/accessories/module_templates_accessories.ulf`
139 * `scp2/source/accessories/module_samples_accessories.ulf`
140 * `scp2/source/extensions/module_extensions_sun_templates.ulf`
142     * 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`