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

[RFC] Internationalize wallet #3985

Merged
merged 47 commits into from Jan 8, 2020

Conversation

dangdennis
Copy link
Contributor

Explain your changes here.

RFC for the react-intl grant.

Explain how you tested your changes here.

My markdown and command of the English language is decent.

Checklist:

  • Tests were added for the new behavior
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues? List them:

@dangdennis
Copy link
Contributor Author

dangdennis commented Dec 1, 2019

Screen Shot 2019-12-01 at 12 34 55 AM

Screen Shot 2019-12-01 at 12 42 37 AM

Screen Shot 2019-12-01 at 1 12 23 AM

Copy link
Contributor Author

@dangdennis dangdennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFC

frontend/wallet/src/render/components/Header.re Outdated Show resolved Hide resolved
frontend/wallet/src/render/contexts/IntlProvider.re Outdated Show resolved Hide resolved
frontend/wallet/src/render/i18n/translations/en.json Outdated Show resolved Hide resolved
frontend/wallet/src/render/i18n/translations/en.json Outdated Show resolved Hide resolved
frontend/wallet/src/render/i18n/translations/vn.json Outdated Show resolved Hide resolved
frontend/wallet/src/render/views/sidebar/UnlockModal.re Outdated Show resolved Hide resolved
@dangdennis
Copy link
Contributor Author

@Schmavery need your input :D

@dangdennis
Copy link
Contributor Author

I don't want the translation to get any deeper than this. Have a couple issues to resolve before the PR is technically done for part 1

  1. How to write translations in the locale json
  2. How to wrap react intl provider

Copy link
Contributor

@Schmavery Schmavery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangdennis thanks for doing this work.

I don't think you need to wrap the provider unless there's some other issue, their provider component should work as long as we're not doing anything unusual with it.

Re: translations, react-intl should work with partial translations right? I think it's OK if you don't spend more time on the vn translations and just focus on the english ones that are relevant to the PR.

I'm actually a little confused about the multiple layers of defaultMessage -- there seems to be one in the code, and then one in each translation. Which takes precedence? Is it really necessary to keep these all in sync? Is it possible to just fall back to english translations when we don't have an id translated to the desired language?

Were you able to get the webpack file-loader working with fastpack in order to avoid having to use the file loading code we wrote?

The textTransform sounds fine to me (cc @figitaki ).

I'm not sure what you meant by "How to write translations in the locale json" so plz clarify if I didn't manage to answer above.

frontend/wallet/src/render/components/Header.re Outdated Show resolved Hide resolved
frontend/wallet/src/render/views/sidebar/UnlockModal.re Outdated Show resolved Hide resolved
@dangdennis
Copy link
Contributor Author

Lmk what else I need to do. This PR completes integration of react intl.

@Schmavery
Copy link
Contributor

It's looking pretty good @dangdennis, sorry for the delay.
I'm going to take another look on Monday along with @figitaki but I think we're close

@@ -24,10 +24,17 @@ let isFaker =
Js.Dict.get(Bindings.ChildProcess.Process.env, "GRAPHQL_BACKEND")
== Some("faker");

let getTranslation = name =>
Bindings.Fs.readFileSync(
"./src/render/i18n/translations/" ++ name ++ ".json",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that our bundler might not include these files in the build output. A better place for the translation JSON files to live might be under public/translations/ since all the files in that folder will automatically copied into the destination. Might be worth just running yarn dist and running that build to double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll test this!

Are there any tests running against the prod build yet? Was thinking it would catch this error since loading a missing file would throw an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Schmavery can we pair again sometime to finish this up?

  1. Unable to commit now, receiving this error. Unsure why that particular exe is missing.
INFO Not using Docker
find: _build/default: No such file or directory
find: _build/default: No such file or directory
find: _build/default: No such file or directory
dune exec --profile=dev src/app/reformat/reformat.exe -- -path . -check
make: dune: No such file or directory
make: *** [check-format] Error 1
** REFUSING TO COMMIT: "$ make check-format" failed
  1. yarn dist leaves a long error stack trace.
Can't locate Mac/Memory.pm in @INC (you may need to install the Mac::Memory module)...

Copy link
Contributor

@Schmavery Schmavery Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangdennis unfortunately no tests on the dist build right now

  1. that's a post commit hook that checks the native code (surprised you never ran into it before). If you have opam+dune installed, you can eval $(opam env) and then it should work, otherwise, you can skip the hooks with git commit --no-verify

  2. ouch, that's an ugly error. @figitaki did you see this when running dist build lately? It could be that upgrading to "electron-builder": "^21.2.0" (from here) might help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool bypassed the git hook.

Did a test upgrade to electron-builder to 21.2.0. I'm no longer getting that scary stack trace. But what's build doing in this script:
"dist": "yarn run build && yarn run pack && build"

How does electron-builder actually get run in your setup?

Edit:
"dist": "yarn run build && yarn run pack && electron-builder build" produced a running .dmg!

@dangdennis
Copy link
Contributor Author

is the electron-builder upgrade going to happen soon?

i didn't commit the upgrade nor the script change.

@figitaki
Copy link
Contributor

We're about to land #4084 which will fix the yarn dist command, you can rebase temporarily to test but it should land in the next couple hours.

@figitaki
Copy link
Contributor

If you rebase on develop electron-builder has been upgraded.

@dangdennis
Copy link
Contributor Author

If you rebase on develop electron-builder has been upgraded.

Everything's working fine now. Hope all if not most of the CI tests pass. I tried to squash my commits, but it's a bit hairy since I haven't been rebasing.

Whoever does the merge, will you please use Github's squash & merge feature?

@Schmavery Schmavery merged commit 1c6b2db into MinaProtocol:develop Jan 8, 2020
@Schmavery
Copy link
Contributor

finally merged! thanks again @dangdennis

@dangdennis
Copy link
Contributor Author

Awesome! Looking forward to contributing in other ways one day.

@dangdennis dangdennis deleted the dd-wallet-intl branch August 11, 2020 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants