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

Partial translation #73

Closed
jrappen opened this issue Jan 25, 2022 · 9 comments
Closed

Partial translation #73

jrappen opened this issue Jan 25, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@jrappen
Copy link

jrappen commented Jan 25, 2022

I have this test site:

where my last commit to main was built with:

image

and pages with the German language have footers of this plugin only partially translated:

image

Any feedback as to why this happens?

@jrappen
Copy link
Author

jrappen commented Jan 25, 2022

I assume this is due to the use of mkdocs-static-i18n in combination with this plugin?

@timvink
Copy link
Owner

timvink commented Jan 26, 2022

Hi @jrappen 👋🏻 ,

I assume you're using the mkdocs-material theme, which has a native integration for this plugin. That means you didn't have to bother with making a theme override (see the docs how to/customize a theme for details).

If you look at https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/source-file.html you should notice these two lines:

      {{ lang.t("source.file.date.updated") }}:
      {{ page.meta.git_revision_date_localized }}

That means the label "Letzes Update" is provided by mkdocs-material, and depends on the language you set in your theme (see changing the language).

You now have two options:

  1. Either customize the theme, and write whatever you'd like.
  2. Update the translations from mkdocs-material by updating these two lines and providing a better German translation.

1) is a quick fix and 2) is a long term solution I think the community would appreciate the most ;)

@jrappen
Copy link
Author

jrappen commented Jan 26, 2022

@timvink My question was rather, why the first part was translated but not the second.

@timvink
Copy link
Owner

timvink commented Jan 26, 2022

Not sure I understand your question then. These are the translations you show:

image

They come from this translation file:

  "source.file.date.updated": "Letztes Update",
  "source.file.date.created": "Erstellt",

I don't speak German. I have contributed those lines to mkdocs-material by using google translate (see squidfunk/mkdocs-material@cee1eb4).

If you have better translation, either if you make a PR to mkdocs-material yourself, or let me know what the translation is and I'll do it :)

@jrappen
Copy link
Author

jrappen commented Jan 26, 2022

@timvink Anything after the colon, as "2 months ago" in this case, isn't translated. It remains in English.

@timvink
Copy link
Owner

timvink commented Jan 26, 2022

Ohhh I see, I thought the second part was the Erstellt: 2 month ago that was not translated properly.

I looked at your website, and changing language: en to language: de here should solve it:
https://github.com/jrappen/recipes/blob/c67e90f1500fad82e2a7d6c55b053c9278f103f2/mkdocs.yml#L18

I think the core issue is that this plugin does not support the mkdocs-static-i18n plugin, more specifically, there's no support for defining the lang: de in the YAML frontmatter as you do f.e. here: https://raw.githubusercontent.com/jrappen/recipes/main/docs/src/markdown/cookies.de.md

That should be there. I'll look into it next time I work on the plugin, probably somewhere next weekend.

@timvink timvink added the enhancement New feature or request label Jan 26, 2022
@jrappen
Copy link
Author

jrappen commented Jan 26, 2022

@timvink Changing from theme: language:en to theme: language: de will only fix it for German pages, but probably break it for English pages as a result. I assume this is because @squidfunk 's mkdocs-material theme only accepts a "global" language setting for the whole site.

@timvink
Copy link
Owner

timvink commented Jan 26, 2022

Yes, this plugin also only supports a global language setting. I will build in support for per-page language setting.

@timvink
Copy link
Owner

timvink commented Feb 21, 2022

I implemented support for the i18n plugin in #83 and just released it in v1.0.0. This should fix your partial translation issue also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants