ultrabug / mkdocs-static-i18n

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

Is there any way to support cookie consent translation #191

Closed icebilly closed 1 year ago

icebilly commented 1 year ago

hi, we use materia for mkdocs, use google analytics as well, it seems the mkdocs-static-i18n plugin not support translation these content yet. image

ultrabug commented 1 year ago

Hi @icebilly

My first impression here is that this plugin can't be expected to support the translation of every theme/plugin out there but since we're talking about mkdocs-material specifically and that I know that Martin cares, I'd like to kindly ask him his take on this.

@squidfunk Hello, do you have plans or don't you think that this kind of translations should fall into mkdocs-material's own localization support please?

squidfunk commented 1 year ago

The cookie consent is already fully localizable.


The title and description (= body) of the cookie consent can be set via mkdocs.yml:

extra:
  consent:
    title: Cookie consent
    description: >- 
      We use cookies to recognize your repeated visits and preferences, as well
      as to measure the effectiveness of our documentation and whether users
      find what they're searching for. With your consent, you're helping us to
      make our documentation better.

The cookies themselves can also be changed/translated:

extra:
  consent:
    cookies:
      analytics: Custom name

The buttons are localized via our regular translation system, e.g. for French:

  ...
  "consent.accept": "Accepter",
  "consent.manage": "Paramétrer vos choix",
  "consent.reject": "Refuser",
  ...

All parts of Material for MkDocs are localizable. I'm not sure how the localization approach that is implemented in this plugin must be adjusted, but if you build separate sites and link them with the language selector, everything works out-of-the-box (without using this plugin). I understand that this plugin offers some niceties that make localization simpler, but I haven't used it, so I can't really say what would be necessary to add support here.

ultrabug commented 1 year ago

Thanks for confirming about the support for localization.

This plugin does build the same site for each configured language using a single mkdocs.yml file. It does already set the lang option of mkdocs-material so indeed the buttons get localized for each site version without problem, I just tested it.

I guess @icebilly wants a way to be able to translate the actual title and description of the cookie consent of material within a single mkdocs.yml file.

If I understand the documentation and your comment correctly, this is thus not feasible from a mkdocs-material perspective right?

squidfunk commented 1 year ago

No, this is nothing we plan to integrate.

icebilly commented 1 year ago

yes, the title and the description are what we want to translate, currently we use separated projects for different languages, so we can translate them in different projects, since we are now try to use mkdocs-static-i18n to enhance our mkdocs projects management, it's better to have them translated in one project. Anyway, it's depend on your plans.

ultrabug commented 1 year ago

@icebilly hi, I would like to point out that the upcoming 1.0.0 version of this plugin will allow you to override any part of the mkdocs.yml config per language as described in #216

If you are interested to give it a try, I'd appreciate some feedbacks on the mentioned PR

Thanks!

ultrabug commented 1 year ago

I'm happy to announce release v1.0.0 of the mkdocs-static-i18n plugin!

Please check it out since you can now override every part of the mkdocs.yml :) This is thus now possible!