mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 07:06:47 +08:00
correct locale helper so it falls back to english message format if mf is missing
This commit is contained in:
@ -50,7 +50,11 @@ module JsLocaleHelper
|
||||
formats = message_formats.map{|k,v| k.inspect << " : " << compile_message_format(locale_str ,v)}.join(" , ")
|
||||
|
||||
result = "MessageFormat = {locale: {}};\n"
|
||||
result << File.read(Rails.root + "lib/javascripts/locale/#{locale_str}.js") << "\n"
|
||||
|
||||
filename = Rails.root + "lib/javascripts/locale/#{locale_str}.js"
|
||||
filename = Rails.root + "lib/javascripts/locale/en.js" unless File.exists?(filename)
|
||||
|
||||
result << File.read(filename) << "\n"
|
||||
|
||||
result << "I18n.messageFormat = (function(formats){
|
||||
var f = formats;
|
||||
|
Reference in New Issue
Block a user