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
862766d5
Kaydet (Commit)
862766d5
authored
Eyl 20, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
prepare for on-the-fly assigned LangIDs
Change-Id: Id4ba99f0b1894457ca95c209b8394447c6fd7893
üst
d45ba6bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
17 deletions
+58
-17
languagetag.cxx
i18nlangtag/source/languagetag/languagetag.cxx
+57
-17
mslangid.hxx
include/i18nlangtag/mslangid.hxx
+1
-0
No files found.
i18nlangtag/source/languagetag/languagetag.cxx
Dosyayı görüntüle @
862766d5
...
...
@@ -323,6 +323,10 @@ private:
OUString
&
rCountry
,
OUString
&
rVariants
);
/** Convert Locale to BCP 47 string without resolving system and creating
temporary LanguageTag instances. */
static
OUString
convertToBcp47
(
const
com
::
sun
::
star
::
lang
::
Locale
&
rLocale
);
};
...
...
@@ -551,7 +555,9 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
{
// XXX NOTE: Do not use non-static LanguageTag::convert...() member methods
// here as they access getImpl() and syncFromImpl() and would lead to
// recursion.
// recursion. Also do not use the static LanguageTag::convertTo...()
// methods as they may create temporary LanguageTag instances. Only
// LanguageTagImpl::convertToBcp47(Locale) is ok.
ImplPtr
pImpl
;
...
...
@@ -565,8 +571,8 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// Force Bcp47 if not LangID.
if
(
!
mbInitializedLangID
&&
!
mbInitializedBcp47
&&
mbInitializedLocale
)
{
maBcp47
=
LanguageTag
::
convertToBcp47
(
maLocale
,
tru
e
);
mbInitializedBcp47
=
true
;
maBcp47
=
LanguageTag
Impl
::
convertToBcp47
(
maLocal
e
);
mbInitializedBcp47
=
!
maBcp47
.
isEmpty
()
;
}
osl
::
MutexGuard
aGuard
(
theMutex
::
get
());
...
...
@@ -637,7 +643,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
pImpl
->
convertBcp47ToLocale
();
if
(
!
pImpl
->
mbInitializedLangID
)
pImpl
->
convertLocaleToLang
();
OUString
aBcp47
(
LanguageTag
::
convertToBcp47
(
OUString
aBcp47
(
LanguageTag
Impl
::
convertToBcp47
(
MsLangId
::
Conversion
::
convertLanguageToLocale
(
pImpl
->
mnLangID
,
true
)));
// If round-trip is identical cross-insert to Bcp47 map.
// May have involved canonicalize(), so compare with
...
...
@@ -966,7 +972,19 @@ void LanguageTagImpl::convertLocaleToBcp47()
if
(
mbSystemLocale
&&
!
mbInitializedLocale
)
convertLangToLocale
();
if
(
maLocale
.
Language
==
I18NLANGTAG_QLT
)
if
(
maLocale
.
Language
.
isEmpty
())
{
// Do not call LanguageTag::convertToBcp47(Locale) that for an empty
// locale via LanguageTag::convertToBcp47(LanguageType) and
// LanguageTag::convertToLocale(LanguageType) would instanciate another
// LanguageTag.
maLocale
=
MsLangId
::
Conversion
::
convertLanguageToLocale
(
LANGUAGE_SYSTEM
,
true
);
}
if
(
maLocale
.
Language
.
isEmpty
())
{
maBcp47
=
OUString
();
// bad luck
}
else
if
(
maLocale
.
Language
==
I18NLANGTAG_QLT
)
{
maBcp47
=
maLocale
.
Variant
;
meIsIsoLocale
=
DECISION_NO
;
...
...
@@ -994,7 +1012,7 @@ void LanguageTagImpl::convertLocaleToLang()
}
else
{
mnLangID
=
LanguageTag
::
convertToLanguageType
(
maLocale
,
tru
e
);
mnLangID
=
MsLangId
::
Conversion
::
convertLocaleToLanguage
(
maLocal
e
);
}
mbInitializedLangID
=
true
;
}
...
...
@@ -1064,7 +1082,7 @@ void LanguageTagImpl::convertLangToLocale()
mbInitializedLangID
=
true
;
}
// Resolve system here! The original is remembered as mbSystemLocale.
maLocale
=
LanguageTag
::
convert
ToLocale
(
mnLangID
,
true
);
maLocale
=
MsLangId
::
Conversion
::
convertLanguage
ToLocale
(
mnLangID
,
true
);
mbInitializedLocale
=
true
;
}
...
...
@@ -2126,7 +2144,7 @@ com::sun::star::lang::Locale LanguageTag::convertToLocale( LanguageType nLangID,
if
(
!
bResolveSystem
&&
lcl_isSystem
(
nLangID
))
return
lang
::
Locale
();
return
MsLangId
::
Conversion
::
convertLanguageToLocale
(
nLangID
,
bResolveSystem
);
return
LanguageTag
(
nLangID
).
getLocale
(
bResolveSystem
);
}
...
...
@@ -2136,19 +2154,17 @@ LanguageType LanguageTag::convertToLanguageType( const com::sun::star::lang::Loc
if
(
rLocale
.
Language
.
isEmpty
()
&&
!
bResolveSystem
)
return
LANGUAGE_SYSTEM
;
return
MsLangId
::
Conversion
::
convertLocaleToLanguage
(
rLocale
);
return
LanguageTag
(
rLocale
).
getLanguageType
(
bResolveSystem
);
}
// static
OUString
LanguageTag
::
convertToBcp47
(
const
com
::
sun
::
star
::
lang
::
Locale
&
rLocale
,
bool
bResolveSystem
)
OUString
LanguageTag
Impl
::
convertToBcp47
(
const
com
::
sun
::
star
::
lang
::
Locale
&
rLocale
)
{
OUString
aBcp47
;
if
(
rLocale
.
Language
.
isEmpty
())
{
if
(
bResolveSystem
)
aBcp47
=
convertToBcp47
(
LANGUAGE_SYSTEM
,
true
);
// else aBcp47 stays empty
// aBcp47 stays empty
}
else
if
(
rLocale
.
Language
==
I18NLANGTAG_QLT
)
{
...
...
@@ -2170,6 +2186,24 @@ OUString LanguageTag::convertToBcp47( const com::sun::star::lang::Locale& rLocal
}
// static
OUString
LanguageTag
::
convertToBcp47
(
const
com
::
sun
::
star
::
lang
::
Locale
&
rLocale
,
bool
bResolveSystem
)
{
OUString
aBcp47
;
if
(
rLocale
.
Language
.
isEmpty
())
{
if
(
bResolveSystem
)
aBcp47
=
LanguageTag
::
convertToBcp47
(
LANGUAGE_SYSTEM
,
true
);
// else aBcp47 stays empty
}
else
{
aBcp47
=
LanguageTagImpl
::
convertToBcp47
(
rLocale
);
}
return
aBcp47
;
}
// static
OUString
LanguageTag
::
convertToBcp47
(
LanguageType
nLangID
,
bool
bResolveSystem
)
{
...
...
@@ -2177,19 +2211,22 @@ OUString LanguageTag::convertToBcp47( LanguageType nLangID, bool bResolveSystem
if
(
!
bResolveSystem
&&
lcl_isSystem
(
nLangID
))
return
OUString
();
lang
::
Locale
aLocale
(
convertToLocale
(
nLangID
,
bResolveSystem
));
lang
::
Locale
aLocale
(
LanguageTag
::
convertToLocale
(
nLangID
,
bResolveSystem
));
// If system for some reason (should not happen.. haha) could not be
// resolved DO NOT CALL
convertToBcp47() because that would recurse into
// this method here!
// resolved DO NOT CALL
LanguageTag::convertToBcp47(Locale) because that
//
would recurse into
this method here!
if
(
aLocale
.
Language
.
isEmpty
()
&&
bResolveSystem
)
return
OUString
();
// bad luck, bail out
return
convertToBcp47
(
aLocale
,
bResolveSystem
);
return
LanguageTagImpl
::
convertToBcp47
(
aLocale
);
}
// static
com
::
sun
::
star
::
lang
::
Locale
LanguageTag
::
convertToLocale
(
const
OUString
&
rBcp47
,
bool
bResolveSystem
)
{
if
(
rBcp47
.
isEmpty
()
&&
!
bResolveSystem
)
return
lang
::
Locale
();
return
LanguageTag
(
rBcp47
).
getLocale
(
bResolveSystem
);
}
...
...
@@ -2197,6 +2234,9 @@ com::sun::star::lang::Locale LanguageTag::convertToLocale( const OUString& rBcp4
// static
LanguageType
LanguageTag
::
convertToLanguageType
(
const
OUString
&
rBcp47
,
bool
bResolveSystem
)
{
if
(
rBcp47
.
isEmpty
()
&&
!
bResolveSystem
)
return
LANGUAGE_SYSTEM
;
return
LanguageTag
(
rBcp47
).
getLanguageType
(
bResolveSystem
);
}
...
...
include/i18nlangtag/mslangid.hxx
Dosyayı görüntüle @
862766d5
...
...
@@ -200,6 +200,7 @@ public:
private
:
friend
class
LanguageTag
;
friend
class
LanguageTagImpl
;
friend
::
com
::
sun
::
star
::
lang
::
Locale
MsLangId
::
getFallbackLocale
(
const
::
com
::
sun
::
star
::
lang
::
Locale
&
rLocale
);
...
...
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