Merge pull request #593 from Retrospring/action-strings

Refactor action strings
This commit is contained in:
Karina Kwiatek 2022-07-30 20:37:22 +02:00 committed by GitHub
commit 561d402ff7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 96 additions and 102 deletions

View File

@ -16,8 +16,8 @@ export function commentDestroyHandler(event: Event): void {
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === false) {

View File

@ -15,8 +15,8 @@ export function answerboxDestroyHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.y'),
cancelButtonText: I18n.translate('views.actions.n'),
confirmButtonText: I18n.translate('voc.y'),
cancelButtonText: I18n.translate('voc.n'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === false) {

View File

@ -35,8 +35,8 @@ export function deleteAllQuestionsHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === false) {
@ -71,8 +71,8 @@ export function deleteAllAuthorQuestionsHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === null) return false;

View File

@ -19,8 +19,8 @@ export function deleteEntryHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === false) {

View File

@ -14,8 +14,8 @@ export function destroyListHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, () => {
Rails.ajax({

View File

@ -14,8 +14,8 @@ export function destroyReportHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.delete'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true
}, () => {
Rails.ajax({

View File

@ -15,8 +15,8 @@ export function questionboxDestroyHandler(event: Event): void {
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.y'),
cancelButtonText: I18n.translate('views.actions.n'),
confirmButtonText: I18n.translate('voc.y'),
cancelButtonText: I18n.translate('voc.n'),
closeOnConfirm: true
}, (returnValue) => {
if (returnValue === false) {

View File

@ -51,7 +51,7 @@ export function userActionHandler(event: Event): void {
switch (action) {
case 'follow':
button.dataset.action = 'unfollow';
button.innerText = I18n.translate('views.actions.unfollow');
button.innerText = I18n.translate('voc.unfollow');
button.classList.remove('btn-primary');
button.classList.add('btn-default');
break;
@ -60,7 +60,7 @@ export function userActionHandler(event: Event): void {
break;
case 'block':
button.dataset.action = 'unblock';
button.querySelector('span').innerText = I18n.translate('views.actions.unblock');
button.querySelector('span').innerText = I18n.translate('voc.unblock');
if (button.classList.contains('btn')) {
button.classList.remove('btn-primary');
button.classList.add('btn-default');
@ -69,7 +69,7 @@ export function userActionHandler(event: Event): void {
break;
case 'unblock':
button.dataset.action = 'block';
button.querySelector('span').innerText = I18n.translate('views.actions.block');
button.querySelector('span').innerText = I18n.translate('voc.block');
if (button.classList.contains('btn')) {
button.classList.remove('btn-default');
button.classList.add('btn-primary');
@ -82,7 +82,7 @@ export function userActionHandler(event: Event): void {
function resetFollowButton(button: HTMLButtonElement) {
button.dataset.action = 'follow';
button.innerText = I18n.translate('views.actions.follow');
button.innerText = I18n.translate('voc.follow');
button.classList.remove('btn-default');
button.classList.add('btn-primary');
}

View File

@ -11,8 +11,8 @@ export function reportDialog(type: string, target: string): void {
type: 'input',
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: I18n.translate('views.actions.report'),
cancelButtonText: I18n.translate('views.actions.cancel'),
confirmButtonText: I18n.translate('voc.report'),
cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true,
inputPlaceholder: I18n.translate('frontend.report.confirm.input')
}, (returnValue) => {

View File

@ -22,12 +22,12 @@
.dropdown-menu.dropdown-menu-right{ role: :menu }
%a.dropdown-item{ href: twitter_share_url(a), target: '_blank' }
%i.fa.fa-fw.fa-twitter
Share on Twitter
= t(".share.twitter")
%a.dropdown-item{ href: tumblr_share_url(a), target: '_blank' }
%i.fa.fa-fw.fa-tumblr
Share on Tumblr
= t(".share.tumblr")
%a.dropdown-item{ href: '#', name: 'ab-share' }
Share on other apps...
= t(".share.other")
- if user_signed_in?
.btn-group
%button.btn.btn-default.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
@ -37,20 +37,20 @@
-# fun joke should subscribe?
%a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: 'no' } }
%i.fa.fa-anchor
= t 'views.actions.unsubscribe'
= t(".unsubscribe")
- else
%a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-submarine', torpedo: 'yes' } }
%i.fa.fa-anchor
= t 'views.actions.subscribe'
= t(".subscribe")
- if privileged? a.user
%a.dropdown-item.text-danger{ href: '#', data: { a_id: a.id, action: 'ab-destroy' } }
%i.fa.fa-trash-o
= t 'views.actions.return'
= t(".return")
- unless a.user == current_user
%a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-report' } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
= t("voc.report")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(a), target: '_blank' }
%i.fa.fa-gears
View in Kontrollzentrum
= t("voc.view_in_rails_admin")

View File

@ -38,15 +38,15 @@
.dropdown-menu.dropdown-menu-right{ role: :menu }
%a.dropdown-item{ href: "#", data: { target: "#modal-view-comment#{comment.id}-smiles", toggle: :modal } }
%i.fa.fa-fw.fa-smile-o
= t "views.actions.view"
= t(".actions.view_smiles")
- if privileged?(comment.user) || privileged?(a.user)
%a.dropdown-item.text-danger{ href: "#", data: { action: "ab-comment-destroy", c_id: comment.id } }
%i.fa.fa-fw.fa-trash-o
= t "views.actions.delete"
= t("voc.delete")
- unless comment.user == current_user
%a.dropdown-item{ href: "#", data: { action: "ab-comment-report", c_id: comment.id } }
%i.fa.fa-fw.fa-exclamation-triangle
= t "views.acions.report"
= 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 } }

View File

@ -13,15 +13,15 @@
- if current_user.mod? || a.question.user == current_user
%a.dropdown-item.text-danger{ href: '#', tabindex: -1, data: { action: 'ab-question-destroy', q_id: a.question.id } }
%i.fa.fa-trash-o
= t 'views.actions.delete'
= t("voc.delete")
- unless a.question.user == current_user
%a.dropdown-item{ href: '#', tabindex: -1, data: { action: 'ab-question-report', q_id: a.question.id } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
= t("voc.report")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(a.question), target: '_blank' }
%i.fa.fa-gears
View in Kontrollzentrum
= t("voc.view_in_rails_admin")
%h6.text-muted.media-heading.answerbox__question-user
- if a.question.author_is_anonymous
%i.fa.fa-user-secret{ title: t('.anon_hint') }
@ -29,6 +29,6 @@
- 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('views.general.answer'))
= pluralize(a.question.answer_count, t("voc.answer"))
.answerbox__question-text
= question_markdown a.question.content

View File

@ -27,7 +27,7 @@
- if i.question.author_is_anonymous && i.question.author_identifier.present?
%a.dropdown-item{ name: "ib-block-anon", data: { q_id: i.question.id } }
%i.fa.fa-minus-circle
= t("views.actions.block")
= t("voc.block")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(i) }
%i.fa.fa-gears

View File

@ -6,5 +6,5 @@
.alert.alert-dismissible{ class: "alert-#{bootstrap_color key}", role: :alert }
%button.close{ type: :button, data: { dismiss: :alert } }
%span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close'
%span.sr-only= t("voc.close")
= value

View File

@ -7,7 +7,7 @@
= t '.title'
%button.close{ data: { dismiss: :modal }, type: :button }
%span{ aria: { hidden: true } } ×
%span.sr-only= t 'views.actions.close'
%span.sr-only= t("voc.close")
= bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: :novalidate }) do |f|
= f.hidden_field :user, value: user.screen_name
- if user.bans.count > 1

View File

@ -10,5 +10,5 @@
= f.radio_button :duration_unit, unit, label: unit, checked: true
= f.text_field :reason, placeholder: t('.reason')
.modal-footer
%button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close'
%button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t("voc.close")
= f.submit t('.hammertime'), class: 'btn btn-primary', name: 'hammer-time'

View File

@ -9,10 +9,10 @@
= nav_entry t('views.navigation.discover'), discover_path, icon: 'compass'
%ul.nav.navbar-nav
- if @user.present? && @user != current_user
%li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.list') }
%li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t(".list") }
%a.nav-link{ href: '#', data: { target: '#modal-list-memberships', toggle: :modal } }
%i.fa.fa-list.hidden-xs
%span.d-none.d-sm-inline.d-md-none= t('views.actions.list')
%span.d-none.d-sm-inline.d-md-none= t(".list")
= nav_entry t('views.navigation.notifications'), notifications_path, badge: notification_count, class: 'd-block d-sm-none'
%li.nav-item.dropdown.d-none.d-sm-block
%a.nav-link.dropdown-toggle{ href: '#', data: { toggle: :dropdown } }
@ -23,7 +23,7 @@
%span.sr-only= t('views.navigation.notifications')
%span.badge= notification_count
= render 'navigation/dropdown/notifications', notifications: notifications, size: "desktop"
%li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.ask_question') }
%li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('.ask_question') }
%a.nav-link{ href: '#', name: 'toggle-all-ask', data: { target: '#modal-ask-followers', toggle: :modal } }
%i.fa.fa-pencil-square-o
%li.nav-item.dropdown.profile--image-dropdown

View File

@ -20,11 +20,11 @@
q_id: question.id,
redirect: question.author_is_anonymous? ? '/' : show_user_questions_path(question.user.screen_name) } }
%i.fa.fa-trash-o
= t 'views.actions.delete'
= t("voc.delete")
- unless question.user == current_user
%a.dropdown-item{ href: '#', tabindex: -1, data: { action: 'ab-question-report', q_id: question.id } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
= t("voc.report")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(question) }
%i.fa.fa-gears

View File

@ -11,7 +11,7 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start
%button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @answers_last_id } }
= t 'views.actions.load'
= t("voc.load")
- if user_signed_in? && !current_user.answered?(@question) && current_user != @question.user && @question.user&.privacy_allow_stranger_answers
.card#q-answer-box
@ -20,7 +20,7 @@
%textarea.form-control#q-answer-text{ placeholder: t("inbox.entry.placeholder"), data: { id: @question.id } }
%br/
%button.btn.btn-success#q-answer-btn{ data: { q_id: @question.id } }
= t('views.actions.answer')
= t("voc.answer")
- current_user.services.each do |service|
%label
%input{ type: 'checkbox', name: 'share', checked: :checked, data: { q_id: @question.id, service: service.provider } }

View File

@ -12,7 +12,7 @@
%p.text-muted.mb-0= t(".blocked", time: time_ago_in_words(block.created_at))
.ml-auto.d-inline-flex
%button.btn.btn-default.align-self-center{ data: { action: :unblock, target: block.target.screen_name } }
%span.pe-none= t("views.actions.unblock")
%span.pe-none= t("voc.unblock")
- if @blocks.empty?
%p.text-muted.text-center= t(".none")
@ -32,7 +32,7 @@
%p.text-muted.mb-0= t(".blocked", time: time_ago_in_words(block.created_at))
.ml-auto.d-inline-flex
%button.btn.btn-default.align-self-center{ data: { action: "anon-unblock", target: block.id } }
%span.pe-none= t("views.actions.unblock")
%span.pe-none= t("voc.unblock")
- if @anonymous_blocks.empty?
%p.text-muted.text-center= t(".none")

View File

@ -16,11 +16,11 @@
- if current_user.mod? || q.user == current_user
%a.dropdown-item.text-danger{ href: '#', tabindex: -1, data: { action: 'ab-question-destroy', q_id: q.id } }
%i.fa.fa-trash-o
= t 'views.actions.delete'
= t("voc.delete")
- unless q.user == current_user
%a.dropdown-item{ href: '#', tabindex: -1, data: { action: 'ab-question-report', q_id: q.id } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
= t("voc.report")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(q) }
%i.fa.fa-gears
@ -30,6 +30,6 @@
- if q.answer_count > 1
·
%a{ href: question_path(q.user.screen_name, q.id) }
= pluralize(q.answer_count, t('views.general.answer'))
= pluralize(q.answer_count, t("voc.answer"))
.answerbox__question-text
= question_markdown q.content

View File

@ -7,7 +7,7 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start
%button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @timeline_last_id } }
= t 'views.actions.load'
= t("voc.load")
- provide(:title, @title || APP_CONFIG["site_name"])
- parent_layout 'feed'

