-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Refactor switchers.js #225
Conversation
The placeholders have been in the theme since v2021.5
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 haven't checked everything in detail, but what I saw LGTM.
if (_IS_LOCAL) return; | ||
|
||
const selected_version = event.target.value; | ||
// English has no language prefix. |
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 related to this PR, but I read through PEP 545 – Python Documentation Translations this weekend and it says:
http://docs.python.org/en/ will redirect to http://docs.python.org/.
Currently /en/
is 404, I wonder if we should add this redirect or if it was decided to be unnecessary?
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've also seen that, though I never got around to updating the PEP. I think that we should remove it from the PEP as something that was never implemented, rather than adding another set of redirects to maintain.
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 don't know how many people try /en/
, but fine by me. And the PEP should probably Process/Active rather than Process/Final.
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.
See python/peps#4093
// 1. The current page in the current language with the new version | ||
// 2. The current page in English with the new version | ||
// 3. The documentation home in the current language with the new version | ||
// 4. The documentation home in English with the new version | ||
_navigate_to_first_existing([ | ||
window.location.href.replace(_CURRENT_PREFIX, new_prefix), | ||
window.location.href.replace(_CURRENT_PREFIX, new_prefix_en), | ||
new_prefix, | ||
new_prefix_en, |
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'm wondering if it would be better to stick in the current language, even if that means going back to the homepage?
It might be surprising to switch to a completely different language set; as you navigate further everything is English and not your chosen language.
And I think different languages should nearly always have the same structure and same pages for any given version? (Although with some untranslated pages.)
That would mean:
// 1. The current page in the current language with the new version | |
// 2. The current page in English with the new version | |
// 3. The documentation home in the current language with the new version | |
// 4. The documentation home in English with the new version | |
_navigate_to_first_existing([ | |
window.location.href.replace(_CURRENT_PREFIX, new_prefix), | |
window.location.href.replace(_CURRENT_PREFIX, new_prefix_en), | |
new_prefix, | |
new_prefix_en, | |
// 1. The current page in the current language with the new version | |
// 2. The documentation home in the current language with the new version | |
// 3. The current page in English with the new version | |
// 4. The documentation home in English with the new version | |
_navigate_to_first_existing([ | |
window.location.href.replace(_CURRENT_PREFIX, new_prefix), | |
new_prefix, | |
window.location.href.replace(_CURRENT_PREFIX, new_prefix_en), | |
new_prefix_en, |
But I'm really not sure. Might be worth asking people who regularly uses the docs in another language?
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.
Shall we create an issue for this? The intent in this PR was for as few behavioural changes as possible (the ideally none!).
Although, the current order does have some logic, given that a reader probably prefers to have the information (which can be translated via browser tools, Google, etc) rather than always being sent to the homepage for a language that doesn't have much translation coverage.
(Also, this order was chosen by a French-speaker!)
A
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 asked in the Docs Discord: https://discord.com/channels/935215565872693329/935215566334079058/1300710927531905084
I'll merge this tomorrow so that I can keep an eye on builds (unless anyone would prefer we delay) A |
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'll merge this tomorrow so that I can keep an eye on builds (unless anyone would prefer we delay)
A
That's fine, we can easily adjust the order later if needed. Thanks!
4d90665
to
8cb6706
Compare
Force-push diff (added logging for |
#233 to fix. |
Map
over object literals)file:
URIs)A