summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-11-17 00:03:28 +0100
committerEike Rathke <erack@redhat.com>2012-11-17 00:03:33 +0100
commit4767bbb00dc9eacce6f6d60fd4c55107333cee2d (patch)
tree481dc9cf66f50da9b004fba4d53b613355270269 /linguistic
parent378e437fbe313e87b7e56f8f0a1fc4009470679c (diff)
use LanguageTag
Change-Id: I740e221ad16974c88b98c114850e663f25723b76
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/convdicxml.cxx6
-rw-r--r--linguistic/source/dicimp.cxx8
-rw-r--r--linguistic/source/gciterator.cxx6
-rw-r--r--linguistic/source/lngsvcmgr.cxx34
-rw-r--r--linguistic/source/misc.cxx9
5 files changed, 31 insertions, 32 deletions
diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 09298f4ba650..2daa2c88537f 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -20,7 +20,7 @@
#include <tools/debug.hxx>
#include <tools/fsys.hxx>
#include <tools/string.hxx>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <tools/stream.hxx>
#include <osl/mutex.hxx>
#include <ucbhelper/content.hxx>
@@ -225,7 +225,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement(
OUString aValue = rxAttrList->getValueByIndex(i);
if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" )
- nLanguage = MsLangId::convertIsoStringToLanguage( aValue );
+ nLanguage = LanguageTag( aValue ).getLanguageType();
else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" )
nConversionType = GetConversionTypeFromText( aValue );
}
@@ -327,7 +327,7 @@ sal_uInt32 ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eCl
_GetNamespaceMap().GetNameByKey( XML_NAMESPACE_TCD ) );
AddAttributeASCII( XML_NAMESPACE_TCD, "package", "org.openoffice.Office" );
- OUString aIsoLang( MsLangId::convertLanguageToIsoString( rDic.nLanguage ) );
+ OUString aIsoLang( LanguageTag( rDic.nLanguage ).getBcp47() );
AddAttribute( XML_NAMESPACE_TCD, "lang", aIsoLang );
OUString aConvType( ConversionTypeToText( rDic.nConversionType ) );
AddAttribute( XML_NAMESPACE_TCD, "conversion-type", aConvType );
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 71dd8f0385ab..40c51e3356e1 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -22,7 +22,7 @@
#include <dicimp.hxx>
#include <hyphdsp.hxx>
#include <i18npool/lang.h>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <osl/mutex.hxx>
#include <tools/debug.hxx>
#include <tools/fsys.hxx>
@@ -123,8 +123,8 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>")))
nLng = LANGUAGE_NONE;
else
- nLng = MsLangId::convertIsoStringToLanguage(rtl::OStringToOUString(
- aTagValue, RTL_TEXTENCODING_ASCII_US));
+ nLng = LanguageTag(rtl::OStringToOUString(
+ aTagValue, RTL_TEXTENCODING_ASCII_US)).getLanguageType();
}
// type: negative / positive
@@ -424,7 +424,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
else
{
rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("lang: "));
- aLine.append(rtl::OUStringToOString(MsLangId::convertLanguageToIsoString(nLanguage), eEnc));
+ aLine.append(rtl::OUStringToOString(LanguageTag(nLanguage).getBcp47(), eEnc));
pStream->WriteLine(aLine.makeStringAndClear());
}
if (0 != (nErr = pStream->GetError()))
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index ce8efa727729..4af3ab045aa0 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -52,7 +52,7 @@
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/factory.hxx>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/extract.hxx>
@@ -446,7 +446,7 @@ uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarC
m_bGCServicesChecked = sal_True;
}
- const LanguageType nLang = MsLangId::convertLocaleToLanguage( rLocale );
+ const LanguageType nLang = LanguageTag( rLocale ).getLanguageType( false);
GCImplNames_t::const_iterator aLangIt( m_aGCImplNamesByLang.find( nLang ) );
if (aLangIt != m_aGCImplNamesByLang.end()) // matching configured language found?
{
@@ -1015,7 +1015,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
{
// only the first entry is used, there should be only one grammar checker per language
const OUString aImplName( aImplNames[0] );
- const LanguageType nLang = MsLangId::convertIsoStringToLanguage( pElementNames[i] );
+ const LanguageType nLang = LanguageTag( pElementNames[i] ).getLanguageType();
aTmpGCImplNamesByLang[ nLang ] = aImplName;
}
}
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index bef4892a8b86..427c3bf0b6c8 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -31,7 +31,7 @@
#include <unotools/lingucfg.hxx>
#include <comphelper/processfactory.hxx>
#include <i18npool/lang.h>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <cppuhelper/factory.hxx>
#include <comphelper/extract.hxx>
#include <rtl/logfile.hxx>
@@ -611,8 +611,8 @@ namespace
{
Sequence< OUString > aRes;
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- LocaleToLanguage( rAvailLocale ) ) );
+ OUString aCfgLocaleStr( LanguageTag(
+ LocaleToLanguage( rAvailLocale ) ).getBcp47() );
Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) );
sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames);
@@ -745,7 +745,7 @@ void LngSvcMgr::UpdateAll()
const OUString *pNodeName = aNodeNames.getConstArray();
for (i = 0; i < nNodeNames; ++i)
{
- Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(pNodeName[i]) ) );
+ Locale aLocale( CreateLocale( LanguageTag( pNodeName[i]).getLanguageType() ) );
Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale ));
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale ));
@@ -764,8 +764,8 @@ void LngSvcMgr::UpdateAll()
const Locale *pAvailLocale = aAvailLocales.getConstArray();
for (i = 0; i < nAvailLocales; ++i)
{
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- LocaleToLanguage( pAvailLocale[i] ) ) );
+ OUString aCfgLocaleStr( LanguageTag(
+ LocaleToLanguage( pAvailLocale[i] ) ).getBcp47() );
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, pAvailLocale[i] ));
@@ -881,7 +881,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty())
- nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
+ nLang = LanguageTag( aKeyText ).getLanguageType();
GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
pSpellDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
@@ -906,7 +906,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty())
- nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
+ nLang = LanguageTag( aKeyText ).getLanguageType();
if (SvtLinguConfig().HasGrammarChecker())
{
@@ -934,7 +934,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty())
- nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
+ nLang = LanguageTag( aKeyText ).getLanguageType();
GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below
pHyphDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
@@ -959,7 +959,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty())
- nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
+ nLang = LanguageTag( aKeyText ).getLanguageType();
GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below
pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
@@ -1338,7 +1338,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rSpellDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1381,7 +1381,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rGrammarDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1424,7 +1424,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rHyphDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1463,7 +1463,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rThesDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1846,8 +1846,8 @@ sal_Bool LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
aCfgAny <<= aSvcImplNames;
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- LocaleToLanguage( pLocale[i] ) ) );
+ OUString aCfgLocaleStr( LanguageTag(
+ LocaleToLanguage( pLocale[i] ) ).getBcp47() );
pValue->Value = aCfgAny;
pValue->Name = aNodeName;
pValue->Name += OUString::valueOf( (sal_Unicode) '/' );
@@ -1936,7 +1936,7 @@ uno::Sequence< OUString > SAL_CALL
uno::Sequence< OUString > aSvcImplNames;
LanguageType nLanguage = LocaleToLanguage( rLocale );
- OUString aCfgLocale( MsLangId::convertLanguageToIsoString( nLanguage ) );
+ OUString aCfgLocale( LanguageTag( nLanguage ).getBcp47() );
uno::Sequence< uno::Any > aValues;
uno::Sequence< OUString > aNames( 1 );
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 1cad0615d9a4..02c5ef885b9d 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -24,7 +24,7 @@
#include <unotools/pathoptions.hxx>
#include <svl/lngmisc.hxx>
#include <ucbhelper/content.hxx>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
@@ -48,7 +48,6 @@
#include "defs.hxx"
#include "linguistic/lngprops.hxx"
#include "linguistic/hyphdta.hxx"
-#include <i18npool/mslangid.hxx>
using namespace osl;
using namespace com::sun::star;
@@ -374,14 +373,14 @@ LanguageType LocaleToLanguage( const Locale& rLocale )
if ( rLocale.Language.isEmpty() )
return LANGUAGE_NONE;
- return MsLangId::convertLocaleToLanguage( rLocale );
+ return LanguageTag( rLocale ).getLanguageType();
}
Locale& LanguageToLocale( Locale& rLocale, LanguageType eLang )
{
if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
- MsLangId::convertLanguageToLocale( eLang, rLocale );
+ rLocale = LanguageTag( eLang ).getLocale();
return rLocale;
}
@@ -390,7 +389,7 @@ Locale CreateLocale( LanguageType eLang )
{
Locale aLocale;
if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
- return MsLangId::convertLanguageToLocale( eLang );
+ return LanguageTag( eLang ).getLocale();
return aLocale;
}