File exists check
This commit is contained in:
parent
c964c5c0d5
commit
d0901289e7
|
@ -73,7 +73,8 @@ module JsLocaleHelper
|
||||||
def self.compile_message_format(locale, format)
|
def self.compile_message_format(locale, format)
|
||||||
ctx = V8::Context.new
|
ctx = V8::Context.new
|
||||||
ctx.load(Rails.root + 'lib/javascripts/messageformat.js')
|
ctx.load(Rails.root + 'lib/javascripts/messageformat.js')
|
||||||
ctx.load(Rails.root + "lib/javascripts/locale/#{locale}.js")
|
path = Rails.root + "lib/javascripts/locale/#{locale}.js"
|
||||||
|
ctx.load(path) if File.exists?(path)
|
||||||
ctx.eval("mf = new MessageFormat('#{locale}');")
|
ctx.eval("mf = new MessageFormat('#{locale}');")
|
||||||
ctx.eval("mf.precompile(mf.parse(#{format.inspect}))")
|
ctx.eval("mf.precompile(mf.parse(#{format.inspect}))")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue