Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pull request i18n#2804

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gnestor merged 10 commits intojupyter:masterfromjianzi123:pull_request_i18n
Oct 2, 2017
Merged

Conversation

@jianzi123
Copy link
Contributor

add translated files in Chinese.

@takluyvertakluyver added this to the5.2 milestoneAug 25, 2017
@takluyver
Copy link
Member

Awesome, thanks!@JCEmmons can you take a look to see if this is arranged as you'd expect? Should the.mo files be checked in, or should we be generating those at build time?

We're just about to release notebook 5.1, so it will be a few days before we can merge this, but hopefully it can go in soon after the release.

@jianzi123
Copy link
ContributorAuthor

Except adding the translated files, if something else is needed, please let me know, haha.

@JCEmmons
Copy link
Contributor

JCEmmons commentedSep 5, 2017 via email

Just got back from vacation today, so I will take a look shortly.Yes. the .mo should be done at build time if possible, as they are objectfiles, not source.Regards,John C. EmmonsGlobalization Architect & Unicode CLDR TC Vice ChairmanIBM Globalization Teame-mail: emmo@us.ibm.comFrom: Thomas Kluyver <notifications@github.com>To: jupyter/notebook <notebook@noreply.github.com>Cc: John Emmons <emmo@us.ibm.com>, Mention<mention@noreply.github.com>Date: 08/25/2017 07:23 AMSubject: Re: [jupyter/notebook] Pull request i18n (#2804)Awesome, thanks!@JCEmmons can you take a look to see if this is arrangedas you'd expect? Should the .mo files be checked in, or should we begenerating those at build time?We're just about to release notebook 5.1, so it will be a few days beforewe can merge this, but hopefully it can go in soon after the release.—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

@takluyver
Copy link
Member

Thanks for your patience - 5.1 is out now, so we can come back to this.

I think this PR should only need to add three files:

notebook/i18n/zh-CN/LC_MESSAGES/nbjs.ponotebook/i18n/zh-CN/LC_MESSAGES/notebook.ponotebook/i18n/zh-CN/LC_MESSAGES/nbui.po

The.mo and.json files should be generated at build time, so they shouldn't be stored in git. And we shouldn't need thezh_CN.UTF-8 folder: everything should be UTF-8 anyway, and the code should take care of loading it correctly.

Even if this doesn't actually work at the moment, having a set of translations to work with will be really useful for us to figure out the infrastructure to make it work.

@JCEmmons
Copy link
Contributor

JCEmmons commentedSep 15, 2017 via email

Yes, you are correct.... However, since the translations are simplifiedChinese, you really need only use the language code "zh" to refer to itinstead of "zh-CN". If you were to have traditional Chinese, you woulduse language code "zh-Hant"Regards,John C. EmmonsGlobalization Architect & Unicode CLDR TC Vice ChairmanIBM Globalization Teame-mail: emmo@us.ibm.comFrom: Thomas Kluyver <notifications@github.com>To: jupyter/notebook <notebook@noreply.github.com>Cc: John Emmons <emmo@us.ibm.com>, Mention<mention@noreply.github.com>Date: 09/15/2017 09:09 AMSubject: Re: [jupyter/notebook] Pull request i18n (#2804)Thanks for your patience - 5.1 is out now, so we can come back to this.I think this PR should only need to add three files:notebook/i18n/zh-CN/LC_MESSAGES/nbjs.ponotebook/i18n/zh-CN/LC_MESSAGES/notebook.ponotebook/i18n/zh-CN/LC_MESSAGES/nbui.poThe .mo and .json files should be generated at build time, so theyshouldn't be stored in git. And we shouldn't need the zh_CN.UTF-8 folder:everything should be UTF-8 anyway, and the code should take care ofloading it correctly.Even if this doesn't actually work at the moment, having a set oftranslations to work with will be really useful for us to figure out theinfrastructure to make it work.—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

@gnestor
Copy link
Contributor

I'm trying to test this with no luck. I tried the following:

  • Based on@JCEmmons suggestion, I renamed the language from "zh_CN" to "zh"
  • According to the i18n docs in this repo, I added "zh" tosupported_languages innbjs.json
  • I added "Chinese [zh]" to the languages in Firefox and moved it to the top of the list
  • I ran the notebook server withLANG=zh jupyter notebook --no-browser

@jianzi123 Have you had any luck in testing this?@JCEmmons?

@takluyver
Copy link
Member

I don't think the code to load translations is actually in place. We were having some trouble working out how to load the translations early enough, but without requesting all languages.

@jianzi123
Copy link
ContributorAuthor

jianzi123 commentedSep 18, 2017
edited
Loading

@gnestor
I took a few days off to go home, and sorry for replying this so late...

  • ​First, check the local env usinglocale, make sure there are some languages supported

LANG=zh_CN.UTF-8

  • putzh-CN to nbjs.json... this is not the same as language above while it is related to path i18n/zh-CN

  • Then, make sure there are not 404 in your log, some logs show that there are not files likenbjs.json,

  • make sure in code

    1. add_ /i18n/LANG/... to url path;

    2. add lang para into gettext.translation() function in notebook/notebookapp.py;

@takluyver Asynchronous loading of language files does have some latency, in my project I replace some words in code...

@JCEmmons
Copy link
Contributor

JCEmmons commentedSep 18, 2017 via email

Let me give it a try today.....Regards,John C. EmmonsGlobalization Architect & Unicode CLDR TC Vice ChairmanIBM Globalization Teame-mail: emmo@us.ibm.comFrom: Grant Nestor <notifications@github.com>To: jupyter/notebook <notebook@noreply.github.com>Cc: John Emmons <emmo@us.ibm.com>, Mention<mention@noreply.github.com>Date: 09/15/2017 07:32 PMSubject: Re: [jupyter/notebook] Pull request i18n (#2804)I'm trying to test this with no luck. I tried the following:Based on@JCEmmons suggestion, I renamed the language from "zh_CN" to "zh"According to the i18n docs in this repo, I added "zh" tosupported_languages in nbjs.jsonI added "Chinese [zh]" to the languages in Firefox and moved it to the topof the listI ran the notebook server with LANG=zh jupyter notebook --no-browser@jianzi123 Have you had any luck in testing this?@JCEmmons?—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

@JCEmmons
Copy link
Contributor

I was able to have some level of success with these translations. But there are some things that weren't quite right..... Here's what I did:

1). The translated files are really .po, not .pot ( although the format is the same ), so I renamed them.
2). Put the translated notebook.po and nbui.po into notebook/i18n/zh-CN/LC_MESSAGES.
3). Run pybabel compile to create Chinese notebook.mo and nbui.mo in notebook/i18n/zh-CN/LC_MESSAGES per the instructions.
4). Run po2json to create Chinese nbjs.json in notebook/i18n/zh-CN/LC_MESSAGES
5). Update notebook/i18n/nbjs.json to add "zh-CN" to the list of supported languages.
6). Update notebook/static/base/js/i18nload.js per the instructions in the comment:

     // These are only here so that the optimizer knows which ones we MIGHT load. // We will actually only load the ones we need. There should be one entry // here for each language you want to support. // For example, for German.... "json!base/../../i18n/zh-CN/LC_MESSAGES/nbjs.json"

