country-code.html 759 B

1234567891011121314151617181920212223
  1. {{ $languageCode:= .Lang }}
  2. {{/* by default the language code and the country code are same */}}
  3. {{ $countryCode:= $languageCode }}
  4. {{/* language code and country code are not same for some countries. we need to fix them. */}}
  5. {{ if eq $languageCode "en" }}
  6. {{ $countryCode = "gb" }}
  7. {{ else if eq $languageCode "bn" }}
  8. {{ $countryCode = "bd" }}
  9. {{ else if eq $languageCode "hi" }}
  10. {{ $countryCode = "in" }}
  11. {{ end }}
  12. {{/* if the user specify a country code for a language via "params.flagOverwrites" field, then use it. */}}
  13. {{ range site.Params.flagOverwrites }}
  14. {{ if eq $languageCode .languageCode }}
  15. {{ $countryCode = .countryCode }}
  16. {{ end }}
  17. {{ end }}
  18. {{/* return the country code */}}
  19. {{ return $countryCode }}