Skip to content

Commit e922f10

Browse files
committed
correct locale helper so it falls back to english message format if mf is missing
1 parent d0f50cb commit e922f10

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/javascripts/moment_locale/ko.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// language : korean (ko)
33
// author : Kyungwook, Park : https://github.com/kyungw00k
44

5-
require('../moment').lang('ko', {
5+
moment.lang('ko', {
66
months : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
77
monthsShort : "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
88
weekdays : "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),

lib/js_locale_helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def self.generate_message_format(message_formats, locale_str)
5050
formats = message_formats.map{|k,v| k.inspect << " : " << compile_message_format(locale_str ,v)}.join(" , ")
5151

5252
result = "MessageFormat = {locale: {}};\n"
53-
result << File.read(Rails.root + "lib/javascripts/locale/#{locale_str}.js") << "\n"
53+
54+
filename = Rails.root + "lib/javascripts/locale/#{locale_str}.js"
55+
filename = Rails.root + "lib/javascripts/locale/en.js" unless File.exists?(filename)
56+
57+
result << File.read(filename) << "\n"
5458

5559
result << "I18n.messageFormat = (function(formats){
5660
var f = formats;

0 commit comments

Comments
 (0)