7). Regenerate the javascript with "setup.py css js"
8). Set your language to zh-CN and your browser default to zh-cn.
Run jupyter notebook.....

In case you're wondering, the reason we're using zh-CN instead of just zh is that moment doesn't have a "zh" locale, only "zh-cn" and "zh-tw", so the date stuff won't come out right if you try to use just "zh".
image

Some things to be noted:

1). There are a number of places where the English has changed since my original drop, so in order to completely do this right, you would need to update the English using pybabel extract in the instructions, and then translate the updated files.

2). There are some places where the translations were incomplete or missing items.

But overall, these files seem to work OK and produce reasonable amounts of Chinese.

@jianzi123
Copy link
ContributorAuthor

Thank you for testing the files
and some words should add i18n codes include the plug-in and others...

I will try to update some files...

@takluyver
Copy link
Member

I've cleaned up the files in this PR a bit. Does the structure now look about right? If so, I suggest that we merge this and use it as a base to work out how to load the necessary translations for the UI.

If someone other than me hits the button, I'd suggest using the 'squash and merge' option for this PR so that the binary .mo files are not in our repo history.

@jianzi123
Copy link
ContributorAuthor

I think that we could merge this and fix the details in some version...

@gnestorgnestor merged commitde09c12 intojupyter:masterOct 2, 2017
@gnestor
Copy link
Contributor

Thanks@takluyver and@jianzi123!!

@gnestorgnestor mentioned this pull requestOct 2, 2017
@gnestorgnestor modified the milestone:5.2Oct 13, 2017
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsApr 4, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

4 participants

@jianzi123@takluyver@JCEmmons@gnestor

[8]ページ先頭

©2009-2025 Movatter.jp