reload i18n yml on config

This commit is contained in:
Thomas Reynolds 2012-04-16 14:32:00 -07:00
parent 3f2733720b
commit 259ef52190

View file

@ -12,14 +12,8 @@ module Middleman::CoreExtensions::I18n
# Needed for helpers as well # Needed for helpers as well
app.after_configuration do app.after_configuration do
::I18n.load_path += Dir[File.join(root, locales_dir, "*.yml")] ::I18n.load_path = [Dir[File.join(root, locales_dir, "*.yml")]]
end ::I18n.reload!
app.ready do
sitemap.register_resource_list_manipulator(
:i18n,
i18n
)
end end
end end
alias :included :registered alias :included :registered
@ -28,7 +22,6 @@ module Middleman::CoreExtensions::I18n
class Localizer class Localizer
def initialize(app) def initialize(app)
@app = app @app = app
@activated = false
@maps = {} @maps = {}
end end
@ -61,7 +54,10 @@ module Middleman::CoreExtensions::I18n
end end
end end
@activated = true @app.sitemap.register_resource_list_manipulator(
:i18n,
@app.i18n
)
end end
def langs def langs
@ -80,8 +76,6 @@ module Middleman::CoreExtensions::I18n
# Update the main sitemap resource list # Update the main sitemap resource list
# @return [void] # @return [void]
def manipulate_resource_list(resources) def manipulate_resource_list(resources)
return resources unless @activated
@_localization_data = {} @_localization_data = {}
new_resources = [] new_resources = []