Skip to content

Japanese Translation of Web Editor #1638

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

Closed
koji opened this issue Oct 17, 2020 · 6 comments · Fixed by #1664
Closed

Japanese Translation of Web Editor #1638

koji opened this issue Oct 17, 2020 · 6 comments · Fixed by #1664

Comments

@koji
Copy link
Contributor

koji commented Oct 17, 2020

Hi,
I'm trying to add Japanese translation to the web editor.

Would like to get some advice from @catarak and @oruburos.

  1. The folder name for translations.json
    Currently, I named it ja because date-fns/locale is using ja for Japanese translation.
    If you guys have any idea for the folder naming, I want to know about it.
    Ex. lang-Area en-UK
    In terms of Japanese, it will be ja-JP or ja-JA

  2. Display dropdown menu
    I could run the Docker image on my local machine.
    I created a new translations.json file and add ja to client/i18n.js and add a button to client/components/Nav.jsx.

<li className="nav__dropdown-item">
  <button
    onFocus={this.handleFocusForLang}
    onBlur={this.handleBlur}
    value="ja"
    onClick={e => this.handleLangSelection(e)}
  >
    日本語
  </button>
</li>

Currently, I hard-coded ja to check the UI
https://twitter.com/koji_kanao/status/1317094279517536256/photo/1

If there is a way to enable a dropdown menu that the current p5 web editor has, I want to know about it.

  1. space in translations.json
    I copied en-US/translations.json to translate items to Japanese.
    Then I noticed a couple of items have space like the following.

https://github.com/processing/p5.js-web-editor/blob/develop/translations/locales/en-US/translations.json#L520

Is this on purpose? If so, space should be a single byte or I need to align to Japanese 2 bytes?

Thanks!

Nature of issue?

  • Existing feature enhancement

Details about the bug:

  • Web browser and version:
  • Operating System:
  • Steps to reproduce this bug:

Feature enhancement details:

  • Add Japanese translation

New feature details:

Add "Japanese" button on the top right corner

@oruburos
Copy link
Collaborator

Hi @koji , so sorry but I don't fully understand the issue.

So let's run a quick recap

See you around

@koji
Copy link
Contributor Author

koji commented Oct 18, 2020

Hi @oruburos thank you for your reply.

So, in this file, you already added your 'ja' option?
https://github.com/processing/p5.js-web-editor/blob/develop/client/i18n.js#L5-L24

Yes, That what I did.

the link that is built-in line can access your new translation file?
https://github.com/processing/p5.js-web-editor/blob/develop/client/i18n.js#L31

The following is loadPath value since it is set as string.

loadPath: "/locales/{{lng}}/translations.json"

And in Nav you already played with this?
https://github.com/processing/p5.js-web-editor/blob/develop/client/components/Nav.jsx#L547-L589

I added the following after Español.

<li className="nav__dropdown-item">
  <button
    onFocus={this.handleFocusForLang}
    onBlur={this.handleBlur}
    value="ja"
    onClick={e => this.handleLangSelection(e)}
  >
    日本語
  </button>
</li>

Screen Shot 2020-10-17 at 9 27 16 PM

There isn't dropdown next to the Login.

Temporary, I hardcoded the following line to see the UI
https://github.com/processing/p5.js-web-editor/blob/develop/client/i18n.js#L43

Regarding the spaces, yes, is on purpose given that I didn't want to play with the current style, and to give space I'd rather introduce extra spaces. So in this aspect, I don't know the difference because I lack of knowledge in Japanese, Visual style for your culture and etc. Maybe further discussion would help.

Okay got it. Probably keeping the spaces makes sense.

Thanks!

@oruburos
Copy link
Collaborator

Hi @koji
Also, you need to put this line in your env file
TRANSLATIONS_ENABLED=true

@koji
Copy link
Contributor Author

koji commented Oct 18, 2020

Hi @oruburos

dropdown showed up.
Thank you for your help!!! Really appreciate.

@oruburos
Copy link
Collaborator

Hi @koji, that's great. you're welcome. As soon as I have time I will submit a PR to add that part to the documentation

@koji koji mentioned this issue Oct 18, 2020
3 tasks
@koji
Copy link
Contributor Author

koji commented Oct 18, 2020

@oruburos opened a PR
#1641

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 a pull request may close this issue.

2 participants