language.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {{ if hugo.IsMultilingual }}
  2. <span class="gdoc-language">
  3. <ul class="gdoc-language__selector" role="button" aria-pressed="false" tabindex="0">
  4. <li>
  5. {{ range .Site.Languages }}
  6. {{ if eq . $.Site.Language }}
  7. <span class="flex align-center">
  8. <svg class="gdoc-icon gdoc_language"><use xlink:href="#gdoc_language"></use></svg>
  9. <span>{{ .Lang | upper }}</span>
  10. </span>
  11. {{ end }}
  12. {{ end }}
  13. <ul class="gdoc-language__list">
  14. {{ if $.Translations }}
  15. {{ range $.Translations }}
  16. <li>
  17. <a
  18. class="flex gdoc-language__entry"
  19. title="{{ .Language.LanguageName }}"
  20. href="{{ .RelPermalink }}"
  21. hreflang="{{ .Lang }}"
  22. lang="{{ .Lang }}"
  23. >
  24. {{ .Language.LanguageName }}
  25. </a>
  26. </li>
  27. {{ end }}
  28. {{ else }}
  29. {{ range .Site.Languages -}}
  30. {{ if ne $.Site.Language.Lang .Lang }}
  31. <li>
  32. <a
  33. class="flex gdoc-language__entry"
  34. title="{{ i18n "language_switch_no_tranlation_prefix" }} {{ .LanguageName }}"
  35. href="{{ .Lang | relLangURL }}"
  36. hreflang="{{ .Lang }}"
  37. lang="{{ .Lang }}"
  38. >
  39. {{ .LanguageName }}*
  40. </a>
  41. </li>
  42. {{ end -}}
  43. {{ end -}}
  44. {{ end }}
  45. </ul>
  46. </li>
  47. </ul>
  48. </span>
  49. {{ end }}