Skip to content

tox translation build: add tests for lunr.js language support#2564

Closed
ultrabug wants to merge 4 commits intomkdocs:masterfrom
ultrabug:translation_check_lunr
Closed

tox translation build: add tests for lunr.js language support#2564
ultrabug wants to merge 4 commits intomkdocs:masterfrom
ultrabug:translation_check_lunr

Conversation

@ultrabug
Copy link
Copy Markdown
Member

@ultrabug ultrabug commented Sep 7, 2021

this should avoid forgetting that a locale added to mkdocs theme
translations should be supported by lunr.js to work

this should avoid forgetting that a locale added to mkdocs theme
translations should be supported by lunr.js to work
@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Sep 7, 2021

@oprypin I intend to revert #2497 and merge this in 2 days

@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Sep 7, 2021

Unless we want to disable the search plugin for missing locales with a WARNING log instead of crashing like mad?

@oprypin

This comment was marked as abuse.

@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Sep 8, 2021

mkdocs-material does crash if you select a language it does not support

  File "/home/alexys/venv/ultrabug.fr/lib/python3.9/site-packages/material/partials/language.html", line 4, in top-level template code
    {% import "partials/languages/" ~ config.theme.language ~ ".html" as lang %}
  File "/home/alexys/venv/ultrabug.fr/lib/python3.9/site-packages/jinja2/loaders.py", line 197, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: partials/languages/pp.html

update tox lunr.js check to only warn and not fail the CI
@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Sep 8, 2021

With latest commit, the search plugin will only WARN on unsupported lang configuration:

WARNING  -  Ignoring search.lang "ezn" as it is not a supported language code.
WARNING  -  Ignoring search.lang "coco" as it is not a supported language code.

Removing the offending locales from the search.lang config is fine since this config option allows to be empty and falls back to english anyway.

I've made the tox CI to WARN as well but not fail the CI when a lunr locale is missing.

If you're okay with this, I'll update the tests accordingly

@oprypin

This comment was marked as abuse.

@ultrabug
Copy link
Copy Markdown
Member Author

ultrabug commented Oct 8, 2021

Moved to #2602

@ultrabug ultrabug closed this Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants