lxndrblz / anatole

Anatole is a minimalistic two-column theme for Hugo.
https://themes.gohugo.io/themes/anatole/
MIT License
651 stars 363 forks source link

Missing translation on "series" page #369

Closed McPringle closed 2 years ago

McPringle commented 2 years ago

Describe the bug Today I enabled the series taxonomy in my multi-language blog and recognized the heading "Posts in this Series" is not translated.

To Reproduce Steps to reproduce the behavior:

  1. Enabled the series taxonomy
  2. Go to a blog post that is part of a series
  3. Scroll down to the end of the page
  4. See hard-coded text "Posts in this Series"

Expected behavior I would expect to use the translation from the file themes/anatole/i18n/xx.toml where xx is the code of the actual language.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Translation for german (de): "Beiträge in dieser Serie"

McPringle commented 2 years ago

For now, I use a dirty hack that might be of interest to other users:

/* Temporary fix for https://github.com/lxndrblz/anatole/issues/369  */
if (window.location.pathname.startsWith("/de/")) {
    document.addEventListener('DOMContentLoaded', (event) => {
        Array.from(document.getElementsByTagName("h3")).forEach(function (element) {
            if (element.innerHTML === "Posts in this Series") {
                element.innerHTML = "Beiträge in dieser Serie";
            }
        });
    });
}

It's not nice but at least it works (for most users, if they have JavaScript enabled on my domain).

lxndrblz commented 2 years ago

@McPringle Thanks for pointing this out. I agree, this should be added to the translation files.

McPringle commented 2 years ago

Wow, that was quick! Thank you very much!