Middleman and I18n: some problems

I activated I18n in broker like this:

activate :i18n, mount_at_root: :de

      

Now I want to be automatically redirected from /

to /de

. Is it possible?

Also, I'm wondering why the mediator automatically assigns the class index

(for german) and en_index

(for english) using the helper page_classes

? It doesn't make much sense - it's the same page, so it should use the class index

for English and German. Or am I missing something?

+3


source to share


1 answer


If you are :mount_at_root => :de

German it will be your default language and therefore no prefix.

If you have installed :mount_at_root => :false

, all languages ​​must be prefixed.

I have successfully used the following configuration to set paths de/en

.

This will also create page_classes

, for example, 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 with redirect "index.html", :to => "de/index.html"

.

To prevent page_classes

from prefixing classes with a language, overwrite the helper like this:

helpers do
  def page_classes(path=current_path.dup, options={})
    super(path.sub(/^[a-z]{2}\//, ''), options)
  end
end

      

+4


source







All Articles