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

Work on loading UI translations#2969

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 8 commits intojupyter:masterfromtakluyver:i18n-loading
Oct 31, 2017
Merged

Conversation

@takluyver
Copy link
Member

To test: setzh-CN to the most preferred language in browser preferences, then launch the notebook with the LANG environment variable set, i.e.LANG=zh_CN jupyter notebook.

screenshot from 2017-10-23 16-01-42

  • Only transfers translations for languages the user wants.
  • (For strings used in JS) can handle multiple fallbacks - e.g. an Afrikaans speaker could request Afrikaans > Dutch > English, and get each translation in the best available language.

Writing the translation JSON into the template and storing it as a JS global seems a bit ugly, but it ensures that the data is there before any Javascript strings are used, without either bundling data for all languages into the JS bundle, or trying to do clever things with requirejs.

The biggest thing that I'm not happy about is that the language for the JS is determined by the browser, and the language for the template strings by an environment variable in the server. If you only set one, you see half the strings translated, with no obvious reason for the difference. Using the browser header seems better, and it allows for multiple fallbacks, but there isn't an obvious way to use that withjinja2.ext.i18n.

gnestor and lokinell reacted with thumbs up emoji
@takluyvertakluyver added this to the5.3 milestoneOct 23, 2017
@takluyver
Copy link
MemberAuthor

The remaining failure on Appveyor appears to be an unrelated problem with installing nbconvert from conda-forge.

@takluyvertakluyver mentioned this pull requestOct 24, 2017
@JocelynDelalande
Copy link
Contributor

To test: set zh-CN to the most preferred language in browser preferences, then launch the notebook with the LANG environment variable set, i.e. LANG=zh_CN jupyter notebook.

Just tested, it does work. Thanks :-)

Note : there is no fallback within a same lang (maybe this is normal behavior) : if I set browser lang tozh, it will never load thezh-CN translation.

@takluyver
Copy link
MemberAuthor

Yeah, I think we should probably renamezh_CN to justzh, and introduce an automatic fallback when loading so that if you specifyzh_CN, it will usezh as well. But I think those can be in future PRs: I just wanted to get the translations working first.

@gnestor
Copy link
Contributor

Great work,@takluyver!! I tried testing and I'm seeing the translations that depend on the browser's language (working in both Chrome and Firefox) but I'm not seeing the translations that depend on the environment variables. I'm usingLANG=zh_CN jupyter notebook to run the notebook server... 🤔

@takluyver
Copy link
MemberAuthor

I'm not sure what's going on there - maybe there are other environment variables besides LANG that affect it? I'm inclined to get this merged and keep iterating.

@gnestor
Copy link
Contributor

Ok let's do it 👍

@hikui
Copy link

Hi@takluyver, the translation doesn't work in the release version. I noticed that.mo andnbjs.json files are gitignored and there's no corresponding compiling process in the setup.py?

I had to manually follow the README and compiled my own version of end files to make the translation work. Perhaps we should keep .mo and nbjs.json files?

JocelynDelalande reacted with thumbs up emoji

@takluyver
Copy link
MemberAuthor

There's an issue for someone to integrate the steps to build the translations:#3102

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsMar 31, 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.3

Development

Successfully merging this pull request may close these issues.

4 participants

@takluyver@JocelynDelalande@gnestor@hikui

[8]ページ先頭

©2009-2025 Movatter.jp