-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Sitemap hreflang syntax invalid for regional language variants fix #5638
Sitemap hreflang syntax invalid for regional language variants fix #5638
Conversation
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 we need to figure out another approach to this problem since we can't change the LANGUAGES
constant because it's used for URLs and Sphinx as well as language form validation.
readthedocs/projects/constants.py
Outdated
('es-MX', 'Mexican Spanish'), | ||
('uk-UA', 'Ukrainian'), | ||
('zh-CN', 'Simplified Chinese'), | ||
('zh-TW', 'Traditional Chinese'), |
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 think we can change this.
LANGUAGES
is used for URLs, and by changing this constant we will be breaking many URLs. Also, these constant matches the language=
setting from Sphinx.
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.
@humitos we can add a method to sitemap_xml
view to change the lang if its not in the correct format. somthing like if lang == 'zh_CN': return 'zh-CN'
. It would be a hacky process though. What do you think we can do 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.
Sounds hacky, but good enough to me considering that it's what we need and it's encapsulated inside the sitemap_xml
.
Is the only thing that needs to be replaced _
by -
? Did you check the sitemap reference?
What about the rest of the values? are they valid?
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.
@humitos yes, we only need to replaced _
by -
. Updated the PR please have a look.
Thanks! |
closes #5446