summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-04-12 19:41:14 +0200
committerEike Rathke <erack@redhat.com>2013-04-12 20:45:01 +0200
commitcabde84509d0644258b3d5ccb8c7022e28f505bf (patch)
treea04eda5fb6c643c0f7a5ced5082841e196eca345 /editeng
parentcbcdf190e86ed2874d8d5703ef4666f4074e7c7a (diff)
use proper language tag fallback for language guesser result
Change-Id: Icd912361ebca0e618bc76fa7017039cc116bef40
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx24
1 files changed, 11 insertions, 13 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 8e10abb4dd60..b4d66527b528 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -87,24 +87,22 @@ static LanguageType lcl_CheckLanguage(
if (!xLangGuess.is())
return nLang;
- lang::Locale aLocale( xLangGuess->guessPrimaryLanguage( rText, 0, rText.getLength()) );
+ LanguageTag aGuessTag( xLangGuess->guessPrimaryLanguage( rText, 0, rText.getLength()) );
- // get language as from "Tools/Options - Language Settings - Languages: Locale setting"
- LanguageType nTmpLang = Application::GetSettings().GetLanguageTag().getLanguageType();
-
- // if the result from language guessing does not provide a 'Country' part
- // try to get it by looking up the locale setting of the office.
- /* FIXME-BCP47: handle language tags */
- if ( aLocale.Country.isEmpty( ) )
+ // If the result from language guessing does not provide a 'Country'
+ // part, try to get it by looking up the locale setting of the office,
+ // "Tools/Options - Language Settings - Languages: Locale setting", if
+ // the language matches.
+ if ( aGuessTag.getCountry().isEmpty() )
{
- lang::Locale aTmpLocale = LanguageTag( nTmpLang ).getLocale();
- if (aTmpLocale.Language == aLocale.Language)
- nLang = nTmpLang;
+ const LanguageTag& rAppLocaleTag = Application::GetSettings().GetLanguageTag();
+ if (rAppLocaleTag.getLanguage() == aGuessTag.getLanguage())
+ nLang = rAppLocaleTag.getLanguageType();
}
if (nLang == LANGUAGE_NONE) // language not found by looking up the sytem language...
- nLang = LanguageTag( aLocale ).makeFallback().getLanguageType();
+ nLang = aGuessTag.makeFallback().getLanguageType(); // best known locale match
if (nLang == LANGUAGE_SYSTEM)
- nLang = nTmpLang;
+ nLang = Application::GetSettings().GetLanguageTag().getLanguageType();
if (nLang == LANGUAGE_DONTKNOW)
nLang = LANGUAGE_NONE;
}