parent
8af46499cc
commit
436c1951cc
4 changed files with 20 additions and 19 deletions
|
@ -5,6 +5,18 @@ module ApplicationHelper
|
||||||
I18n.locale.to_s
|
I18n.locale.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def active_locale_link(locale)
|
||||||
|
link_to save_locale_path(locale:), {
|
||||||
|
method: :post,
|
||||||
|
class: "fr-translate__language fr-nav__link",
|
||||||
|
hreflang: locale,
|
||||||
|
lang: locale,
|
||||||
|
"aria-current": I18n.locale == locale ? "true" : nil
|
||||||
|
}.compact do
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def sanitize_url(url)
|
def sanitize_url(url)
|
||||||
if !url.nil?
|
if !url.nil?
|
||||||
super(url, schemes: ['http', 'https'], replace_evil_with: root_url)
|
super(url, schemes: ['http', 'https'], replace_evil_with: root_url)
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
%nav.fr-translate.fr-nav{ :role => "navigation", title: t('.select_locale') }
|
%nav.fr-translate.fr-nav{ :role => "navigation", title: t('.select_locale') }
|
||||||
.fr-nav__item
|
.fr-nav__item
|
||||||
%button.fr-translate__btn.fr-btn{ "aria-controls" => "translate", "aria-expanded" => "false", :title => t('.select_locale') }
|
%button.fr-translate__btn.fr-btn{ "aria-controls" => "translate", "aria-expanded" => "false", :title => t('.select_locale') }
|
||||||
= t(".#{I18n.locale}")
|
= I18n.locale.upcase
|
||||||
%span.fr-hidden-lg= t('.francais')
|
%span.fr-hidden-lg= " - #{t('.locale_name')}"
|
||||||
#translate.fr-collapse.fr-menu
|
#translate.fr-collapse.fr-menu
|
||||||
%ul.fr-menu__list
|
%ul.fr-menu__list
|
||||||
%li
|
%li
|
||||||
= active_link_to save_locale_path(locale: :fr), method: :post, class: "fr-translate__language fr-nav__link", active: I18n.locale == :fr, hreflang: "fr", lang: "fr" do
|
= active_locale_link(:fr) do
|
||||||
= t('.fr_francais')
|
FR - Français
|
||||||
%li
|
%li
|
||||||
= active_link_to save_locale_path(locale: :en), method: :post, class: "fr-translate__language fr-nav__link", active: I18n.locale == :en, hreflang: "en", lang: "en" do
|
= active_locale_link(:en) do
|
||||||
= t('.en_english')
|
EN - English
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,8 @@ en:
|
||||||
back_title: "Revenir sur le site de mon administration"
|
back_title: "Revenir sur le site de mon administration"
|
||||||
main_menu: "Main menu"
|
main_menu: "Main menu"
|
||||||
locale_dropdown:
|
locale_dropdown:
|
||||||
languages: "Languages"
|
|
||||||
select_locale: "Choose a language"
|
select_locale: "Choose a language"
|
||||||
fr: FR
|
locale_name: "English"
|
||||||
en: EN
|
|
||||||
francais: " - French"
|
|
||||||
fr_francais: FR - French
|
|
||||||
en_english: EN - English
|
|
||||||
notifications:
|
notifications:
|
||||||
actions:
|
actions:
|
||||||
access: View your File
|
access: View your File
|
||||||
|
|
|
@ -64,13 +64,8 @@ fr:
|
||||||
back_title: "Revenir sur le site de mon administration"
|
back_title: "Revenir sur le site de mon administration"
|
||||||
main_menu: "Menu principal"
|
main_menu: "Menu principal"
|
||||||
locale_dropdown:
|
locale_dropdown:
|
||||||
languages: "Langues"
|
|
||||||
select_locale: "Sélectionner une langue"
|
select_locale: "Sélectionner une langue"
|
||||||
fr: FR
|
locale_name: "Français"
|
||||||
en: EN
|
|
||||||
francais: " - Français"
|
|
||||||
fr_francais: FR - Français
|
|
||||||
en_english: EN - Anglais
|
|
||||||
notifications:
|
notifications:
|
||||||
actions:
|
actions:
|
||||||
access: Consulter mon dossier
|
access: Consulter mon dossier
|
||||||
|
|
Loading…
Reference in a new issue