Skip to content

Commit 6b59140

Browse files
committed
feat: add internationalization support for taxonomy terms and ui elements
1 parent f133d25 commit 6b59140

File tree

7 files changed

+86
-23
lines changed

7 files changed

+86
-23
lines changed

i18n/de.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ pagination_page_state: "{{ .PageNumber }}/{{ .TotalPages }}"
5454

5555
custom_product_of_cybertec: Ein Produkt von CYBERTEC
5656
custom_support_button: Support
57+
58+
# Taxonomy Terms
59+
taxonomy_terms_count:
60+
one: "{{ . }} Begriff"
61+
other: "{{ . }} Begriffe"
62+
taxonomy_terms_view_all_pages: "Alle Seiten für {{ . }} anzeigen"
63+
taxonomy_terms_no_description: Keine Beschreibung verfügbar
64+
taxonomy_terms_page_count:
65+
one: "{{ . }} Seite"
66+
other: "{{ . }} Seiten"
67+
taxonomy_terms_latest_prefix: 'Neueste:'
68+
taxonomy_terms_empty_title: Keine Begriffe gefunden
69+
taxonomy_terms_empty_description: "Derzeit sind keine {{ . }} verfügbar."
70+
71+
# Taxonomy Links
72+
taxonomy_links_browse_by_topic: "Dokumentation nach Thema durchsuchen:"
73+
taxonomy_links_all_tags: Alle Tags
74+
taxonomy_links_all_categories: Alle Kategorien
75+
taxonomy_links_all_features: Alle Features
76+
77+
# Taxonomy Meta
78+
taxonomy_meta_tags: Tags
79+
taxonomy_meta_categories: Kategorien
80+
taxonomy_meta_features: Features
81+
taxonomy_meta_view_tagged: "Alle Seiten mit Tag '{{ . }}' anzeigen"
82+
taxonomy_meta_view_category: "Alle Seiten in Kategorie '{{ . }}' anzeigen"
83+
taxonomy_meta_view_feature: "Alle Seiten für Feature '{{ . }}' anzeigen"
84+
85+
# Accessibility & UI
86+
skip_to_main_content: Zum Hauptinhalt springen
87+
88+
# Shortcodes
89+
shortcode_expand_default: Erweitern

i18n/en.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ pagination_page_state: "{{ .PageNumber }}/{{ .TotalPages }}"
5454

5555
custom_product_of_cybertec: A product of CYBERTEC
5656
custom_support_button: Support
57+
58+
# Taxonomy Terms
59+
taxonomy_terms_count:
60+
one: "{{ . }} term"
61+
other: "{{ . }} terms"
62+
taxonomy_terms_view_all_pages: "View all pages for {{ . }}"
63+
taxonomy_terms_no_description: No description available
64+
taxonomy_terms_page_count:
65+
one: "{{ . }} page"
66+
other: "{{ . }} pages"
67+
taxonomy_terms_latest_prefix: 'Latest:'
68+
taxonomy_terms_empty_title: No terms found
69+
taxonomy_terms_empty_description: "There are currently no {{ . }} available."
70+
71+
# Taxonomy Links
72+
taxonomy_links_browse_by_topic: "Browse Documentation by Topic:"
73+
taxonomy_links_all_tags: All Tags
74+
taxonomy_links_all_categories: All Categories
75+
taxonomy_links_all_features: All Features
76+
77+
# Taxonomy Meta
78+
taxonomy_meta_tags: Tags
79+
taxonomy_meta_categories: Categories
80+
taxonomy_meta_features: Features
81+
taxonomy_meta_view_tagged: "View all pages tagged with {{ . }}"
82+
taxonomy_meta_view_category: "View all pages in category {{ . }}"
83+
taxonomy_meta_view_feature: "View all pages for feature {{ . }}"
84+
85+
# Accessibility & UI
86+
skip_to_main_content: Skip to main content
87+
88+
# Shortcodes
89+
shortcode_expand_default: Expand

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<body itemscope itemtype="https://schema.org/WebPage">
2525
<div class="w-full flex justify-center">
26-
<a href="#main-content" id="gdoc-to-main" class="gdoc-markdown__link">Skip to main content</a>
26+
<a href="#main-content" id="gdoc-to-main" class="gdoc-markdown__link">{{ i18n "skip_to_main_content" }}</a>
2727
</div>
2828

