4d5c509688
There are a few things changing here. One is that we always dup metadata before using it - this prevents a class of nasty bugs where after the first resource list build, blocks had been deleted from metadata hashes, meaning they would no longer be applied. Now they will always stick around. Then, I made sure that whenever we render a file, we save the previous I18n.locale and restore it afterwards, in case people change locale from blocks. This should help in some weird cases where files are rendered recursively. Finally, I've added a :lang option that can be used from "page" or "proxy" to allow people to specify the language for one or more files without having to pass a block that sets I18n.locale directly, which should make that pattern much cleaner. This fixes #809 and may also fix middleman/middleman-blog#106.
13 lines
345 B
Ruby
13 lines
345 B
Ruby
[:en, :es].each do |locale|
|
|
proxy "/#{locale}/index.html", "index.html", :ignore => true do
|
|
::I18n.locale = locale
|
|
end
|
|
end
|
|
|
|
proxy "/fr/index.html", "index.html", :lang => :fr
|
|
|
|
activate :i18n
|
|
|
|
# This is what breaks i18n, just because it adds a resource list manipulator that
|
|
# forces a rebuild of the resource list.
|
|
activate :asset_hash
|