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
c318f19c
Kaydet (Commit)
c318f19c
authored
Eyl 03, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
simplified simpleExtract() and made some cases work
Change-Id: I5d39a020a4bb6164c0d7695d2f2e43785869b345
üst
9eefaa56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
languagetag.cxx
i18nlangtag/source/languagetag/languagetag.cxx
+23
-26
No files found.
i18nlangtag/source/languagetag/languagetag.cxx
Dosyayı görüntüle @
c318f19c
...
@@ -1302,9 +1302,9 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
...
@@ -1302,9 +1302,9 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
Extraction
eRet
=
EXTRACTED_NONE
;
Extraction
eRet
=
EXTRACTED_NONE
;
const
sal_Int32
nLen
=
rBcp47
.
getLength
();
const
sal_Int32
nLen
=
rBcp47
.
getLength
();
const
sal_Int32
nHyph1
=
rBcp47
.
indexOf
(
'-'
);
const
sal_Int32
nHyph1
=
rBcp47
.
indexOf
(
'-'
);
const
sal_Int32
nHyph2
=
(
nHyph1
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph1
+
1
));
sal_Int32
nHyph2
=
(
nHyph1
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph1
+
1
));
const
sal_Int32
nHyph3
=
(
nHyph2
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph2
+
1
));
sal_Int32
nHyph3
=
(
nHyph2
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph2
+
1
));
const
sal_Int32
nHyph4
=
(
nHyph3
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph3
+
1
));
sal_Int32
nHyph4
=
(
nHyph3
<
0
?
-
1
:
rBcp47
.
indexOf
(
'-'
,
nHyph3
+
1
));
if
(
nLen
==
1
&&
rBcp47
[
0
]
==
'*'
)
// * the dreaded jolly joker
if
(
nLen
==
1
&&
rBcp47
[
0
]
==
'*'
)
// * the dreaded jolly joker
{
{
// It's f*d up but we need to recognize this.
// It's f*d up but we need to recognize this.
...
@@ -1362,45 +1362,42 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
...
@@ -1362,45 +1362,42 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
else
if
(
(
nHyph1
==
2
&&
nHyph2
==
7
&&
nHyph3
==
10
&&
nLen
>=
15
)
// ll-Ssss-CC-vvvv[vvvv][-...]
else
if
(
(
nHyph1
==
2
&&
nHyph2
==
7
&&
nHyph3
==
10
&&
nLen
>=
15
)
// ll-Ssss-CC-vvvv[vvvv][-...]
||
(
nHyph1
==
3
&&
nHyph2
==
8
&&
nHyph3
==
11
&&
nLen
>=
16
))
// lll-Ssss-CC-vvvv[vvvv][-...]
||
(
nHyph1
==
3
&&
nHyph2
==
8
&&
nHyph3
==
11
&&
nLen
>=
16
))
// lll-Ssss-CC-vvvv[vvvv][-...]
{
{
if
(
nHyph4
<
0
||
(
nHyph4
-
nHyph3
>
4
&&
nHyph4
-
nHyph3
<=
9
))
if
(
nHyph4
<
0
)
nHyph4
=
rBcp47
.
getLength
();
if
(
nHyph4
-
nHyph3
>
4
&&
nHyph4
-
nHyph3
<=
9
)
{
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rScript
=
rBcp47
.
copy
(
nHyph1
+
1
,
1
).
toAsciiUpperCase
()
+
rBcp47
.
copy
(
nHyph1
+
2
,
3
).
toAsciiLowerCase
();
rCountry
=
rBcp47
.
copy
(
nHyph2
+
1
,
2
).
toAsciiUpperCase
();
rVariants
=
rBcp47
.
copy
(
nHyph3
+
1
);
rVariants
=
rBcp47
.
copy
(
nHyph3
+
1
);
if
(
nHyph4
<
0
&&
(
rVariants
.
getLength
()
<
4
||
8
<
rVariants
.
getLength
()))
eRet
=
EXTRACTED_LV
;
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rScript
=
rBcp47
.
copy
(
nHyph1
+
1
,
1
).
toAsciiUpperCase
()
+
rBcp47
.
copy
(
nHyph1
+
2
,
3
).
toAsciiLowerCase
();
rCountry
=
rBcp47
.
copy
(
nHyph2
+
1
,
2
).
toAsciiUpperCase
();
eRet
=
EXTRACTED_LV
;
}
}
}
}
}
else
if
(
(
nHyph1
==
2
&&
nHyph2
==
5
&&
nLen
>=
10
)
// ll-CC-vvvv[vvvv][-...]
else
if
(
(
nHyph1
==
2
&&
nHyph2
==
5
&&
nLen
>=
10
)
// ll-CC-vvvv[vvvv][-...]
||
(
nHyph1
==
3
&&
nHyph2
==
6
&&
nLen
>=
11
))
// lll-CC-vvvv[vvvv][-...]
||
(
nHyph1
==
3
&&
nHyph2
==
6
&&
nLen
>=
11
))
// lll-CC-vvvv[vvvv][-...]
{
{
if
(
nHyph3
<
0
||
(
nHyph3
-
nHyph2
>
4
&&
nHyph3
-
nHyph2
<=
9
))
if
(
nHyph3
<
0
)
nHyph3
=
rBcp47
.
getLength
();
if
(
nHyph3
-
nHyph2
>
4
&&
nHyph3
-
nHyph2
<=
9
)
{
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rScript
=
OUString
();
rCountry
=
rBcp47
.
copy
(
nHyph1
+
1
,
2
).
toAsciiUpperCase
();
rVariants
=
rBcp47
.
copy
(
nHyph2
+
1
);
rVariants
=
rBcp47
.
copy
(
nHyph2
+
1
);
if
(
nHyph3
<
0
&&
(
rVariants
.
getLength
()
<
4
||
8
<
rVariants
.
getLength
()))
eRet
=
EXTRACTED_LV
;
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rCountry
=
rBcp47
.
copy
(
nHyph1
+
1
,
2
).
toAsciiUpperCase
();
rScript
=
OUString
();
eRet
=
EXTRACTED_LV
;
}
}
}
}
}
else
if
(
(
nHyph1
==
2
&&
nLen
>=
8
)
// ll-vvvvv[vvv][-...]
else
if
(
(
nHyph1
==
2
&&
nLen
>=
8
)
// ll-vvvvv[vvv][-...]
||
(
nHyph1
==
3
&&
nLen
>=
9
))
// lll-vvvvv[vvv][-...]
||
(
nHyph1
==
3
&&
nLen
>=
9
))
// lll-vvvvv[vvv][-...]
{
{
if
(
nHyph2
<
0
||
(
nHyph2
-
nHyph1
>
5
&&
nHyph2
-
nHyph1
<=
9
))
if
(
nHyph2
<
0
)
nHyph2
=
rBcp47
.
getLength
();
if
(
nHyph2
-
nHyph1
>
5
&&
nHyph2
-
nHyph1
<=
9
)
{
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rScript
=
rCountry
=
OUString
();
rVariants
=
rBcp47
.
copy
(
nHyph1
+
1
);
rVariants
=
rBcp47
.
copy
(
nHyph1
+
1
);
if
(
nHyph2
<
0
&&
(
rVariants
.
getLength
()
<
5
||
8
<
rVariants
.
getLength
()))
eRet
=
EXTRACTED_LV
;
{
rLanguage
=
rBcp47
.
copy
(
0
,
nHyph1
).
toAsciiLowerCase
();
rScript
=
rCountry
=
OUString
();
eRet
=
EXTRACTED_LV
;
}
}
}
}
}
if
(
eRet
==
EXTRACTED_NONE
)
if
(
eRet
==
EXTRACTED_NONE
)
...
...
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