make I18n optional in core
This commit is contained in:
parent
8a54645de5
commit
ab2f37d2e6
1 changed files with 5 additions and 4 deletions
|
@ -129,9 +129,10 @@ module Middleman
|
||||||
|
|
||||||
# Store last engine for later (could be inside nested renders)
|
# Store last engine for later (could be inside nested renders)
|
||||||
@current_engine, engine_was = engine, @current_engine
|
@current_engine, engine_was = engine, @current_engine
|
||||||
|
if defined?(::I18n)
|
||||||
old_locale = ::I18n.locale
|
old_locale = ::I18n.locale
|
||||||
|
::I18n.locale = opts[:lang] if opts[:lang]
|
||||||
I18n.locale = opts[:lang] if opts[:lang]
|
end
|
||||||
|
|
||||||
# Use a dup of self as a context so that instance variables set within
|
# Use a dup of self as a context so that instance variables set within
|
||||||
# the template don't persist for other templates.
|
# the template don't persist for other templates.
|
||||||
|
@ -169,7 +170,7 @@ module Middleman
|
||||||
ensure
|
ensure
|
||||||
# Pop all the saved variables from earlier as we may be returning to a
|
# Pop all the saved variables from earlier as we may be returning to a
|
||||||
# previous render (layouts, partials, nested layouts).
|
# previous render (layouts, partials, nested layouts).
|
||||||
::I18n.locale = old_locale
|
::I18n.locale = old_locale if defined?(::I18n)
|
||||||
@current_engine = engine_was
|
@current_engine = engine_was
|
||||||
@content_blocks = nil
|
@content_blocks = nil
|
||||||
@current_locs = nil
|
@current_locs = nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue