mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 23:38:47 +08:00
FIX: moment.js data formats were always english
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
module JsLocaleHelper
|
module JsLocaleHelper
|
||||||
|
|
||||||
def self.output_locale(locale, translations = nil)
|
def self.output_locale(locale, translations = nil)
|
||||||
|
current_locale = I18n.locale
|
||||||
|
I18n.locale = locale.to_sym
|
||||||
|
|
||||||
locale_str = locale.to_s
|
locale_str = locale.to_s
|
||||||
|
|
||||||
# load default translations
|
# load default translations
|
||||||
@ -31,6 +34,9 @@ module JsLocaleHelper
|
|||||||
result << File.read("#{Rails.root}/lib/javascripts/moment.js")
|
result << File.read("#{Rails.root}/lib/javascripts/moment.js")
|
||||||
result << moment_locale(locale_str)
|
result << moment_locale(locale_str)
|
||||||
result << moment_formats
|
result << moment_formats
|
||||||
|
|
||||||
|
I18n.locale = current_locale
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user