summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-12-11 12:57:52 +0100
committerEike Rathke <erack@redhat.com>2012-12-11 13:00:31 +0100
commit90874ab3c75fd161a672a24538cbce909f284e97 (patch)
tree49a2e6763b5a8d7e9f82814d42ced90d87ddf1ad /lingucomponent
parent4d24507451fbc2b7d72cf5f7048a424d52b63850 (diff)
do not trigger liblangtag init during startup
Initializing the liblangtag database stuff takes much percentage of startup time, avoid that. Change-Id: Ieb12ff71c2b1421a5644acebaef4c8366694c249
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index 5edd78a49ed8..194f0b753f73 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -147,20 +147,15 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
nStartIndex - aSystemPrefix.getLength());
if (sChunk.isEmpty())
continue;
- //We prefer (now) to use language tags
+ // We prefer (now) to use language tags.
+ // Avoid feeding in the older LANG_REGION scheme to the BCP47
+ // ctor as that triggers use of liblangtag and initializes its
+ // database which we do not want during startup. Convert
+ // instead.
+ sal_Int32 nPos;
+ if (sChunk.indexOf('-') < 0 && ((nPos = sChunk.indexOf('_')) > 0))
+ sChunk = sChunk.replaceAt( nPos, 1, OUString('-'));
LanguageTag aLangTag(sChunk, true);
- //On failure try older basic LANG_REGION scheme
- if (!aLangTag.isValidBcp47())
- {
- sal_Int32 nIndex = 0;
- OUString sLang = sChunk.getToken(0, '_', nIndex);
- if (!sLang.getLength())
- continue;
- OUString sRegion;
- if (nIndex != -1)
- sRegion = sChunk.copy(nIndex);
- aLangTag = LanguageTag(sLang, sRegion);
- }
if (!aLangTag.isValidBcp47())
continue;