Skip to content
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

Language code might differ from RSS Spec #176

Closed
YDX-2147483647 opened this issue Mar 9, 2023 · 1 comment · Fixed by #178
Closed

Language code might differ from RSS Spec #176

YDX-2147483647 opened this issue Mar 9, 2023 · 1 comment · Fixed by #178
Labels
compliance Compliance with the RSS standard and its extensions

Comments

@YDX-2147483647
Copy link
Contributor

Example

Note: RSS also accepted lowercase en-us.

Explaination

  • theme.locale of Mkdocs basically uses ISO-639-1 2-letter abbreviation (en), and may also include a territory suffix (_US).
  • And the language code in RSS follows W3C / RFC 1766 / full ISO-639. I guess it's consistent with HTML, which follows RFC 5646 (a newer version of RFC 1766).

Additionally, you can't write hyphen (en-US) in mkdocs.yml.

$ mkdocs build
ERROR    -  Config value 'theme': Invalid value for locale: expected only letters, got 'en-US'
Aborted with 1 Configuration Errors!

Possible fix

(I can turn it into a PR if you want)

Change the following line in .util.Util.guess_locale

return mkdocs_config.get("theme")._vars.get("locale")

to

locale = mkdocs_config.get("theme")._vars.get("locale")
return f"{locale.language}-{locale.territory}"
@Guts
Copy link
Owner

Guts commented Mar 9, 2023

Nice catch!

(I can turn it into a PR if you want)

Please, feel free!

@Guts Guts added the compliance Compliance with the RSS standard and its extensions label Mar 9, 2023
YDX-2147483647 added a commit to YDX-2147483647/mkdocs-rss-plugin that referenced this issue Mar 10, 2023
@Guts Guts closed this as completed in #178 Mar 23, 2023
Guts added a commit that referenced this issue Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compliance Compliance with the RSS standard and its extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants