Module: LanguageSwitcher::Helpers
Instance Method Summary
collapse
#attribute_translation, #each_language, #language, #t
Instance Method Details
#language_nav ⇒ Object
53
54
55
56
57
|
# File 'lib/language_switcher.rb', line 53
def language_nav
I18n.available_locales.inject("".html_safe) do |html, lang|
html << content_tag("li", link_to(t(lang), "#language_#{lang}") )
end
end
|
#language_switcher(&block) ⇒ Object
35
36
37
|
# File 'lib/language_switcher.rb', line 35
def language_switcher(&block)
content_tag("div", content_tag("ul", language_nav) << language_tabs(&block), 'data-tabs'=>'data-tabs' )
end
|
#language_tab(lang, &block) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/language_switcher.rb', line 45
def language_tab(lang, &block)
content_tag("div", :id=>"language_#{lang}") do
language(lang) do
block.call lang
end
end
end
|
#language_tabs(&block) ⇒ Object
39
40
41
42
43
|
# File 'lib/language_switcher.rb', line 39
def language_tabs(&block)
I18n.available_locales.inject("".html_safe) do |html, lang|
html << language_tab(lang, &block)
end
end
|