-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Preliminary i18n implementation as outlined in Jep16 #2140
Conversation
Thanks for working on this! I'm aiming to release 5.0 soon (hopefully this week), so I think this will probably miss that release, but I'd like to try to get it in for 5.1. |
What's the time schedule re: 5.1? I would like to have some real target
dates to shoot for....
Regards,
John C. Emmons
Globalization Architect & Unicode CLDR TC Chairman
IBM Software Group
Internet: emmo@us.ibm.com
From: Thomas Kluyver <notifications@github.com>
To: jupyter/notebook <notebook@noreply.github.com>
Cc: John Emmons/Austin/IBM@IBMUS, Author <author@noreply.github.com>
Date: 02/06/2017 03:55 PM
Subject: Re: [jupyter/notebook] Preliminary i18n implementation as
outlined in Jep16 (German) (#2140)
Thanks for working on this!
I'm aiming to release 5.0 soon (hopefully this week), so I think this will
probably miss that release, but I'd like to try to get it in for 5.1.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
We don't really have a schedule for releases, I'm afraid. If the changes in 5.0 cause some problems we need to fix, there might be a 5.1 in a couple of weeks, but in that case most of the new features planned for 5.1 would be targeted to 5.2 instead. If you want some target dates, I'd hope to have the JEP and this infrastructure merged by the end of the month. |
How do we go about making this so it can be merged? I've still got a few small things that can be worked on here, but the vast majority of the work here is complete. Please advise. |
Still waiting.... @takluyver can you comment pls? |
|
Any help you can give would be appreciated......
Regards,
John C. Emmons
Globalization Architect & Unicode CLDR TC Vice Chairman
IBM Globalization Team
e-mail: emmo@us.ibm.com
From: Thomas Kluyver <notifications@github.com>
To: jupyter/notebook <notebook@noreply.github.com>
Cc: John Emmons/Austin/IBM@IBMUS, Author <author@noreply.github.com>
Date: 04/03/2017 12:59 PM
Subject: Re: [jupyter/notebook] Preliminary i18n implementation as
outlined in Jep16 (German) (#2140)
We're still getting notebook 5.0 out, so this has been waiting for that to
happen.
There are merge conflicts now - can you rebase the branch on master? If
you're not familiar with rebasing, I can provide a brief outline of how I
usually do it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
To rebase and resolve merge conflicts, I usually:
|
I'll work on the travis-ci failures next week. |
notebook/notebookapp.py
Outdated
@@ -969,7 +972,7 @@ def _notebook_dir_validate(self, proposal): | |||
# If we receive a non-absolute path, make it absolute. | |||
value = os.path.abspath(value) | |||
if not os.path.isdir(value): | |||
raise TraitError("No such notebook dir: %r" % value) | |||
raise TraitError(_("No such notebook dir: %r") % value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately here the convention of using _
for translatable strings has clashed with the Python convention of using _
for a variable that won't be used.
I'm looking at the logs from the js tests in Travis CI, and I have no idea how to go about debugging here. Can someone shed some light on what might be going on? |
😕 the errors look like this - anyone got any ideas?
|
Aha, I've found the issue. You've got |
Thanks @takluyver for your help! That's what happens when you try to refactor things..... |
The tests are now producing a whole lot of |
It's tough to test this myself, since the tests don't seem to be very
friendly on Windows. I'll keep working it, thanks.
From: Thomas Kluyver <notifications@github.com>
To: jupyter/notebook <notebook@noreply.github.com>
Cc: John Emmons/Austin/IBM@IBMUS, Author <author@noreply.github.com>
Date: 04/24/2017 03:33 PM
Subject: Re: [jupyter/notebook] Preliminary i18n implementation as
outlined in Jep16 (German) (#2140)
The tests are now producing a whole lot of ReferenceError: Can't find
variable: utils [object Arguments]
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Even without running the tests, you may be able to trigger some of these errors by running the notebook in a browser with the Javascript console open. |
It would be really nice if we could go ahead and get this merged, as I'm getting tired of resolving merge conflicts. |
Sorry for the delay @JCEmmons . It's the end of the day over here now, but I'll try to have a look at this tomorrow. |
Sorry, most of today got taken up working on Windows packaging of some magnetic simulation code. I haven't forgotten about this, though. |
"X-Generator: Poedit 1.8.11\n" | ||
|
||
msgid "The Jupyter Notebook requires tornado >= 4.0" | ||
msgstr "Der Jupyter Notizblock erfordert Tornado >= 4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd treat 'Notebook' as part of a name and not translate it. Likewise 'Widgets' a few lines below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moot since we're removing the machine translated German.
" This launches a Tornado based HTML Notebook Server that serves up an " | ||
"HTML5/Javascript Notebook client." | ||
msgstr "" | ||
"Die Jupyter HTML Notebook.n n dies startet einen tornadobasierten HTML " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newlines have been converted to n
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moot since we're removing the machine translated German. This was an artifact of our old MT engine.
|
||
msgid "Set the Access-Control-Allow-Credentials: true header" | ||
msgstr "" | ||
"Setzen Sie die Zugangskontrolle erlauben Sie Ausweispapiere: Wahre Überschrift" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Access-Control-Allow-Credentials
shouldn't be translated again - the HTTP protocol uses English words whatever the locale of the user is.
I know the translations aren't the focus here, but if we're going to merge it with German translations in, I think it's worth doing a bit of basic QA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moot since we're removing the machine translated German.
msgstr "Ob, dem Benutzer zu erlauben, den Notizblock als Wurzel zu führen." | ||
|
||
msgid "The default URL to redirect to from `/`" | ||
msgstr "Die versäumte URL, zu der man umleiten kann, von" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The /
has gone missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moot since we're removing the machine translated German.
msgstr "Die Akte, wo das Keksgeheimnis gespeichert wird." | ||
|
||
msgid "Writing notebook server cookie secret to %s" | ||
msgstr "Notizblockserverkeksgeheimnis auf %s schreiben" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My German coworker is laughing uproariously at this translation. I think that while 'keks' is the translation of an edible cookie, an HTTP cookie is called a cookie.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Machine translation can be amusing at times...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moot since we're removing the machine translated German.
notebook/static/base/js/dialog.js
Outdated
@@ -86,7 +86,7 @@ define(function(require) { | |||
var button = $("<button/>") | |||
.addClass("btn btn-default btn-sm") | |||
.attr("data-dismiss", "modal") | |||
.text(label); | |||
.text(i18n.translate(label).fetch()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these labels be translated where they're defined, rather than here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why this is in place now. I'd still like to find a way to avoid duplicating the button labels in the files where they are defined, but that needn't be solved in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's kind of confusing until you understand the dialog.js code, but it does work properly, as long as you have the button labels defined properly.
notebook/static/base/js/i18n.js
Outdated
'jed', | ||
'moment', | ||
'json!../../../i18n/nbjs.json', | ||
'json!../../../i18n/de/LC_MESSAGES/nbjs.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to only load the data for languages that are needed, rather than pre-loading everything before selecting one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is, but it usually requires writing a JS plugin in order to do it. I've run into a similar problem in other projects I have worked on. What you really want here is a synchronous load, which is kind of a no-no in JS these days. It can be done, and I'm willing to contribute it if/when people actually need a real translation done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's possible to use require in a way that it doesn't fail if it can't find a module? It looks like we can get the language code from navigator
before we call define()
, so we could stick it into a URL - but we don't know at that point if we're asking for a supported language.
I think I'd like to get this worked out before we merge the translation machinery - sorry for another delay, but loading the messages seems pretty fundamental, and the current mechanism is one we know we'll need to replace.
The json!
thing is pretty neat, though - I didn't know about that before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - it required a bit of reworking, but I finally got this to work. What you will see is a new plugin called i18nload that loads the appropriate JSON data, and then a promise called msg_promise that is returned. Once msg_promise is resolved, then you can retrieve i18n messages as normal. If a supported translation is not requested or not available, then the promise will resolve with just the default data, and everything works the same as before....
notebook/static/base/js/namespace.js
Outdated
|
||
// deprecated since 4.0, remove in 5+ | ||
var IPython = Jupyter; | ||
// Copyright (c) Jupyter Development Team. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the diff showing that this whole file has been changed, when it looks like most of it hasn't? This would mess up tools like git blame
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure... Looks like just formatting diffs between spaces/tabs. I will replace with the old version in my next commit.
@JCEmmons thanks for addressing the review! I think this is in good shape to merge, with one exception I just noticed while testing this out locally: Some of the changes here have mixed in some tab indentation instead of spaces, and added Windows CRLF line endings in a few places. This is part of why the diff on a few files looks so large. You can tell git to handle CRLF automatically with:
to avoid this sort of problem in the future. If you check the "Allow edits from maintainers" box on the right: I can do the last conflict resolution and fix these little things and get this merged. Or you can pull from my branch, if you prefer. |
Hi @minrk and thanks.... Allow edits from maintainers is already enabled, so if you can handle the last merge conflict and do the merge I would appreciate it greatly!!! Thanks...... |
wrong call signature in a few cases
We can continue to iterate on this in master as things come up. Thanks for your work and patience! |
Due to the issues with line endings and whitespace changes, I chose to squash this PR rather than deal with a complicated rebase. Hopefully we can catch similar issues earlier in subsequent PRs. |
Hi @JCEmmons! I'm about to publish a release candidate for notebook 5.1 and I noticed the following error when opening a new terminal (in the Jupyter Notebook): Does this make sense to you? |
Somewhat.... It appears that it's not finding Jed.js, which is now a
requisite package. It appears that jed 1.1.1 never made it into the
bower.json, which would explain the error.
Regards,
John C. Emmons
Globalization Architect & Unicode CLDR TC Vice Chairman
IBM Globalization Team
e-mail: emmo@us.ibm.com
From: 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: 08/07/2017 04:07 PM
Subject: Re: [jupyter/notebook] Preliminary i18n implementation as
outlined in Jep16 (#2140)
Hi @JCEmmons! I'm about to publish a release candidate for notebook 5.1
and I noticed the following error when opening a new terminal (in the
Jupyter Notebook):
Does this make sense to you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'm even seeing this in master 🤔 I don't see this when opening notebooks, just terminals. |
I'm seeing the same missing jed error breaking the jupyter_nbextensions_configurator standalone page at Jupyter-contrib/jupyter_nbextensions_configurator#43, using a pip-installed notebook 5.1.0 😢 |
I wanted to get a preliminary PR out here for you all to take a look at so you can see the current progress and also so I can get some help on some of the issues. Please read the i18n README on this branch for instructions on how to get started.
This is still a work in progress, and I am not a professional translator, so I don't claim everything to be perfect just yet. Take a look and let me know what you think.