country-code.html 862 B

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