1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

make I18n optional in core

This commit is contained in:
Thomas Reynolds 2013-04-22 22:09:33 -07:00
parent 8a54645de5
commit ab2f37d2e6

View file

@ -129,9 +129,10 @@ module Middleman
# Store last engine for later (could be inside nested renders)
@current_engine, engine_was = engine, @current_engine
old_locale = ::I18n.locale
I18n.locale = opts[:lang] if opts[:lang]
if defined?(::I18n)
old_locale = ::I18n.locale
::I18n.locale = opts[:lang] if opts[:lang]
end
# Use a dup of self as a context so that instance variables set within
# the template don't persist for other templates.
@ -169,7 +170,7 @@ module Middleman
ensure
# Pop all the saved variables from earlier as we may be returning to a
# previous render (layouts, partials, nested layouts).
::I18n.locale = old_locale
::I18n.locale = old_locale if defined?(::I18n)
@current_engine = engine_was
@content_blocks = nil
@current_locs = nil