View File

@ -5,42 +5,42 @@
- elsif user_signed_in?
- if current_user.following? user
%button.btn.btn-primary.btn-block{ type: :button, name: 'user-action', data: { action: :unfollow, type: type, target: user.screen_name } }
= t 'views.actions.unfollow'
= t("voc.unfollow")
- else
%button.btn.btn-primary.btn-block{ type: :button, name: 'user-action', data: { action: :follow, type: type, target: user.screen_name } }
= t 'views.actions.follow'
= t("voc.follow")
.btn-group.btn-block
%button.btn.btn-light.btn-block.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
= t 'views.actions.title'
= t(".title")
%span.caret
.dropdown-menu
%a.dropdown-item.d-block.d-sm-none{ href: '#', data: { target: '#modal-list-memberships', toggle: :modal } }
%i.fa.fa-list
= t 'views.actions.list'
= t(".list")
- if current_user.blocking?(user)
%a.dropdown-item{ href: '#', data: { action: :unblock, target: user.screen_name } }
%i.fa.fa-minus-circle
%span.pe-none= t 'views.actions.unblock'
%span.pe-none= t("voc.unblock")
- else
%a.dropdown-item{ href: '#', data: { action: :block, target: user.screen_name } }
%i.fa.fa-minus-circle
%span.pe-none= t 'views.actions.block'
%span.pe-none= t("voc.block")
%a.dropdown-item{ href: '#', data: { action: 'report-user', target: user.screen_name } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
= t("voc.report")
- if current_user.mod?
%a.dropdown-item{ href: '#', data: { target: '#modal-privileges', toggle: :modal } }
%i.fa.fa-wrench
= raw t('views.actions.privilege', user: user.screen_name)
= raw t(".privilege", user: user.screen_name)
- unless user.has_role?(:administrator)
%a.dropdown-item{ href: '#', data: { target: '#modal-ban', toggle: :modal } }
%i.fa.fa-ban
= t 'views.actions.ban'
= t(".ban")
- if current_user.mod? && user != current_user
%a.dropdown-item{ href: mod_inbox_index_path(user: user.screen_name) }
%i.fa.fa-inbox
= t("views.actions.view_inbox")
= t(".view_inbox")
- if current_user.has_role? :administrator
%a.dropdown-item{ href: rails_admin_path_for_resource(user), target: '_blank' }
%i.fa.fa-cogs
View in Kontrollzentrum
= t("voc.view_in_rails_admin")

View File

@ -7,7 +7,7 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start
%button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @questions_last_id } }
= t 'views.actions.load'
= t("voc.load")
- provide(:title, questions_title(@user))
- parent_layout 'user/profile'

