ultrabug / mkdocs-static-i18n

MkDocs i18n plugin using static translation markdown files
https://ultrabug.github.io/mkdocs-static-i18n/
MIT License
219 stars 37 forks source link

no Language code causing issues #281

Closed adamERPAPPS closed 8 months ago

adamERPAPPS commented 8 months ago

This may be me being stupid.

I am trying to build the no (Norsk) language (already have en and sv) and I have an issue.

If I declare in the yml as:

- locale: no name: Norsk build: true

This then causes: ERROR - Config value 'plugins': Plugin 'i18n' option 'languages': Sub-option 'locale': Expected type: <class 'str'> but received: <class 'bool'> Aborted with 1 configuration errors!

If I change it to a string (sign either ' or " )

- locale: "no" name: Norsk build: true

then this causes:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/mkdocs/livereload/__init__.py", line 193, in _build_loop func() File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 67, in builder build(config, live_server=None if is_clean else server, dirty=is_dirty) File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 354, in build config.plugins.on_post_build(config=config) File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 542, in on_post_build return self.run_event('post_build', config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 509, in run_event result = method(**kwargs) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/mkdocs_static_i18n/plugin.py", line 195, in on_post_build build(config, dirty=dirty) File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 340, in build _build_theme_template(template, env, files, config, nav) File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 110, in _build_theme_template output = _build_template(template_name, template, files, config, nav) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 89, in _build_template output = template.render(context) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "/usr/local/lib/python3.11/site-packages/material/404.html", line 4, in top-level template code {% extends "main.html" %} File "/usr/local/lib/python3.11/site-packages/material/main.html", line 4, in top-level template code {% extends "base.html" %} File "/usr/local/lib/python3.11/site-packages/material/base.html", line 4, in top-level template code {% import "partials/language.html" as lang with context %} ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1405, in make_module return TemplateModule(self, ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1535, in __init__ body_stream = list(template.root_render_func(context)) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/material/partials/language.html", line 4, in top-level template code {% import "partials/languages/" ~ config.theme.language ~ ".html" as lang %} ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/loaders.py", line 218, in get_source raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: partials/languages/no.html ERROR - [13:29:00] An error happened during the rebuild. The server will appear stuck until build errors are resolved.

adamERPAPPS commented 8 months ago

Use NN instead