I have activated I18n in middleman like so:
activate :i18n, mount_at_root: :de
Now I'd like to be redirected from /
to /de
automatically. Is this possible?
Also, I wonder why middleman auto-assigns class index
(for german) and en_index
(for english) using the page_classes
helper? This doesn't make much sense - it's the same page, so it should use the class index
for both english and german. Or did I miss something?
If you :mount_at_root => :de
german will be your default language and thus not prefixed.
If you set :mount_at_root => :false
all languages should be prefixed.
I have successfully used the following configuration to set de/en
paths.
This will also create page_classes
such as as en en_index
and de de_index
.
activate :i18n, :mount_at_root => :false, :langs => [:de, :en]
http://middlemanapp.com/advanced/localization/
Redirecting from /
to /de
is done using redirect "index.html", :to => "de/index.html"
.
To prevent page_classes
from prefixing the classes with the language, overwrite the helper like so:
helpers do
def page_classes(path=current_path.dup, options={})
super(path.sub(/^[a-z]{2}\//, ''), options)
end
end