-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8306031: Update IANA Language Subtag Registry to Version 2023-04-13 #13501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8306031: Update IANA Language Subtag Registry to Version 2023-04-13 #13501
Conversation
👋 Welcome back jlu! A progress list of the required criteria for merging this PR into |
@justin-curtis-lu The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
final String finalPref = ","+preferred; | ||
final String inbtwnPref = ","+preferred+","; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could utilize regex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better that way, fixed
final String finalPref = ","+preferred; | ||
final String inbtwnPref = ","+preferred+","; | ||
// Check if current pref exists inside a value for another pref | ||
List<StringBuilder> doublePrefs = initialLanguageMap.entrySet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values()
fits here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
.stream().filter(e -> (e.getValue().toString().endsWith(finalPref) || | ||
e.getValue().toString().contains(inbtwnPref))) | ||
.map(Map.Entry::getValue) | ||
.collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can replace collect()
with toList()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this, as well as the other existing occurrence
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. | |||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot comment on unmodified lines, but instead of calculating the initial load itself, HashMap.newHashMap()
can be used for initializing maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, so they are created with numMappings and not initialLoad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better. Some comments follow.
@@ -37,9 +37,9 @@ | |||
import java.util.List; | |||
import java.util.Locale; | |||
import java.util.Map; | |||
import java.util.regex.Pattern; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: sort the imports
// can have a preferred value itself. | ||
// eg: ar-ajp has pref ajp which has pref apc | ||
boolean foundInOther = false; | ||
Pattern pattern = Pattern.compile("\\b"+preferred+"\\b"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explicitly find a pattern with ,
instead of the word boundary. Otherwise, it could match -
in a tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, changed it to match starting with ,
and ending with ,
or end of string boundary
+ sortedLanguageMap1.size() + ");\n" | ||
+ " multiEquivsMap = HashMap.newHashMap(" | ||
+ sortedLanguageMap2.size() + ");\n" | ||
+ " regionVariantEquivMap = HashMap.newHashMap(" | ||
+ sortedRegionVariantMap.size() + ");\n\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice if these messy concatenated strings be converted to a text block, but that would be for another day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed a separate JBS issue for this here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@justin-curtis-lu This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 150 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@naotoj) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@justin-curtis-lu |
/sponsor |
Going to push as commit 00b1eac.
Your commit was automatically rebased without conflicts. |
@naotoj @justin-curtis-lu Pushed as commit 00b1eac. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Update the registry and accompanying tests with the IANA 4/13/2022 update.
This update introduces the case where an IANA entry can have a preferred value, but that preferred value has a preferred value as well.
This causes unexpected failures in JDK tests because of how locale equivalencies are created.
eg:
ar-ajp
has a preferred value ofajp
butajp
has a preferred value ofapc
Normally, when the JDK is built, LocaleEquivlalentMaps.java generates the following
When
LocaleMatcher.parse(ACCEPT_LANGUAGE)
is called withACCEPT_LANGUAGE
containingapc
andajp
in that order, the following occurs:apc
is found,apc
is added, all ofapc's
equivalencies are added:ajp
andar-apc
When parse iterates to
ajp
, it finds that it is already added to the list, and does not add it's equivalencyar-ajp
.To address this, the build process must be adjusted so that the equivalencies are built as
As, if
ar-ajp
has a preferred value ofajp
, andajp
has a preferred value ofapc
, this technically means thatar-ajp
is equivalent toapc
and its equivalencies as well. This way, whenLocaleMatcher.parse(ACCEPT_LANGUAGE)
iterates toapc
, it will add all of it's equivalencies includingar-ajp
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13501/head:pull/13501
$ git checkout pull/13501
Update a local copy of the PR:
$ git checkout pull/13501
$ git pull https://git.openjdk.org/jdk.git pull/13501/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13501
View PR using the GUI difftool:
$ git pr show -t 13501
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13501.diff
Webrev
Link to Webrev Comment