View File

@ -8,7 +8,7 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start
%button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @answers_last_id } }
= t 'views.actions.load'
= t("voc.load")
:ruby
provide(:title, user_title(@user))

View File

@ -8,7 +8,7 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start
%button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @relationships_last_id } }
= t 'views.actions.load'
= t("voc.load")
- provide(:title, user_title(@user, 'friends and followers'))
- parent_layout 'user/profile'

View File

@ -27,6 +27,6 @@ export_i18n_js: false
translations:
- file: 'app/javascript/retrospring/i18n.ts'
only: ['*.frontend.*', '*.views.actions.*']
only: ['voc.*', '*.frontend.*', '*.views.actions.*']
prefix: "import I18n from 'i18n-js'\nimport Cookies from 'js-cookie'\n"
suffix: "I18n.defaultLocale = 'en';\nI18n.locale = Cookies.get('hl') || 'en';\nexport default I18n"

View File

@ -9,46 +9,13 @@ en:
comment: "Comment..."
question: "Type your question here…"
general:
answer: "Answer"
question: "Question"
comment: "Comment"
smile: "Smile"
follower: "Follower"
following: "Following"
timeline: "Timeline"
public: "Public"
user: "User"
list:
title: "List"
members: "Members"
actions:
title: "Actions"
ask: "Ask"
ask_question: "Ask a question"
answer: "Answer"
options: "Options"
delete: "Delete"
report: "Report"
return: "Return to Inbox"
subscribe: "Subscribe"
unsubscribe: "Unsubscribe"
view: "View comment smiles"
view_inbox: "View inbox"
load: "Load more"
follow: "Follow"
unfollow: "Unfollow"
list: "Manage list memberships"
ban: "Ban Control"
privilege: "Check %{user}'s privileges"
save: "Save changes"
cancel: "Cancel"
close: "Close"
done: "Done"
y: "Yes"
n: "No"
remove: "Remove"
block: "Block"
unblock: "Unblock"
sessions:
destroy: "Logout"
create: "Sign in"

