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

Add Chinese translation #2789

Closed
jianzi123 opened this issue Aug 22, 2017 · 19 comments
Closed

Add Chinese translation #2789

jianzi123 opened this issue Aug 22, 2017 · 19 comments

Comments

@jianzi123
Copy link
Contributor

do setup.py extract_messages, outputs cmd not found...
I just want to know how to use i18n function...
Thanks.

@takluyver
Copy link
Member

See the README here: https://github.com/jupyter/notebook/tree/master/notebook/i18n

The framework is in place, but it's not really being used at present.

@jianzi123
Copy link
Contributor Author

@takluyver I make it work... and may push the zh-CN pot to the poject...

@jianzi123
Copy link
Contributor Author

@takluyver “setup.py extract_messages” need to get character encoding and ...some script to do other things like mkdir... and i think the most complicated thing is translation...

@takluyver
Copy link
Member

I don't think the setup.py extract_messages thing has been implemented, it looks like that's something the README is talking about adding in the future.

@JCEmmons someone is trying to use the translation machinery you added :-)

@JCEmmons
Copy link
Contributor

JCEmmons commented Aug 22, 2017 via email

@jianzi123
Copy link
Contributor Author

@takluyver i'm sorry to let you be confused about the implementation of setup.py extract_messages , and i think the bable cannnot automatically translate into other languages, and i translate the pot files from English to Chinese in my work... and i wish to push them to the project.
Thanks.

@takluyver
Copy link
Member

No worries! That matches my understanding - Pybabel is a tool for managing translations, but the actual translation work has to be done by humans.

Do you want to make a pull request? The code can't actually use your translations yet, but it will be good to have some to test with.

@jianzi123
Copy link
Contributor Author

i build the project in the development way, and find that before using the internationalization function i we should fix two place:

  1. add_ /i18n/LANG/... to url path;
  2. add lang para into gettext.translation() function in notebook/notebookapp.py;

@jianzi123
Copy link
Contributor Author

@takluyver could i make a pull request to add the translated files to some dir...?

@takluyver
Copy link
Member

Yup. The README says this is where to place them:

After the source material has been translated, you should have 3 PO files with the same base names as the POT files above. Put them in notebook/i18n/${LANG}/LC_MESSAGES, where ${LANG} is the language code for your desired language ( i.e. German = "de", Japanese = "ja", etc. ).

@gnestor
Copy link
Contributor

gnestor commented Oct 2, 2017

I just merged #2804. Thanks for contributing these translations @jianzi123 and thank you for getting things cleaned up and in working order @takluyver.

What do we need to do next in order to actually translate the UI?

@gnestor gnestor changed the title About i18n Add Chinese translation Oct 3, 2017
@JocelynDelalande
Copy link
Contributor

I cannot test the translations in current master.

I tried

LANG=zn jupyter notebook

and

LANG=zh_CN.UTF-8 jupyter notebook

(with current master)

but the interface is still in english.

What am i doing wrong ?

@gnestor
Copy link
Contributor

gnestor commented Oct 21, 2017

There is a still a piece missing to enable the translation in the UI.

@takluyver @JCEmmons Can you explain what that piece is? I will gladly work on it 👍

@takluyver
Copy link
Member

Being able to load the translations into the browser without having to transfer every language. I'm planning to work on it soon.

@gnestor gnestor added this to the 5.3 milestone Oct 23, 2017
@takluyver
Copy link
Member

#2969 is my effort on that front.

@JCEmmons
Copy link
Contributor

The thing that typically gets missed is adding a line to https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/i18nload.js to define which languages you might want to support. I'm pretty sure that the framework will only load those languages that you need, but this is required in order for the translated UI to work properly.

@takluyver
Copy link
Member

I experimented with that, and it appeared that all the translation strings specified like json!base/../../i18n/de/LC_MESSAGES/nbjs.json were being stuffed into the main.min.js bundle, so it would load all languages (meaning that it would transfer them from the server to the browser).

As such, #2969 gets rid of i18load.js in favour of an approach where the necessary Javascript string translations are added into the page by the template, so they're globally available before the main Javascript runs.

@damianavila
Copy link
Member

The PR was merged, is there anything else to discuss here?

@takluyver
Copy link
Member

Yup, this can be closed now. Thanks Damian!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants