diff options
author | François Revol <revol@free.fr> | 2020-09-29 16:33:13 +0300 |
---|---|---|
committer | François Revol <revol@free.fr> | 2020-09-29 16:33:13 +0300 |
commit | 42de1fc05d8fc1e021127593d1c7c2bfb3c0fa70 (patch) | |
tree | 289864369ed1e27ec45c68c463a8ec9d3322d426 | |
parent | 6cd165064c283d86cd47ab7824d38b967852fdea (diff) |
Translate menus
This simple approach reuses the i18n feature, but we currently have a
collision on a name, maybe we should use some menu_ prefix in the IDs?
-rw-r--r-- | exampleSite/i18n/en.yaml | 32 | ||||
-rw-r--r-- | exampleSite/i18n/fr.yaml | 32 | ||||
-rwxr-xr-x | layouts/partials/header.html | 8 |
3 files changed, 66 insertions, 6 deletions
diff --git a/exampleSite/i18n/en.yaml b/exampleSite/i18n/en.yaml index bf7cc82..c95af6a 100644 --- a/exampleSite/i18n/en.yaml +++ b/exampleSite/i18n/en.yaml @@ -107,4 +107,34 @@ translation: Our Teachers - id: download - translation: Download
\ No newline at end of file + translation: Download + +- id: About + translation: About + +- id: course + translation: course + +- id: Pages + translation: Pages + +#- id: teacher +# translation: teacher + +- id: notice + translation: notice + +- id: event + translation: event + +- id: scholarship + translation: scholarship + +- id: research + translation: research + +- id: blog + translation: blog + +- id: contact + translation: contact diff --git a/exampleSite/i18n/fr.yaml b/exampleSite/i18n/fr.yaml index 5715deb..b412b42 100644 --- a/exampleSite/i18n/fr.yaml +++ b/exampleSite/i18n/fr.yaml @@ -107,4 +107,34 @@ translation: Nos enseignants - id: download - translation: Télécharger
\ No newline at end of file + translation: Télécharger + +- id: About + translation: À propos + +- id: course + translation: Cours + +- id: Pages + translation: Pages + +#- id: teacher +# translation: Enseignant·e + +- id: notice + translation: notice + +- id: event + translation: Évènement + +- id: scholarship + translation: Cursus + +- id: research + translation: Recherches + +- id: blog + translation: Blog + +- id: contact + translation: Contact diff --git a/layouts/partials/header.html b/layouts/partials/header.html index bc34393..0901771 100755 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -44,17 +44,17 @@ {{ if .HasChildren }}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
- {{ .Name }}
+ {{ i18n .Name }}
</a>
<div class="dropdown-menu">
{{ range .Children }}
- <a class="dropdown-item" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
+ <a class="dropdown-item" href="{{ .URL | absLangURL }}">{{ i18n .Name }}</a>
{{ end }}
</div>
</li>
{{ else }}
<li class="nav-item">
- <a class="nav-link" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
+ <a class="nav-link" href="{{ .URL | absLangURL }}">{{ i18n .Name }}</a>
</li>
{{ end }}
{{ end }}
@@ -86,4 +86,4 @@ </div>
</div>
</header>
-<!-- /header -->
\ No newline at end of file +<!-- /header -->
|