Handle non-english default languages. Fixes #584
This commit is contained in:
parent
afc62d5a26
commit
fbc4d7e9c7
1 changed files with 12 additions and 7 deletions
|
@ -52,15 +52,20 @@ module Middleman
|
||||||
@app.sitemap.provides_metadata_for_path do |url|
|
@app.sitemap.provides_metadata_for_path do |url|
|
||||||
if d = get_localization_data(url)
|
if d = get_localization_data(url)
|
||||||
lang, page_id = d
|
lang, page_id = d
|
||||||
instance_vars = Proc.new {
|
else
|
||||||
|
# Default to the @mount_at_root lang
|
||||||
|
page_id = nil
|
||||||
|
lang = @mount_at_root
|
||||||
|
end
|
||||||
|
|
||||||
|
instance_vars = Proc.new do
|
||||||
::I18n.locale = lang
|
::I18n.locale = lang
|
||||||
@lang = lang
|
@lang = lang
|
||||||
@page_id = page_id
|
@page_id = page_id
|
||||||
}
|
|
||||||
{ :blocks => [instance_vars] }
|
|
||||||
else
|
|
||||||
{}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
locals = { :lang => lang, :page_id => page_id }
|
||||||
|
{ :blocks => [instance_vars], :locals => locals }
|
||||||
end
|
end
|
||||||
|
|
||||||
@app.sitemap.register_resource_list_manipulator(
|
@app.sitemap.register_resource_list_manipulator(
|
||||||
|
|
Loading…
Reference in a new issue