Skip to content
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

fix: backport ICU changes for Japanese Era placeholder name #17518

Merged
merged 1 commit into from Mar 27, 2019

Conversation

Projects
None yet
4 participants
@jefgen
Copy link

jefgen commented Mar 22, 2019

Description of Change

This change backports changes from the upstream ICU 62.1 maintenance branch into the Chromium copy of ICU, in order to enable the "placeholder era" for the upcoming new Japanese Era.

Upstream change: unicode-org/icu#514
Upstream ticket: https://unicode-org.atlassian.net/browse/ICU-20482

With this change you can set/define an Environment Variable named ICU_ENABLE_TENTATIVE_ERA to true which will enable the placeholder era name.

Notes on the changes:

  • This change required re-generating the checked-in Chromium ICU data files (ex: icudtl.dat) in order to update them with the new data for the placeholder era name. (This is why the .patch file is so large and contains binary diffs.)
  • The Chromium ICU folder under third_party is a separate git repo, so this required added a new folder named icu to the electron\patches\common folder (since there are currently no existing patches for ICU)
  • Also included in this change are some minor changes to the scripts used by Chromium for building the data files so that they actually work on Ubuntu.

CC: @alexeykuzmin (also FYI for @aandrejs).

Here's a simple example showing the results of the change:

Before:
before

After:
after
(Note the use of "QQ" instead of the "平成" for the date format for ja-JP).

Sample code used for testing:

<p>Outputs:</p>
<form>
<textarea id="jaEraOutputs" rows="9" cols="60"></textarea>
</form>

<script type="text/javascript">
    // Heisi Era will end on April 30, 2019 so pick a date before.
    var dateHeisi = new Date(Date.UTC(2019, 01, 15, 3, 0, 0));
    // New Era starts on May 1, 2019.
    var dateNew = new Date(Date.UTC(2019, 05, 02, 3, 0, 0));
    
    var out = document.getElementById("jaEraOutputs");
    out.value = "";
    out.value += "Heisi: \n";
    out.value += "\t ja-JP:  " + dateHeisi.toLocaleString('ja-JP-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\t en-US:  " + dateHeisi.toLocaleString('en-US-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\n";
    out.value += "New Era: \n";
    out.value += "\t ja-JP:  " + dateNew.toLocaleString('ja-JP-u-ca-japanese', {era: 'long'}) + "\n";
    out.value += "\t en-US:  " + dateNew.toLocaleString('en-US-u-ca-japanese', {era: 'long'}) + "\n";
</script>

Checklist

Release Notes

Notes: Added support for testing the new Japanese Era with a placeholder era name. Set an environment variable named ICU_ENABLE_TENTATIVE_ERA to true to enable the placeholder era.

fix: backport ICU changes for Japanese Era placeholder name
This change backports changes from the upstream ICU 62.1 maintenance
branch into the Chromium copy of ICU, in order to enable the
"placeholder era" for the upcoming new Japanese Era.

Upstream change: unicode-org/icu#514
Upstream ticket: https://unicode-org.atlassian.net/browse/ICU-20482

With this change you can set/define an Environment Variable
`ICU_ENABLE_TENTATIVE_ERA` to `true which will enable the placeholder
era name.

Note: This change requires re-generating the checked-in Chromium ICU
data files (icudtl.dat) in order for them to have the updated data
for the placeholder era name.

Also included in this change are some minor changes to the scripts
used by Chromium for building the data files so that they actually
work on Ubuntu.
@welcome

This comment has been minimized.

Copy link

welcome bot commented Mar 22, 2019

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot removed the new-pr 🌱 label Mar 23, 2019

@deepak1556

This comment has been minimized.

Copy link
Member

deepak1556 commented Mar 26, 2019

Just to clarify, where the ICU data files generated following the instructions in https://cs.chromium.org/chromium/src/third_party/icu/README.chromium ?

@jefgen

This comment has been minimized.

Copy link
Author

jefgen commented Mar 26, 2019

Just to clarify, where the ICU data files generated following the instructions in https://cs.chromium.org/chromium/src/third_party/icu/README.chromium ?

Yes of course. :)
I regenerated all of the checked-in data files (for Android, iOS, ChromeCast, etc.) even though I think Electron only uses the "common" one.

@deepak1556

This comment has been minimized.

Copy link
Member

deepak1556 commented Mar 26, 2019

Thanks! Just to get some understanding, what would steps C1-4 be for in the above document

C. Chromium-specific data build files and converters

Is that something we should care about when updating icu with patches ?

@jefgen

This comment has been minimized.

Copy link
Author

jefgen commented Mar 26, 2019

Thanks! Just to get some understanding, what would steps C1-4 be for in the above document

C. Chromium-specific data build files and converters

Is that something we should care about when updating icu with patches ?

I'm not sure I understand the question? Perhaps you could rephrase it?.

However, regarding ICU and Chromium changes:
Yes, Chromium makes a number of "Chromium-specific" changes to both the ICU code and the ICU data files.

If you are just patching things in ICU (by pulling things from upstream ICU) then you generally/hopefully will not have any issues with conflicting Chromium-specific changes.

However, if you try to independently bump the ICU version in Electron, then yes -- you will also need to carry forward all of the Chromium-specific changes, which might need to be changed between ICU versions.

(Hopefully this helps explain things a bit?)

@jefgen

This comment has been minimized.

Copy link
Author

jefgen commented Mar 26, 2019

Oh, one other important point:
This is just the placeholder era name.
Once the real/official era name is released, I'll need to regenerate the data files again with the real name. (We can likely replace this patch with a newer patch, so there would only be one patch file instead of two.)

@deepak1556

This comment has been minimized.

Copy link
Member

deepak1556 commented Mar 26, 2019

I'm not sure I understand the question? Perhaps you could rephrase it?.

Sorry, I was referring to the steps here https://cs.chromium.org/chromium/src/third_party/icu/README.chromium?l=116-166

If you are just patching things in ICU (by pulling things from upstream ICU) then you generally/hopefully will not have any issues with conflicting Chromium-specific changes.

You have clarified it, thanks!

@jkleinsc jkleinsc merged commit d2571f3 into electron:4-1-x Mar 27, 2019

4 checks passed

Semantic Pull Request ready to be squashed
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
release-notes Release notes found
@release-clerk

This comment has been minimized.

Copy link

release-clerk bot commented Mar 27, 2019

Release Notes Persisted

Added support for testing the new Japanese Era with a placeholder era name. Set an environment variable named ICU_ENABLE_TENTATIVE_ERA to true to enable the placeholder era.

@welcome

This comment has been minimized.

Copy link

welcome bot commented Mar 27, 2019

Congrats on merging your first pull request! 🎉🎉🎉

@jefgen jefgen referenced this pull request Apr 17, 2019

Merged

fix: Add support for the new Japanese Era (Reiwa) to ICU #17833

3 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.