correct locale helper so it falls back to english message format if mf is missing

This commit is contained in:
Sam 2013-07-25 11:16:07 +10:00
parent d0f50cb266
commit e922f10f4e
2 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@
// language : korean (ko) // language : korean (ko)
// author : Kyungwook, Park : https://github.com/kyungw00k // author : Kyungwook, Park : https://github.com/kyungw00k
require('../moment').lang('ko', { moment.lang('ko', {
months : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), months : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
monthsShort : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"), monthsShort : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
weekdays : "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"), weekdays : "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),

View File

@ -50,7 +50,11 @@ module JsLocaleHelper
formats = message_formats.map{|k,v| k.inspect << " : " << compile_message_format(locale_str ,v)}.join(" , ") formats = message_formats.map{|k,v| k.inspect << " : " << compile_message_format(locale_str ,v)}.join(" , ")
result = "MessageFormat = {locale: {}};\n" 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){ result << "I18n.messageFormat = (function(formats){
var f = formats; var f = formats;