From ed32d2519fb9b5f15267495165adb75ef198a2f4 Mon Sep 17 00:00:00 2001 From: razonyang Date: Mon, 15 Jan 2024 19:48:58 +0800 Subject: [PATCH] fix: use language codes as locales as is --- layouts/partials/decap-cms/functions/locale.html | 4 ---- layouts/partials/decap-cms/functions/locales-map.html | 7 ------- layouts/partials/decap-cms/functions/locales.html | 7 +------ 3 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 layouts/partials/decap-cms/functions/locales-map.html diff --git a/layouts/partials/decap-cms/functions/locale.html b/layouts/partials/decap-cms/functions/locale.html index 75ee95e..40832ce 100644 --- a/layouts/partials/decap-cms/functions/locale.html +++ b/layouts/partials/decap-cms/functions/locale.html @@ -1,6 +1,2 @@ -{{- $map := partialCached "decap-cms/functions/locales-map" . }} {{- $locale := site.Language.LanguageCode }} -{{- with index $map $locale }} - {{- $locale = . }} -{{- end }} {{- return $locale }} diff --git a/layouts/partials/decap-cms/functions/locales-map.html b/layouts/partials/decap-cms/functions/locales-map.html deleted file mode 100644 index 79dfc24..0000000 --- a/layouts/partials/decap-cms/functions/locales-map.html +++ /dev/null @@ -1,7 +0,0 @@ -{{- return dict - "zh-cn" "zh_Hans" - "zh-hans" "zh_Hans" - "zh-hant" "zh_Hant" - "zh-hk" "zh_Hant" - "zh-tw" "zh_Hant" -}} diff --git a/layouts/partials/decap-cms/functions/locales.html b/layouts/partials/decap-cms/functions/locales.html index 85ef375..616b00b 100644 --- a/layouts/partials/decap-cms/functions/locales.html +++ b/layouts/partials/decap-cms/functions/locales.html @@ -1,10 +1,5 @@ -{{- $map := partialCached "decap-cms/functions/locales-map" . }} {{- $locales := slice }} {{- range site.Languages }} - {{- with index $map .LanguageCode }} - {{- $locales = $locales | append . }} - {{- else }} - {{- $locales = $locales | append .LanguageCode }} - {{- end }} + {{- $locales = $locales | append .LanguageCode }} {{- end }} {{- return $locales }}