bpo-31045: Language switch#2652
Conversation
|
@JulienPalard, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ezio-melotti, @birkenfeld and @ned-deily to be potential reviewers. |
Sorry, something went wrong.
|
Please don't merge it while we're missing some redirections like: https://docs.python.org/fr/ to https://docs.python.org/fr/3/, directory listings are ugly. |
Sorry, something went wrong.
9e21245 to
6f450c7
Compare
July 11, 2017 08:46
|
About "https://docs.python.org/py3k": IMHO this URL is redirected to https://docs.python.org/3/" before your Javascript is called, maybe using an Apache Rewrite rule or something like that. |
Sorry, something went wrong.
|
Yes I'll have to review all symlinks / redirections before merging this. I also think this can be enhanced like /3/ should probably be a redirection, not a symlink. |
Sorry, something went wrong.
This PR has been merged. |
Sorry, something went wrong.
|
Yes, I also removed the useless py3k from the regex as it's redirected server side, I'm now setting a full test environment locally to recheck everything, then I'll remove the WIP flag. |
Sorry, something went wrong.
|
Please open an issue at http://bugs.python.org/ and add its number in your PR title. |
Sorry, something went wrong.
|
I enhanced the fallback mechanism on unexisting translations, typically switching from I'll keep the [WIP] tag until 3.7 is built for french on production servers. |
Sorry, something went wrong.
|
3.7 now also successfully build on docs.python.org/fr/3.7/, I'm removing the [WIP] tag, from my point of view this can be merged. |
Sorry, something went wrong.
|
@JulienPalard now has access to server logs and so should be able to debug if something goes wrong. The PEP 545 has been approved and the change LGTM. Well, the code is not perfect, but it's not worse than before :-) It can be enhanced later if needed. |
Sorry, something went wrong.
* Doc: Indicate the language * Renaming version_switcher to switchers (to add language_switcher). * Adding language switch. * Doc switchers: Enhance readability of regex parsing versions. * Doc switchers: Desambiguate the need of a replace(/\/+$/g, '') by proper naming. * Doc switchers: py3k can't reach js, it's redirected server-side by nginx. * Doc switchers: Examples matching actual regexes. * Doc switchers: Better fallback on unexisting translated version. (cherry picked from commit dff9b5f)
* Doc: Indicate the language * Renaming version_switcher to switchers (to add language_switcher). * Adding language switch. * Doc switchers: Enhance readability of regex parsing versions. * Doc switchers: Desambiguate the need of a replace(/\/+$/g, '') by proper naming. * Doc switchers: py3k can't reach js, it's redirected server-side by nginx. * Doc switchers: Examples matching actual regexes. * Doc switchers: Better fallback on unexisting translated version. (cherry picked from commit dff9b5f)
* Doc: Indicate the language * Renaming version_switcher to switchers (to add language_switcher). * Adding language switch. * Doc switchers: Enhance readability of regex parsing versions. * Doc switchers: Desambiguate the need of a replace(/\/+$/g, '') by proper naming. * Doc switchers: py3k can't reach js, it's redirected server-side by nginx. * Doc switchers: Examples matching actual regexes. * Doc switchers: Better fallback on unexisting translated version. (cherry picked from commit dff9b5f)
* Doc: Indicate the language * Renaming version_switcher to switchers (to add language_switcher). * Adding language switch. * Doc switchers: Enhance readability of regex parsing versions. * Doc switchers: Desambiguate the need of a replace(/\/+$/g, '') by proper naming. * Doc switchers: py3k can't reach js, it's redirected server-side by nginx. * Doc switchers: Examples matching actual regexes. * Doc switchers: Better fallback on unexisting translated version. (cherry picked from commit dff9b5f)
This is the implementation of this step from the PEP 545: make a language switcher in the doc, it looks like this:
I tried hard to make this robust, as there's now many cases, and readable, but my JS-foo is old...
I used
Object.keyswhich is not compatible before IE 9, but according to a grep sphinx uses underscore.js which seems to use it too so it looked OK but tell me if it is not.https://bugs.python.org/issue31045