ultrabug / mkdocs-static-i18n

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

i18n_page_locale not available when missing in lunr.js? #242

Closed buttle closed 11 months ago

buttle commented 11 months ago

Hi,

Recently (like 3 days ago) I started setting up a doc site with mkdocs-material and mkdocs-static-i18n for languages en, es, ca, eu

Yesterday I upgraded to 1.0.0.

Before upgrading I have used i18n_page_locale in overrides/patials/footer.html to translate content. (though 'eu' fell back to 'en'. I suppose because it isn't one of mkdocs-material's langauges). However, eu docs did work fine with the language switcher. Cool!

Now after upgrading I'm seeing this.

  1. When viewing 'ca', i18n_page_locale in the footer falls back to default (en). I think this might be because 'ca' is not supported by lunr.js ?
  2. Declaring 'eu' like so throws an error
    reconfigure_material: true
    reconfigure_search: true
    languages:
    - locale: eu
        name: Euskara
        build: true
    - locale: en
       default: true
       ...

    jinja2.exceptions.TemplateNotFound: partials/languages/eu.html

To summarize

ca is an available language for mkdocs-material but not for lunr.js eu is not an available language for either mkdocs-material nor lunr.js

before the upgrade to 1.0.0 I could render 'ca' translations in the footer (now I can't), and I could use 'eu' in the language switcher (now I can't).

We intended to contribute the eu translation to mkdocs-markdown, so when that's done it seems it will solve the jinja2 exception. But the once available and now missing i18n_page_locale would be nice to have back.

Thank you for your time and effort. :)

ultrabug commented 11 months ago

Hello @buttle thanks for your kind words.

Do you have a repository I can use to reproduce the problem? That's the best way I can help you.

Thanks

buttle commented 11 months ago

Sure! https://gitlab.com/liberaforms/docs.liberaforms.org

ultrabug commented 11 months ago

Ok @buttle I understood the problem, it's my mistake where I apparently changed the meaning of the i18n_page_locale context variable!

I added back the file locale context var and updated the docs, this is going to be released within the next minutes as 1.0.2

buttle commented 11 months ago

Good news! Much appreciated.