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
00de85cc
Kaydet (Commit)
00de85cc
authored
Tem 11, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added getMatchingFallback()
Change-Id: I5805ab98049bd7dfd8ca1b58632f6c0115197bdd
üst
547affaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
2 deletions
+74
-2
languagetag.cxx
i18nlangtag/source/languagetag/languagetag.cxx
+45
-0
languagetag.hxx
include/i18nlangtag/languagetag.hxx
+29
-2
No files found.
i18nlangtag/source/languagetag/languagetag.cxx
Dosyayı görüntüle @
00de85cc
...
@@ -1312,4 +1312,49 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
...
@@ -1312,4 +1312,49 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
}
}
// static
::
std
::
vector
<
com
::
sun
::
star
::
lang
::
Locale
>::
const_iterator
LanguageTag
::
getMatchingFallback
(
const
::
std
::
vector
<
com
::
sun
::
star
::
lang
::
Locale
>
&
rList
,
const
com
::
sun
::
star
::
lang
::
Locale
&
rReference
)
{
if
(
rList
.
empty
())
return
rList
.
end
();
::
std
::
vector
<
lang
::
Locale
>::
const_iterator
it
;
// Try the simple case first without constructing fallbacks.
for
(
it
=
rList
.
begin
();
it
!=
rList
.
end
();
++
it
)
{
if
(
(
*
it
).
Language
==
rReference
.
Language
&&
(
*
it
).
Country
==
rReference
.
Country
&&
(
*
it
).
Variant
==
rReference
.
Variant
)
return
it
;
// exact match
}
// Now for each reference fallback test the fallbacks of the list in order.
::
std
::
vector
<
OUString
>
aFallbacks
(
LanguageTag
(
rReference
).
getFallbackStrings
());
aFallbacks
.
erase
(
aFallbacks
.
begin
());
// first is full BCP47, we already checked that
::
std
::
vector
<
::
std
::
vector
<
OUString
>
>
aListFallbacks
(
rList
.
size
());
for
(
it
=
rList
.
begin
();
it
!=
rList
.
end
();
++
it
)
{
::
std
::
vector
<
OUString
>
aTmp
(
LanguageTag
(
*
it
).
getFallbackStrings
());
aListFallbacks
.
push_back
(
aTmp
);
}
for
(
::
std
::
vector
<
OUString
>::
const_iterator
rfb
(
aFallbacks
.
begin
());
rfb
!=
aFallbacks
.
end
();
++
rfb
)
{
for
(
::
std
::
vector
<
::
std
::
vector
<
OUString
>
>::
const_iterator
lfb
(
aListFallbacks
.
begin
());
lfb
!=
aListFallbacks
.
end
();
++
lfb
)
{
for
(
::
std
::
vector
<
OUString
>::
const_iterator
fb
(
(
*
lfb
).
begin
());
fb
!=
(
*
lfb
).
end
();
++
fb
)
{
if
(
*
rfb
==
*
fb
)
return
rList
.
begin
()
+
(
lfb
-
aListFallbacks
.
begin
());
}
}
}
// No match found.
return
rList
.
end
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
include/i18nlangtag/languagetag.hxx
Dosyayı görüntüle @
00de85cc
...
@@ -273,7 +273,7 @@ public:
...
@@ -273,7 +273,7 @@ public:
::
std
::
vector
<
OUString
>
getFallbackStrings
()
const
;
::
std
::
vector
<
OUString
>
getFallbackStrings
()
const
;
/** @short
s
earch for an equal or at least for a similar locale in a list
/** @short
S
earch for an equal or at least for a similar locale in a list
of possible ones.
of possible ones.
@descr First search for a locale that is equal to the reference
@descr First search for a locale that is equal to the reference
...
@@ -306,12 +306,39 @@ public:
...
@@ -306,12 +306,39 @@ public:
@return An iterator that points to the found element inside the given
@return An iterator that points to the found element inside the given
locale list. If no matching locale could be found it points to
locale list. If no matching locale could be found it points to
the
end
of the list.
the
beginning
of the list.
*/
*/
static
::
std
::
vector
<
OUString
>::
const_iterator
getFallback
(
const
::
std
::
vector
<
OUString
>
&
rList
,
static
::
std
::
vector
<
OUString
>::
const_iterator
getFallback
(
const
::
std
::
vector
<
OUString
>
&
rList
,
const
OUString
&
rReference
);
const
OUString
&
rReference
);
/** @short Search for an equal or for a similar locale in a list
of possible ones where at least the language matches.
@descr First search for a locale that is equal to the reference
locale.
If the reference locale could not be located, check for
"similar" locales, in the same order as obtained by
getFallbackStrings().
If no locale matches, rList.end() is returned.
@param rList
the vector of possible locales.
@param rReference
the reference locale.
@return An iterator that points to the found element inside the given
locale list. If no matching locale could be found it points to
the end of the list.
*/
static
::
std
::
vector
<
com
::
sun
::
star
::
lang
::
Locale
>::
const_iterator
getMatchingFallback
(
const
::
std
::
vector
<
com
::
sun
::
star
::
lang
::
Locale
>
&
rList
,
const
com
::
sun
::
star
::
lang
::
Locale
&
rReference
);
/** Test equality of two LanguageTag, possibly resolving system locale.
/** Test equality of two LanguageTag, possibly resolving system locale.
@param bResolveSystem
@param bResolveSystem
...
...
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