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

i18n: add translation for default taxonomies #528

Closed
postb99 opened this issue May 18, 2023 · 5 comments
Closed

i18n: add translation for default taxonomies #528

postb99 opened this issue May 18, 2023 · 5 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@postb99
Copy link

postb99 commented May 18, 2023

Hello,

In addition to tags taxonomy, I configured categories taxonomy in my website, and copied layout/partials/tags.html to layout/partials/categories.html, replacing "tags" by "categories" and "tag" by "category".
Then I noticed than in French, we don't use the same word for "category" as in English, unlike "tag" where we also use "tag".

My question is about the pages that lists all pages of a given tag/category: the layout/partials/_taxonomy.html template is used. I would like to get the "tag"/"category" word present in title in my display language, so changed line 7 to the following, adding "i18n":

{{- $title = printf "%s %s " (i18n .Data.Singular | humanize) (default "::" .Site.Params.titleSeparator) }}

Then in every .toml language file (I guess really in each...) I would need to declare a new term else there is no word displayed:

[category]
other = "catégorie"
[tag]
other = "tag"

Is this the right way to achieve what I'd like to do?

Thanks

@McShelby
Copy link
Owner

A few minutes ago, I also recognized this. Thanks for reporting.

I'll make the appropriate changes to the theme.

@McShelby McShelby self-assigned this May 18, 2023
@McShelby McShelby added the feature New feature or request label May 18, 2023
@McShelby McShelby added this to the 5.13.3 milestone May 18, 2023
@postb99
Copy link
Author

postb99 commented May 18, 2023

For the new feature to look nice, my life and coding partner @Xarkam added the following to layout/partials/content-footer.html. This looks fine and allows a content item to belong to more than one category.

{{- $page := . }}
{{- if .Params.categories }}
<i class='fas fa-list'></i>
{{- range sort .Params.categories }}
  {{- $category := . }}
  {{- with $page.Site.GetPage (printf "%s%s" ("/categories/" | relURL ) ( $category | anchorize ) ) }}
    {{- $to := . }}
  <a class="tag-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ $category }}</a>
  {{- end }}
{{- end }}
{{- end }}

This visually gives this for my work-in-progress website:

image

Just be careful about font awesome 5 vs 6 we use.

@McShelby
Copy link
Owner

Looks really nice!

This also chimes in into #513, which makes me rethink the whole tags header. I will post my thoughts about the tags header at #513 but would be delighted to hear your meaning.

@McShelby McShelby changed the title Question about taxonomy and i18n i18n: add translation for default taxonomies May 18, 2023
@McShelby
Copy link
Owner

The fix has landed in master, but I want to fix some stuff first before the next official release.

In the meanwhile you could check out the translation. I hope Google Translate and DeepL did their job well.

@postb99
Copy link
Author

postb99 commented May 19, 2023

I just added a comment to the commit, great work with a small wording fix please for fr language.

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

No branches or pull requests

2 participants