timvink / mkdocs-git-revision-date-localized-plugin

MkDocs plugin to add a last updated date to your site pages
https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html
MIT License
208 stars 45 forks source link

[Bug] The timeago is displayed incorrectly #142

Closed Xiaokang2022 closed 2 months ago

Xiaokang2022 commented 3 months ago

mkdocs-git-revision-date-localized-plugin: 1.2.7

I noticed that version 1.2.7 fixed a related bug, but it still has a bug.

Here's a part of my mkdocs.yml:

theme:
  name: material
  language: zh

plugins:
  - git-revision-date-localized:
      type: timeago

According to https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/howto/specify-locale/, the timeago should shows as zh, but it still shows as en.

I have to specify the locale explicitly. This is not as described in the documentation.

Xiaokang2022 commented 3 months ago

Hopefully this bug can be fixed soon.

Xiaokang2022 commented 2 months ago

I forked the repository and created a PR to try and fix the problem: #143

timvink commented 2 months ago

I see.

so mkdocs specifies a theme: locale parameter (https://www.mkdocs.org/user-guide/localizing-your-theme/) while mkdocs-material uses theme: language (https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language)

Tested the PR and it works.

Probably under the hood mkdocs has started defining a locale default, and this it was not none. Thanks for fixing!