2929
{{ partial "svg-icon-symbols" . }}

layouts/_default/terms.html

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h1 class="taxonomy-terms-title">{{ partial "utils/title" . }}</h1>
99
{{- if gt (len .Pages) 0 -}}
1010
<p class="taxonomy-terms-count" aria-live="polite">
1111
{{- $total := len .Pages -}}
12-
{{- printf "%d %s" $total (cond (eq $total 1) "term" "terms") -}}
12+
{{- i18n "taxonomy_terms_count" $total -}}
1313
</p>
1414
{{- end -}}
1515
</header>
@@ -29,7 +29,7 @@ <h1 class="taxonomy-terms-title">{{ partial "utils/title" . }}</h1>
2929
<a
3030
href="{{ .RelPermalink }}"
3131
class="taxonomy-term-card__link"
32-
aria-label="View all pages for {{ partial "utils/title" . }}"
32+
aria-label="{{ i18n "taxonomy_terms_view_all_pages" (partial "utils/title" .) }}"
3333
>
3434
<header class="taxonomy-term-card__header">
3535
<h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
@@ -44,7 +44,7 @@ <h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
4444
<p class="taxonomy-term-card__description">{{ $latest.Summary | plainify | truncate 120 }}</p>
4545
{{- else -}}
4646
<p class="taxonomy-term-card__description taxonomy-term-card__description--empty">
47-
No description available
47+
{{ i18n "taxonomy_terms_no_description" }}
4848
</p>
4949
{{- end -}}
5050
</div>
@@ -53,16 +53,13 @@ <h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
5353
<div class="taxonomy-term-card__meta">
5454
<span
5555
class="taxonomy-term-card__count"
56-
aria-label="{{ $pageCount }} {{ cond (eq $pageCount 1) "page" "pages" }}"
56+
aria-label="{{ i18n "taxonomy_terms_page_count" $pageCount }}"
5757
>
5858
<svg class="gdoc-icon gdoc_tag" aria-hidden="true">
5959
<use xlink:href="#gdoc_tag"></use>
6060
</svg>
6161
<span class="taxonomy-term-card__count-text">
62-
{{- $pageCount -}}
63-
<span class="taxonomy-term-card__count-label">
64-
{{- cond (eq $pageCount 1) "page" "pages" -}}
65-
</span>
62+
{{- i18n "taxonomy_terms_page_count" $pageCount -}}
6663
</span>
6764
</span>
6865

@@ -72,7 +69,7 @@ <h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
7269
<use xlink:href="#gdoc_star"></use>
7370
</svg>
7471
<span class="taxonomy-term-card__latest-text">
75-
Latest:
72+
{{ i18n "taxonomy_terms_latest_prefix" }}
7673
<span class="taxonomy-term-card__latest-title">
7774
{{- partial "utils/title" $latest | truncate 40 -}}
7875
</span>
@@ -96,9 +93,9 @@ <h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}">
9693
<svg class="taxonomy-terms-empty__icon" aria-hidden="true">
9794
<use xlink:href="#gdoc_tag"></use>
9895
</svg>
99-
<h2 class="taxonomy-terms-empty__title">No terms found</h2>
96+
<h2 class="taxonomy-terms-empty__title">{{ i18n "taxonomy_terms_empty_title" }}</h2>
10097
<p class="taxonomy-terms-empty__description">
101-
There are currently no {{ .Data.Plural }} available.
98+
{{ i18n "taxonomy_terms_empty_description" .Data.Plural }}
10299
</p>
103100
</div>
104101
{{- end -}}

