From f4f581d12fd59674565aa17772847abe9bd294bc Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 30 Jul 2022 22:45:40 +0200 Subject: [PATCH] Add new translations for answerbox --- app/views/answerbox/_comments.haml | 4 ++-- app/views/answerbox/_header.haml | 4 ++-- app/views/answerbox/_smiles.haml | 2 +- app/views/application/_answerbox.haml | 8 ++++---- config/locales/views.en.yml | 13 +++++++++++++ 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/views/answerbox/_comments.haml b/app/views/answerbox/_comments.haml index 85f04b49..8a17271b 100644 --- a/app/views/answerbox/_comments.haml +++ b/app/views/answerbox/_comments.haml @@ -1,5 +1,5 @@ - if a.comments.all.count.zero? - = t "views.answerbox.no_comment" + = t(".none") - else %ul.comment__container - a.comments.order(:created_at).each do |comment| @@ -49,5 +49,5 @@ = t("voc.report") - if user_signed_in? .form-group.has-feedback.comment__input-group{ name: "ab-comment-new-group", data: { a_id: a.id } } - %input.form-control.comment__input{ type: :text, placeholder: t("views.placeholder.comment"), name: "ab-comment-new", data: { a_id: a.id } } + %input.form-control.comment__input{ type: :text, placeholder: t(".placeholder"), name: "ab-comment-new", data: { a_id: a.id } } %span.text-muted.form-control-feedback.comment__character-count{ id: "ab-comment-charcount-#{a.id}" } 160 diff --git a/app/views/answerbox/_header.haml b/app/views/answerbox/_header.haml index e0786cc8..ec5ea848 100644 --- a/app/views/answerbox/_header.haml +++ b/app/views/answerbox/_header.haml @@ -25,10 +25,10 @@ %h6.text-muted.media-heading.answerbox__question-user - if a.question.author_is_anonymous %i.fa.fa-user-secret{ title: t('.anon_hint') } - = raw t('views.answerbox.asked', user: user_screen_name(a.question.user, context_user: a.user, author_identifier: a.question.author_is_anonymous ? a.question.author_identifier: nil), time: time_tooltip(a.question)) + = raw t(".asked", user: user_screen_name(a.question.user, context_user: a.user, author_identifier: a.question.author_is_anonymous ? a.question.author_identifier: nil), time: time_tooltip(a.question)) - if !a.question.author_is_anonymous && !a.question.direct ยท %a{ href: question_path(a.question.user.screen_name, a.question.id) } - = pluralize(a.question.answer_count, t("voc.answer")) + = t(".answers", count: a.question.answer_count) .answerbox__question-text = question_markdown a.question.content diff --git a/app/views/answerbox/_smiles.haml b/app/views/answerbox/_smiles.haml index 3dd5f96b..8abf967d 100644 --- a/app/views/answerbox/_smiles.haml +++ b/app/views/answerbox/_smiles.haml @@ -3,7 +3,7 @@ %i.fa.fa-smile-o .media-body - if a.smiles.all.count.zero? - = t 'views.answerbox.no_smile' + = t(".none") - else - a.smiles.all.each do |smile| %a{ href: user_path(smile.user), diff --git a/app/views/application/_answerbox.haml b/app/views/application/_answerbox.haml index 70ba3408..9d236e20 100644 --- a/app/views/application/_answerbox.haml +++ b/app/views/application/_answerbox.haml @@ -10,7 +10,7 @@ [...] %p %a.btn.btn-primary{ href: answer_path(a.user.screen_name, a.id) } - = t 'views.answerbox.read' + = t(".read") - else .answerbox__answer-text = markdown a.content @@ -23,16 +23,16 @@ %img.answerbox__answer-user-avatar.avatar-sm{ src: a.user.profile_picture.url(:medium) } .media-body %h6.media-heading.answerbox__answer-user - = raw t('views.answerbox.answered', hide: hidespan(t('views.answerbox.hide'), 'd-none d-sm-inline'), user: user_screen_name(a.user)) + = raw t(".answered", hide: hidespan(t(".hide"), 'd-none d-sm-inline'), user: user_screen_name(a.user)) .answerbox__answer-date - = link_to(raw(t('views.answerbox.time', time: time_tooltip(a))), answer_path(a.user.screen_name, a.id)) + = link_to(raw(t("time.distance_ago", time: time_tooltip(a))), answer_path(a.user.screen_name, a.id)) .col-md-6.d-flex.d-md-block.answerbox__actions = render 'answerbox/actions', a: a, display_all: display_all - else .row .col-md-6.text-left.text-muted %i.fa.fa-clock-o - = link_to(raw(t('views.answerbox.time', time: time_tooltip(a))), answer_path(a.user.screen_name, a.id), class: 'answerbox__permalink') + = link_to(raw(t("time.distance_ago", time: time_tooltip(a))), answer_path(a.user.screen_name, a.id), class: 'answerbox__permalink') .col-md-6.d-md-flex.answerbox__actions = render 'answerbox/actions', a: a, display_all: display_all .card-footer{ id: "ab-comments-section-#{a.id}", class: display_all.nil? ? 'd-none' : nil } diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 77df40db..39cfaa35 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -80,6 +80,11 @@ en: answerbox: header: anon_hint: :inbox.entry.anon_hint + answers: + zero: "0 answers" + one: "1 answer" + other: "%{count} answers" + asked: "%{user} asked %{time} ago" actions: share: twitter: "Share on Twitter" @@ -89,9 +94,17 @@ en: unsubscribe: "Unsubscribe" return: "Return to Inbox" comments: + none: "There are no comments yet." + placeholder: "Comment..." actions: view_smiles: "View comment smiles" + smiles: + none: "No one smiled this yet." application: + answerbox: + read: "Read the entire answer" + answered: "%{hide} %{user}" # resolves into "Answered by %{user}" + hide: "Answered by" questionbox: title: "Ask something!" required: "This user does not want to get asked by strangers. Why don't you %{signup}?"