From f39cc49cd2abf8e963e6d7ac1c3b02fde37e5b74 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 23 Jul 2021 14:14:12 +0200 Subject: [PATCH] Create a base_locale attribute onto I18n object - if "fr": return "fr" - if "fr_FR": return "fr" --- app/assets/javascripts/admin/util.js.erb | 2 +- app/views/layouts/_i18n_script.html.haml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/util.js.erb b/app/assets/javascripts/admin/util.js.erb index 4bc9132c43..cc5f32f843 100644 --- a/app/assets/javascripts/admin/util.js.erb +++ b/app/assets/javascripts/admin/util.js.erb @@ -12,7 +12,7 @@ $(document).ready(function() { altInput: true, altFormat: Spree.translations.flatpickr_date_format, dateFormat: "Y-m-d", - locale: I18n.locale, + locale: I18n.base_locale, plugins: [ ShortcutButtonsPlugin({ button: [{ diff --git a/app/views/layouts/_i18n_script.html.haml b/app/views/layouts/_i18n_script.html.haml index 70cfafba83..504579d81e 100644 --- a/app/views/layouts/_i18n_script.html.haml +++ b/app/views/layouts/_i18n_script.html.haml @@ -1,5 +1,6 @@ :javascript I18n.default_locale = "#{I18n.default_locale}"; + I18n.base_locale = "#{I18n.locale.to_s.split('_').first}"; I18n.locale = "#{I18n.locale}"; I18n.fallbacks = true; moment.locale([I18n.locale, 'en']);