ad1557f5d7
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> |
||
---|---|---|
.. | ||
qa/cppunit | ||
source | ||
CppunitTest_i18nlangtag_test_languagetag.mk | ||
IwyuFilter_i18nlangtag.yaml | ||
Library_i18nlangtag.mk | ||
Makefile | ||
Module_i18nlangtag.mk | ||
README.md |
Language Tags
Code for language tags, LanguageTag wrapper for liblangtag and converter between BCP47 language tags, Locale(Language,Country,Variant) and MS-LangIDs.
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!
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
:
-
include/i18nlangtag/lang.h
- add the new
LANGUAGE_...
value as defined by MS, hereLANGUAGE_CATALAN_VALENCIAN
- rename the
LANGUAGE_USER_...
definition toLANGUAGE_OBSOLETE_USER_...
, hereLANGUAGE_USER_CATALAN_VALENCIAN
toLANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
- add a
#define LANGUAGE_USER_CATALAN_VALENCIAN LANGUAGE_CATALAN_VALENCIAN
- so
svtools/source/misc/langtab.src
(where the defined name is an identifier) and other places usingLANGUAGE_USER_CATALAN_VALENCIAN
do not need to be changed
- so
- add the new
-
i18nlangtag/source/isolang/isolang.cxx
- insert a mapping with
LANGUAGE_CATALAN_VALENCIAN
before (!) the existingLANGUAGE_USER_CATALAN_VALENCIAN
- rename the
LANGUAGE_USER_CATALAN_VALENCIAN
toLANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
- so converting the tag maps to the new
LANGUAGE_CATALAN_VALENCIAN
and converting the oldLANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
still maps to the tag.
- so converting the tag maps to the new
- insert a mapping with
-
i18nlangtag/source/isolang/mslangid.cxx
- add an entry to
MsLangId::getReplacementForObsoleteLanguage()
to convertLANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN
toLANGUAGE_CATALAN_VALENCIAN
- add an entry to
When changing a (translation's) language tag (for example, ca-XV
to ca-valencia
or sh
to sr-Latn
):
-
solenv/inc/langlist.mk
- replace the tag and sort alphabetically
-
in
translations/source
dogit mv old-tag new-tag
- note that translations is a git submodule so <https://wiki.documentfoundation.org/Development/Submodules applies>
-
i18nlangtag/source/isolang/isolang.cxx
- maintain the old tag's mapping entry in
aImplIsoLangEntries
to be able to read existing documents using that code - add the new tag's mapping to
aImplBcp47CountryEntries
oraImplIsoLangScriptEntries
- change
mnOverride
from 0 tokSAME
inaImplIsoLangScriptEntries
oraImplIsoLangEntries
- maintain the old tag's mapping entry in
-
i18nlangtag/source/languagetag/languagetag.cxx
- add the new tag's fallback strings to the fallback of the old tag in
LanguageTag::getFallbackStrings()
- add the new tag's fallback strings to the fallback of the old tag in
-
i18nlangtag/qa/cppunit/test_languagetag.cxx
- add a unit test for the new tag and old tag
-
l10ntools/source/ulfconv/msi-encodinglist.txt
- replace the tag and sort alphabetically
-
setup_native/source/packinfo/spellchecker_selection.txt
- replace the tag and sort alphabetically
If locale data exists:
-
i18npool/source/localedata/data/*.xml
for examplei18npool/source/localedata/data/sh_RS.xml
- in the
<LC_INFO>
element- change
<LangID>
toqlt
- after the
<Country>
element add a<Variant>
element with the new full BCP 47 tag, for examplesr-Latn-RS
- note that
<Variant>
has no<VariantID>
or<DefaultName>
child elements
- note that
- change
- if any of the other
*.xml
files reference the locale in aref="..."
attribute, change those too; note that these references use '_
' underscore instead of '-
' hyphen just like the file names do - rename
sh_RS.xml
tosr_Latn_RS.xml
,git mv sh_RS.xml sr_Latn_RS.xml
- in the
-
i18npool/source/localedata/localedata.cxx
- in
aLibTable
change the entry from oldsh_RS
to newsr_Latn_RS
, do not sort the table
- in
-
i18npool/Library_localedata_*.mk
for examplei18npool/Library_localedata_euro.mk
- change the entry for the changed
.xml
file, for exampleCustomTarget/i18npool/localedata/localedata_sh_RS
toCustomTarget/i18npool/localedata/localedata_sr_Latn_RS
, sort the list alphabetically
- change the entry for the changed
If dictionary exists:
dictionaries/*/dictionaries.xcu
for exampledictionaries/sr/dictionaries.xcu
- change the affected
<node oor:name="...">
elements to something corresponding, for example<node oor:name="HunSpellDic_sh" ...>
to<node oor:name="HunSpellDic_sr_Latn" ...>
- in the
Locales
properties change the<value>
element, for example<value>sh-RS</value>
to<value>sr-Latn-RS</value>
- change the affected
If dictionary is to be renamed, for example ku-TR
to kmr-Latn
:
dictionaries/*/*
for exampledictionaries/ku_TR/*
- if appropriate rename
*.dic
and*.aff
files, for exampleku_TR.dic
tokmr_Latn.dic
andku_TR.aff
tokmr_Latn.aff
- if appropriate rename
dictionaries/Dictionary_*.mk
for exampledictionaries/Dictionary_ku_TR.mk
- rename file, for example to
Dictionary_kmr_Latn.mk
- change all locale dependent file names and target, for example
ku_TR
tokmr_Latn
ANDku-TR
tokmr-Latn
; note '-
' and '_
' separators, both are used!
- rename file, for example to
dictionaries/Module_dictionaries.mk
- change
Dictionary_*
(Dictionary_ku-TR
toDictionary_kmr-Latn
) and sort alphabetically
- change
scp2/source/ooo/common_brand.scp
DosName = "dict-ku-TR";
- change to
"dict-kmr-Latn"
- change to
scp2/source/ooo/file_ooo.scp
- File
gid_File_Extension_Dictionary_Ku_Tr
- change to
gid_File_Extension_Dictionary_Kmr_Latn
- change to
Name = "Dictionary/dict-ku-TR.filelist";
- change to
"Dictionary/dict-kmr-Latn.filelist"
- change to
- File
scp2/source/ooo/module_ooo.scp
- Module
gid_Module_Root_Extension_Dictionary_Ku_Tr
- change to
gid_Module_Root_Extension_Dictionary_Kmr_Latn
- change to
MOD_NAME_DESC
(MODULE_EXTENSION_DICTIONARY_KU_TR
);- change to
MODULE_EXTENSION_DICTIONARY_KMR_LATN
- change to
Files = (gid_File_Extension_Dictionary_Ku_Tr);
- change to
gid_File_Extension_Dictionary_Kmr_Latn
- change to
Spellcheckerlanguage = "ku-TR";
- change to
"kmr-Latn"
- change to
- Module
scp2/source/ooo/module_ooo.ulf
- [
STR_NAME_MODULE_EXTENSION_DICTIONARY_KU_TR
]- change to
STR_NAME_MODULE_EXTENSION_DICTIONARY_KMR_LATN
- change to
en-US = "Kurdish (Turkey)"
- change to
"Kurdish, Northern, Latin script"
- change to
- [
STR_DESC_MODULE_EXTENSION_DICTIONARY_KU_TR
]- change to
STR_DESC_MODULE_EXTENSION_DICTIONARY_KMR_LATN
- change to
en-US = "Kurdish (Turkey)
spelling dictionary"- change to
"Kurdish, Northern, Latin script spelling dictionary"
- change to
- [
setup_native/source/packinfo/packinfo_office.txt
module = "gid_Module_Root_Extension_Dictionary_Ku_Tr"
- change to
"gid_Module_Root_Extension_Dictionary_Kmr_Latn"
- change to
solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"
- change to
"...-dict-kmr-Latn"
- change to
packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR"
- change to
"...-dict-kmr-Latn"
- change to
description = "Ku-TR dictionary for %PRODUCTNAME %PRODUCTVERSION"
- change to
"Kmr-Latn dictionary ..."
- change to
If extras
exist, for example extras/source/autotext/*
:
-
extras/Package_autocorr.mk
- replace
acor_*
entry, for exampleacor_sh-RS.dat
toacor_sr-Latn-RS.dat
, sort alphabetically
- replace
-
extras/CustomTarget_autocorr.mk
- in
extras_AUTOCORR_LANGS change
map entry, for examplesh-RS:sh-RS
tosr-Latn-RS:sr-Latn-Rs
- in
extras_AUTOCORR_XMLFILES
change directory entries, for examplesh-RS/acor/DocumentList.xml
tosr-Latn-RS/acor/DocumentList.xml
- in
-
rename files accordingly, for example in
extras/source/autotext/lang/
git mv sh-RS sr-Latn-RS
If helpcontent
exists:
helpcontent2/source/auxiliary/*/*
for examplehelpcontent2/source/auxiliary/sh/*
- change
Language=...
, for exampleLanguage=sh
toLanguage=sr-Latn
inhelpcontent2/source/auxiliary/sh/*.cfg
- rename
helpcontent2/source/auxiliary/sh/
git mv sh sr-Latn
- change
For language packs:
-
scp2/source/ooo/module_langpack.ulf
-
scp2/source/accessories/module_templates_accessories.ulf
-
scp2/source/accessories/module_samples_accessories.ulf
-
scp2/source/extensions/module_extensions_sun_templates.ulf
- If the upper-cased tag appears in any of these, replace it, for example
STR_NAME_MODULE_LANGPACK_SH
toSTR_NAME_MODULE_LANGPACK_SR_LATN
- If the upper-cased tag appears in any of these, replace it, for example