Skip to content
Snippets Groups Projects
Unverified Commit f3b72c4f authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

Merge branch 'i18n' of github.com:noesya/osuny into i18n

parents 843985d5 8780be71
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ class Language < ApplicationRecord
validates_presence_of :iso_code
validates_uniqueness_of :iso_code
default_scope { order(name: :asc) }
scope :ordered, -> { order(name: :asc) }
def to_s
"#{name}"
......
<%
if about.respond_to?(:website)
languages = about.website.languages
languages = about.website.languages.ordered
route_args = [:admin, about.becomes(about.class.base_class)]
else
languages = Language.all
languages = Language.all.ordered
route_args = [:admin, about.becomes(about.class.base_class), :translation]
end
action = "<i class=\"fas fa-language fa-2x float-end \"></i>"
%>
<%= osuny_panel t('internationalization.label'), action: action do %>
<p><%= t('internationalization.text_html', lang: t("languages.#{about.language.iso_code}")) %></p>
<h3 class="h5 mt-4"><%= t('internationalization.translations_title') %></h3>
<%= osuny_panel t('internationalization.label') do %>
<ol class="list-unstyled">
<% languages.each do |language| %>
<% next if language.id == about.language_id %>
<%
label = t(language.iso_code, scope: :languages)
current = language.id == about.language_id
%>
<li>
<% if about.original_with_translations.detect { |translation| translation.language_id == language.id }.present? %>
<i class="fas fa-edit float-end"></i>
<% else %>
<i class="fas fa-add float-end"></i>
<% end %>
<%= link_to t(language.iso_code, scope: :languages), [*route_args, lang: language.iso_code] %>
<%= link_to_unless current, label, [*route_args, lang: language.iso_code] %>
</li>
<% end %>
</ol>
......
......@@ -210,8 +210,6 @@ en:
inactivity_alert: "It seems you have been away a little bit too long. Could you please retry?"
internationalization:
label: Internationalization
text_html: This page is in <b>%{lang}</b>
translations_title: 'Translations:'
languages:
en: English
fr: French
......
......@@ -210,8 +210,6 @@ fr:
inactivity_alert: "Il semble que vous soyez resté sur la page un peu trop longtemps. Pouvez-vous ré-essayer ?"
internationalization:
label: Internationalisation
text_html: Cette page est en <b>%{lang}</b>
translations_title: 'Traductions :'
languages:
en: Anglais
fr: Français
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment