summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-26 09:44:38 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-06 20:35:48 +0100
commit17ac927774d5f1c66bffdd7854a344e37baadc77 (patch)
treebc2deb0796571b0d38cc5e14e016880dc071f863 /editeng
parent6f14c818ad25e7fb1feb65ab8072e2a9918398d6 (diff)
LanguageTag ctor can canonicalize against various known tags
so can optimize skipping the _lt_tag_canonicalize path which ends up using a fairly expensive xmlXPathEval Change-Id: Ie96f16482d247f3731c1c8eac6d613736b8b289a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162596 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 313836d19f46d0e046d1c2b8c593727b0b0192ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162814
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/acorrcfg.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 616d75c69600..49e48bb48be1 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -65,13 +65,12 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL )
continue;
const OUString aBcp47( aTitle.copy( 5, aTitle.getLength() - 9));
- OUString aCanonicalized;
// Ignore invalid langtags and canonicalize for good,
// allow private-use tags.
- if (!LanguageTag::isValidBcp47( aBcp47, &aCanonicalized))
+ const LanguageTag aLanguageTag (aBcp47, true);
+ if (!aLanguageTag.isValidBcp47())
continue;
- const LanguageTag aLanguageTag( aCanonicalized);
if (SvtLanguageTable::HasLanguageType( aLanguageTag.getLanguageType()))
continue;
@@ -83,7 +82,7 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL )
// other private-use tag (which should not fallback,
// but avoid).
if (aLanguageTag.getCountry().isEmpty()
- && LanguageTag::isValidBcp47( aCanonicalized, nullptr,
+ && LanguageTag::isValidBcp47( aLanguageTag.getBcp47(), nullptr,
LanguageTag::PrivateUse::DISALLOW))
{
LanguageTag aFallback( aLanguageTag);