29 lines
1,017 B
HTML
29 lines
1,017 B
HTML
{{/* if there is no custom flag provided, we define the flag with the country code */}}
|
|
{{ $languageCode:= .Lang }}
|
|
{{/* by default the language code and the country code are same */}}
|
|
{{ $countryCode:= $languageCode }}
|
|
|
|
{{/* language code and country code are not same for some countries. we need to fix them. */}}
|
|
{{ if eq $languageCode "en" }}
|
|
{{ $countryCode = "gb" }}
|
|
{{ else if eq $languageCode "bn" }}
|
|
{{ $countryCode = "bd" }}
|
|
{{ else if eq $languageCode "hi" }}
|
|
{{ $countryCode = "in" }}
|
|
{{ end }}
|
|
|
|
|
|
{{/* if the user specify a country code for a language via "params.flagOverwrites" field, then use it. */}}
|
|
{{ range site.Params.flagOverwrites }}
|
|
{{ if eq $languageCode .languageCode }}
|
|
{{ $countryCode = .countryCode }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* if specified via "params.showFlags" field, then countryCode is set to be empty. */}}
|
|
{{ if eq site.Params.showFlags false }}
|
|
{{ $countryCode = "" }}
|
|
{{ end }}
|
|
|
|
{{/* return the country code */}}
|
|
{{ return $countryCode }}
|