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

Is there any way to support cookie consent translation #191

Closed
icebilly opened this issue Feb 17, 2023 · 7 comments
Closed

Is there any way to support cookie consent translation #191

icebilly opened this issue Feb 17, 2023 · 7 comments
Assignees

Comments

@icebilly
Copy link

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 ultrabug self-assigned this Feb 17, 2023
@ultrabug
Copy link
Owner

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
Copy link
Sponsor

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
Copy link
Owner

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
Copy link
Sponsor

No, this is nothing we plan to integrate.

@icebilly
Copy link
Author

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
Copy link
Owner

@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
Copy link
Owner

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!

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

No branches or pull requests

3 participants