layouts/partials/taxonomy-links.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
*/ -}}
66
{{- if or .Site.Taxonomies.tags .Site.Taxonomies.categories .Site.Taxonomies.features -}}
77
<div class="taxonomy-links-container">
8-
<p>Browse Documentation by Topic:</p>
8+
<p>{{ i18n "taxonomy_links_browse_by_topic" }}</p>
99
<div class="taxonomy-links">
1010
{{- if .Site.Taxonomies.tags -}}
1111
<a href="{{ "tags/" | relLangURL }}" class="taxonomy-link taxonomy-link-tags">
12-
All Tags
12+
{{ i18n "taxonomy_links_all_tags" }}
1313
</a>
1414
{{- end -}}
1515
{{- if .Site.Taxonomies.categories -}}
1616
<a href="{{ "categories/" | relLangURL }}" class="taxonomy-link taxonomy-link-categories">
17-
All Categories
17+
{{ i18n "taxonomy_links_all_categories" }}
1818
</a>
1919
{{- end -}}
2020
{{- if .Site.Taxonomies.features -}}
2121
<a href="{{ "features/" | relLangURL }}" class="taxonomy-link taxonomy-link-features">
22-
All Features
22+
{{ i18n "taxonomy_links_all_features" }}
2323
</a>
2424
{{- end -}}
2525
</div>

layouts/partials/taxonomy-meta.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<div>
55
{{- if .Params.tags -}}
66
<div class="taxonomy-group">
7-
<strong>Tags</strong>
7+
<strong>{{ i18n "taxonomy_meta_tags" }}</strong>
88
<div class="taxonomy-badges">
99
{{- range .Params.tags -}}
1010
<a href="{{ (printf "tags/%s/" (. | urlize)) | relLangURL }}"
1111
class="taxonomy-badge taxonomy-badge-tag"
12-
aria-label="View all pages tagged with {{ . }}">
12+
aria-label="{{ i18n "taxonomy_meta_view_tagged" . }}">
1313
{{ . }}
1414
</a>
1515
{{- end -}}
@@ -19,12 +19,12 @@
1919

2020
{{- if .Params.categories -}}
2121
<div class="taxonomy-group">
22-
<strong>Categories</strong>
22+
<strong>{{ i18n "taxonomy_meta_categories" }}</strong>
2323
<div class="taxonomy-badges">
2424
{{- range .Params.categories -}}
2525
<a href="{{ (printf "categories/%s/" (. | urlize)) | relLangURL }}"
2626
class="taxonomy-badge taxonomy-badge-category"
27-
aria-label="View all pages in category {{ . }}">
27+
aria-label="{{ i18n "taxonomy_meta_view_category" . }}">
2828
{{ . }}
2929
</a>
3030
{{- end -}}
@@ -34,12 +34,12 @@
3434

3535
{{- if .Params.features -}}
3636
<div class="taxonomy-group">
37-
<strong>Features</strong>
37+
<strong>{{ i18n "taxonomy_meta_features" }}</strong>
3838
<div class="taxonomy-badges">
3939
{{- range .Params.features -}}
4040
<a href="{{ (printf "features/%s/" (. | urlize)) | relLangURL }}"
4141
class="taxonomy-badge taxonomy-badge-feature"
42-
aria-label="View all pages for feature {{ . }}">
42+
aria-label="{{ i18n "taxonomy_meta_view_feature" . }}">
4343
{{ . }}
4444
</a>
4545
{{- end -}}

layouts/shortcodes/expand.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ $id := substr (sha1 .Inner) 0 8 }}
22
<div class="gdoc-expand">
33
<label class="gdoc-expand__head flex justify-between" for="{{ $id }}-{{ .Ordinal }}">
4-
<span>{{ default "Expand" (.Get 0) }}</span>
4+
<span>{{ default (i18n "shortcode_expand_default") (.Get 0) }}</span>
55
<span>{{ default "↕" (.Get 1) }}</span>
66
</label>
77
<input id="{{ $id }}-{{ .Ordinal }}" type="checkbox" class="gdoc-expand__control hidden" />

0 commit comments

Comments
 (0)