FIX: moment.js uses a more specific language code for Armenian

This commit is contained in:
Gerhard Schlager 2019-03-28 14:47:37 +01:00
parent d43f4206c7
commit aacbb93b21
1 changed files with 5 additions and 0 deletions

View File

@ -162,6 +162,10 @@ module JsLocaleHelper
result
end
MOMENT_LOCALE_MAPPING = {
"hy" => "hy-am"
}
def self.find_moment_locale(locale_chain, timezone_names: false)
if timezone_names
path = "#{Rails.root}/vendor/assets/javascripts/moment-timezone-names-locale"
@ -172,6 +176,7 @@ module JsLocaleHelper
end
find_locale(locale_chain, path, type, fallback_to_english: false) do |locale|
locale = MOMENT_LOCALE_MAPPING[locale] if MOMENT_LOCALE_MAPPING.key?(locale)
# moment.js uses a different naming scheme for locale files
locale.tr('_', '-').downcase
end