From 10fa821f192bcee9820ea34cf40f390cf47b6b38 Mon Sep 17 00:00:00 2001 From: sto Date: Thu, 27 Mar 2025 14:51:25 +0100 Subject: [PATCH] Some contest pages translations --- app/views/contests/index.html.slim | 4 ++-- app/views/contests/show.html.slim | 5 ++--- app/views/layouts/authenticated.html.slim | 8 ++++---- config/locales/en.yml | 9 +++++++++ config/locales/fr.yml | 11 ++++++++++- spec/features/user_spec.rb | 4 ++-- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/app/views/contests/index.html.slim b/app/views/contests/index.html.slim index 16b0fa4..68974f3 100644 --- a/app/views/contests/index.html.slim +++ b/app/views/contests/index.html.slim @@ -1,10 +1,10 @@ .row .col h4.mb-3 - | Manage your contests + = t("contests.index.manage_contests") .float-end a.btn.btn-primary.mb-4 href=new_contest_path - | Create a new contest + = t("contests.index.new_contest") .row.row-cols-1.row-cols-md-3.g-4 - @contests.each do |contest| diff --git a/app/views/contests/show.html.slim b/app/views/contests/show.html.slim index 7aeb903..6f9f87f 100644 --- a/app/views/contests/show.html.slim +++ b/app/views/contests/show.html.slim @@ -42,8 +42,7 @@ .col-6 .row .col - h4 - | Contestants + h4 = t("contests.show.contestants") table.table.table-striped.table-hover thead tr @@ -66,4 +65,4 @@ .row.mt-4 .col a.btn.btn-primary href=new_contest_contestant_path(@contest) - | Add contestant + = t("contests.show.add_participant") diff --git a/app/views/layouts/authenticated.html.slim b/app/views/layouts/authenticated.html.slim index cc1619c..0f970f6 100644 --- a/app/views/layouts/authenticated.html.slim +++ b/app/views/layouts/authenticated.html.slim @@ -9,12 +9,12 @@ html nav.navbar.bg-body-primary - if @current_user.admin a.navbar-brand href=users_path - | Users + = t("nav.users") a.navbar-brand href=contests_path - | Home + = t("nav.home") a.navbar-brand href=user_path(@current_user) - | Settings - = button_to "Log out", session_path, method: :delete + = t("nav.settings") + = button_to t("nav.log_out"), session_path, method: :delete h1.mb-4 = @title diff --git a/config/locales/en.yml b/config/locales/en.yml index c183c9c..8c34e49 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,17 +38,26 @@ en: title: "Edit contest settings" index: title: "Welcome %{username}!" + manage_contests: "Manage my contests" + new_contest: "Create a new contest" new: title: "New jigsaw puzzle competition" scoreboard: title: "%{name}" show: title: "%{name}" + add_participant: "Add contestant" + contestants: "Contestants" contestants: edit: title: "Contestant" new: title: "New contestant" + nav: + users: "Users" + home: "Home" + settings: "Settings" + log_out: "Log out" puzzles: edit: title: "Edit contest puzzle" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index d552ce2..5c92315 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -8,18 +8,27 @@ fr: edit: title: "Paramètres du concours" index: - title: "Bienvenue %{username}!" + title: "Bienvenue %{username} !" + manage_contests: "Mes concours de puzzle" + new_contest: "Créer un nouveau concours" new: title: "Nouveau concours" scoreboard: title: "%{name}" show: title: "%{name}" + add_participant: "Ajouter un.e participant.e" + contestants: "Participant.e.s" contestants: edit: title: "Participant" new: title: "Nouveau.elle participant.e" + nav: + users: "Utilisateur.ices" + home: "Accueil" + settings: "Paramètres" + log_out: "Déconnexion" puzzles: edit: title: "Modifier le puzzle" diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 4ebd207..ef12ba6 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -12,7 +12,7 @@ RSpec.feature "Users", type: :feature do it "should not see a link to all users" do visit root_path - expect(page).not_to have_content("Users") + expect(page).not_to have_content(I18n.t("nav.users")) end it "should not be able to see the user list" do @@ -50,7 +50,7 @@ RSpec.feature "Users", type: :feature do it "should see a link to all users" do visit root_path - expect(page).to have_content("Users") + expect(page).to have_content(I18n.t("nav.users")) end it "should be able to see the user list" do