Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
68cd2838
authored
Jul 14, 2020
by
kimvde
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove occurrences of grandfathering
ISSUE: #7565 PiperOrigin-RevId: 321108417
parent
23d680a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/common/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
68cd2838
...
...
@@ -585,7 +585,7 @@ public final class Util {
mainLanguage
=
replacedLanguage
;
}
if
(
"no"
.
equals
(
mainLanguage
)
||
"i"
.
equals
(
mainLanguage
)
||
"zh"
.
equals
(
mainLanguage
))
{
normalizedTag
=
maybeReplace
Grandfathered
LanguageTags
(
normalizedTag
);
normalizedTag
=
maybeReplace
Legacy
LanguageTags
(
normalizedTag
);
}
return
normalizedTag
;
}
...
...
@@ -2347,11 +2347,11 @@ public final class Util {
.
isCleartextTrafficPermitted
(
checkNotNull
(
uri
.
getHost
()));
}
private
static
String
maybeReplace
Grandfathered
LanguageTags
(
String
languageTag
)
{
for
(
int
i
=
0
;
i
<
iso
Grandfathered
TagReplacements
.
length
;
i
+=
2
)
{
if
(
languageTag
.
startsWith
(
iso
Grandfathered
TagReplacements
[
i
]))
{
return
iso
Grandfathered
TagReplacements
[
i
+
1
]
+
languageTag
.
substring
(
/* beginIndex= */
iso
Grandfathered
TagReplacements
[
i
].
length
());
private
static
String
maybeReplace
Legacy
LanguageTags
(
String
languageTag
)
{
for
(
int
i
=
0
;
i
<
iso
Legacy
TagReplacements
.
length
;
i
+=
2
)
{
if
(
languageTag
.
startsWith
(
iso
Legacy
TagReplacements
[
i
]))
{
return
iso
Legacy
TagReplacements
[
i
+
1
]
+
languageTag
.
substring
(
/* beginIndex= */
iso
Legacy
TagReplacements
[
i
].
length
());
}
}
return
languageTag
;
...
...
@@ -2411,9 +2411,9 @@ public final class Util {
"hsn"
,
"zh-hsn"
};
//
"Grandfathered tags"
, replaced by modern equivalents (including macrolanguage)
//
Legacy ("grandfathered") tags
, replaced by modern equivalents (including macrolanguage)
// See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry.
private
static
final
String
[]
iso
Grandfathered
TagReplacements
=
private
static
final
String
[]
iso
Legacy
TagReplacements
=
new
String
[]
{
"i-lux"
,
"lb"
,
"i-hak"
,
"zh-hak"
,
...
...
library/common/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
View file @
68cd2838
...
...
@@ -940,7 +940,7 @@ public class UtilTest {
assertThat
(
Util
.
normalizeLanguageCode
(
"ji"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"yi"
));
assertThat
(
Util
.
normalizeLanguageCode
(
"ji"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"yid"
));
//
Grandfathered
tags
//
Legacy
tags
assertThat
(
Util
.
normalizeLanguageCode
(
"i-lux"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"lb"
));
assertThat
(
Util
.
normalizeLanguageCode
(
"i-lux"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"ltz"
));
assertThat
(
Util
.
normalizeLanguageCode
(
"i-hak"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"hak"
));
...
...
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