From 16f64aa4c27d865b42aa2e8a5206274b734d2dac Mon Sep 17 00:00:00 2001 From: Emruz Hossain Date: Mon, 17 May 2021 23:43:06 +0600 Subject: [PATCH] Allow overwriting country flag for a language (#316) Signed-off-by: hossainemruz --- layouts/partials/helpers/country-code.html | 10 +++++++++- static/css/layouts/main.css | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/layouts/partials/helpers/country-code.html b/layouts/partials/helpers/country-code.html index f93a633..cce5704 100644 --- a/layouts/partials/helpers/country-code.html +++ b/layouts/partials/helpers/country-code.html @@ -2,7 +2,7 @@ {{/* 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. */}} +{{/* 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" }} @@ -11,5 +11,13 @@ {{ $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 }} + {{/* return the country code */}} {{ return $countryCode }} diff --git a/static/css/layouts/main.css b/static/css/layouts/main.css index 7064658..e028f3f 100644 --- a/static/css/layouts/main.css +++ b/static/css/layouts/main.css @@ -170,7 +170,7 @@ img.right { .flag-icon { width: 16px !important; - margin-top: 5px; + margin-top: 3px; margin-right: 3px; }