View File

@ -80,6 +80,17 @@ en:
answerbox:
header:
anon_hint: :inbox.entry.anon_hint
actions:
share:
twitter: "Share on Twitter"
tumblr: "Share on Tumblr"
other: "Share on other apps..."
subscribe: "Subscribe"
unsubscribe: "Unsubscribe"
return: "Return to Inbox"
comments:
actions:
view_smiles: "View comment smiles"
application:
questionbox:
title: "Ask something!"
@ -236,6 +247,9 @@ en:
none: :notifications.index.none
all: "Show all notifications"
new: "Show all new notifications"
desktop:
ask_question: "Ask a question"
list: :user.actions.list
notifications:
index:
title: "Notifications"
@ -476,3 +490,10 @@ en:
heading: "Reason:"
none: "No reason provided"
view: "View reported %{content}"
user:
actions:
view_inbox: "View inbox"
privilege: "Check %{user}'s privileges"
ban: "Ban Control"
title: "Actions"
list: "Manage list memberships"

View File

@ -1,19 +1,25 @@
en:
voc:
answer: "Answer"
block: "Block"
cancel: "Cancel"
close: "Close"
confirm: "Are you sure?"
delete: "Delete"
edit: "Edit"
follow: "Follow"
load: "Load more"
login: "Sign in"
save: "Save changes"
register: "Sign up"
report: "Report"
terms: "Terms of Service"
unblock: "Unblock"
unfollow: "Unfollow"
update: "Update"
view_in_rails_admin: "View in Rails Admin"
y: Yes
n: No
messages:
noauth: "You need to be logged in to perform this action."
time: