Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
555d88d0
Kaydet (Commit)
555d88d0
authored
Şub 18, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added reset(rtl_Locale)
Change-Id: I1bc83dd4e5286f7102513d8a4c7d5624952eb830
üst
2c36a832
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
35 deletions
+53
-35
languagetag.hxx
i18npool/inc/i18npool/languagetag.hxx
+5
-0
languagetag.cxx
i18npool/source/languagetag/languagetag.cxx
+48
-35
No files found.
i18npool/inc/i18npool/languagetag.hxx
Dosyayı görüntüle @
555d88d0
...
...
@@ -205,6 +205,9 @@ public:
/** Reset with LanguageType MS-LangID. */
void
reset
(
LanguageType
nLanguage
);
/** Reset with rtl_Locale. */
void
reset
(
const
rtl_Locale
&
rLocale
);
/** Fall back to a known locale.
...
...
@@ -275,6 +278,8 @@ private:
void
convertLangToLocale
();
void
convertLangToBcp47
();
void
convertFromRtlLocale
();
bool
canonicalize
();
rtl
::
OUString
getLanguageFromLangtag
();
...
...
i18npool/source/languagetag/languagetag.cxx
Dosyayı görüntüle @
555d88d0
...
...
@@ -248,41 +248,7 @@ LanguageTag::LanguageTag( const rtl_Locale & rLocale )
mbCachedCountry
(
false
),
mbIsFallback
(
false
)
{
// The rtl_Locale follows the Open Group Base Specification,
// 8.2 Internationalization Variables
// language[_territory][.codeset][@modifier]
// On GNU/Linux systems usually being glibc locales.
// sal/osl/unx/nlsupport.c _parse_locale() parses them into
// Language: language 2 or 3 alpha code
// Country: [territory] 2 alpha code
// Variant: [.codeset][@modifier]
// Variant effectively contains anything that follows the territory, not
// looking for '.' dot delimiter or '@' modifier content.
if
(
!
maLocale
.
Variant
.
isEmpty
())
{
OString
aStr
=
OUStringToOString
(
maLocale
.
Language
+
"_"
+
maLocale
.
Country
+
maLocale
.
Variant
,
RTL_TEXTENCODING_UTF8
);
/* FIXME: let liblangtag parse this entirely with
* lt_tag_convert_from_locale() but that needs a patch to pass the
* string. */
#if 0
myLtError aError;
theDataRef::get().incRef();
mpImplLangtag = lt_tag_convert_from_locale( aStr.getStr(), &aError.p);
maBcp47 = OStringToOUString( lt_tag_get_string( MPLANGTAG), RTL_TEXTENCODING_UTF8);
mbInitializedBcp47 = true;
#else
mnLangID
=
MsLangId
::
convertUnxByteStringToLanguage
(
aStr
);
if
(
mnLangID
==
LANGUAGE_DONTKNOW
)
{
SAL_WARN
(
"i18npool.langtag"
,
"LanguageTag(rtl_Locale) - unknown: "
<<
aStr
);
mnLangID
=
LANGUAGE_ENGLISH_US
;
// we need _something_ here
}
mbInitializedLangID
=
true
;
#endif
maLocale
=
lang
::
Locale
();
mbInitializedLocale
=
false
;
}
convertFromRtlLocale
();
}
...
...
@@ -417,6 +383,13 @@ void LanguageTag::reset( LanguageType nLanguage )
}
void
LanguageTag
::
reset
(
const
rtl_Locale
&
rLocale
)
{
reset
(
lang
::
Locale
(
rLocale
.
Language
,
rLocale
.
Country
,
rLocale
.
Variant
));
convertFromRtlLocale
();
}
bool
LanguageTag
::
canonicalize
()
{
#ifdef erDEBUG
...
...
@@ -671,6 +644,46 @@ void LanguageTag::convertLangToBcp47()
}
void
LanguageTag
::
convertFromRtlLocale
()
{
// The rtl_Locale follows the Open Group Base Specification,
// 8.2 Internationalization Variables
// language[_territory][.codeset][@modifier]
// On GNU/Linux systems usually being glibc locales.
// sal/osl/unx/nlsupport.c _parse_locale() parses them into
// Language: language 2 or 3 alpha code
// Country: [territory] 2 alpha code
// Variant: [.codeset][@modifier]
// Variant effectively contains anything that follows the territory, not
// looking for '.' dot delimiter or '@' modifier content.
if
(
!
maLocale
.
Variant
.
isEmpty
())
{
OString
aStr
=
OUStringToOString
(
maLocale
.
Language
+
"_"
+
maLocale
.
Country
+
maLocale
.
Variant
,
RTL_TEXTENCODING_UTF8
);
/* FIXME: let liblangtag parse this entirely with
* lt_tag_convert_from_locale() but that needs a patch to pass the
* string. */
#if 0
myLtError aError;
theDataRef::get().incRef();
mpImplLangtag = lt_tag_convert_from_locale( aStr.getStr(), &aError.p);
maBcp47 = OStringToOUString( lt_tag_get_string( MPLANGTAG), RTL_TEXTENCODING_UTF8);
mbInitializedBcp47 = true;
#else
mnLangID
=
MsLangId
::
convertUnxByteStringToLanguage
(
aStr
);
if
(
mnLangID
==
LANGUAGE_DONTKNOW
)
{
SAL_WARN
(
"i18npool.langtag"
,
"LanguageTag(rtl_Locale) - unknown: "
<<
aStr
);
mnLangID
=
LANGUAGE_ENGLISH_US
;
// we need _something_ here
}
mbInitializedLangID
=
true
;
#endif
maLocale
=
lang
::
Locale
();
mbInitializedLocale
=
false
;
}
}
const
rtl
::
OUString
&
LanguageTag
::
getBcp47
(
bool
bResolveSystem
)
const
{
if
(
!
bResolveSystem
&&
mbSystemLocale
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment