Kaydet (Commit) c98a5f1a authored tarafından Eike Rathke's avatar Eike Rathke

do not trigger liblangtag init during startup

Initializing the liblangtag database stuff takes much percentage of
startup time, avoid that.

Change-Id: Ieb12ff71c2b1421a5644acebaef4c8366694c249
(cherry picked from commit 90874ab3)
üst 19095016
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment