From bb23f6b3f01572f5afa6670129bd8c182a35bd58 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sat, 2 Jul 2022 11:34:46 +0200 Subject: [PATCH] Add translations for ban modal --- app/views/modal/_ban.haml | 35 ++++++++++++++--------------------- config/locales/en.yml | 6 ------ config/locales/views.en.yml | 10 ++++++++++ config/locales/voc.en.yml | 4 ++++ 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/app/views/modal/_ban.haml b/app/views/modal/_ban.haml index 6bf8c900..486472c3 100644 --- a/app/views/modal/_ban.haml +++ b/app/views/modal/_ban.haml @@ -4,44 +4,37 @@ .modal-content#ban-control-super .modal-header %h5.modal-title#modal-ban-label - = t 'views.modal.bancontrol.title' + = t '.title' %button.close{ data: { dismiss: :modal }, type: :button } %span{ aria: { hidden: true } } × - %span.sr-only Close + %span.sr-only= t 'views.actions.close' = bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: :novalidate }) do |f| = f.hidden_field :user, value: user.screen_name - if current_ban.nil? .modal-body - = f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: user.banned? + = f.check_box :ban, label: t('.is_banned'), checked: user.banned? #ban-controls{ class: user.banned? ? '' : 'd-none' } - = f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanently_banned? + = f.check_box :permaban, label: t('.is_permanent'), checked: user.permanently_banned? #ban-controls-time{ class: user.permanently_banned? ? 'd-none' : '' } = f.text_field :duration, label: '', required: true .form-check.form-check-inline - = f.radio_button :duration_unit, 'hours', label: 'Hours', checked: true - = f.radio_button :duration_unit, 'days', label: 'Days' - = f.radio_button :duration_unit, 'weeks', label: 'Weeks' - = f.radio_button :duration_unit, 'months', label: 'Months' - = f.text_field :reason, placeholder: t('views.modal.bancontrol.reason'), value: user.bans.current.first&.reason + = f.radio_button :duration_unit, t('time.hours'), label: 'Hours', checked: true + = f.radio_button :duration_unit, t('time.days'), label: 'Days' + = f.radio_button :duration_unit, t('time.weeks'), label: 'Weeks' + = f.radio_button :duration_unit, t('time.months'), label: 'Months' + = f.text_field :reason, placeholder: t('.reason'), value: user.bans.current.first&.reason .modal-footer %button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close' - = f.submit t('views.modal.bancontrol.hammertime'), class: 'btn btn-primary', name: 'hammer-time' + = f.submit t('.hammertime'), class: 'btn btn-primary', name: 'hammer-time' - else = f.hidden_field :ban, value: '0' .modal-body - if current_ban.expires_at.nil? - This user is currently permanently banned for - %strong= current_ban.reason + = t '.banned_permanently_html', reason: current_ban.reason - else - This user is currently banned until - %strong= current_ban.expires_at - for - %strong= current_ban.reason + = t '.banned_temporarily_html', reason: current_ban.reason, until: current_ban.expires_at.strftime('%Y-%m-%d %H:%M:%S') - if current_ban.banned_by.present? %br - This ban was instated by - %strong= current_ban.banned_by.profile.safe_name - on - %strong= current_ban.created_at + = t '.banned_by_html', user: current_ban.banned_by.screen_name, on: current_ban.created_at.strftime('%Y-%m-%d %H:%M:%S') .modal-footer - = f.submit 'Unban', class: 'btn btn-primary', name: 'hammer-time' + = f.submit t '.unban', class: 'btn btn-primary', name: 'hammer-time' diff --git a/config/locales/en.yml b/config/locales/en.yml index b7be786b..509d578c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -295,12 +295,6 @@ en: title: "Ask your followers" choose: "Choose list:" loading: "Asking..." - bancontrol: - title: "Ban Control Center" - ban: "Ban?" - permanent: "Permanently?" - reason: "Reason" - hammertime: "Hammer Time" list: title: "Manage list memberships" tabs: diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 9f3a2a30..fa1fe488 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -81,6 +81,16 @@ en: modal: password: title: "Save account changes" + ban: + title: "Ban Control Center" + reason: "Reason" + is_banned: "Ban?" + is_permanent: "Permanently?" + hammertime: "Hammer Time" + unban: "Unban" + banned_permanently_html: "This user is currently permanently banned for %{reason}" + banned_temporarily_html: "This user is currently banned until %{until} for %{reason}" + banned_by_html: "This ban was instated by %{user} on %{on}" services: index: title: "Service Settings" diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index 383b890c..e56533ed 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -18,3 +18,7 @@ en: noauth: "You must be signed in to do this." time: distance_ago: "%{time} ago" + hours: "hours" + days: "days" + weeks: "weeks" + months: "months"