From cd2685a1799ac8ffb33c34eb14236edd44691e01 Mon Sep 17 00:00:00 2001 From: pixeldesu Date: Sun, 7 Jun 2015 16:24:41 +0200 Subject: [PATCH] localized moderation, sidebar, userbox, etc. --- app/views/group/index.html.haml | 2 +- app/views/moderation/_discussion.html.haml | 4 ++-- .../moderation/_moderation_nav.html.haml | 12 ++++++------ .../moderation/_moderation_tabs.html.haml | 10 +++++----- app/views/moderation/_moderationbox.html.haml | 15 ++++----------- app/views/services/index.html.haml | 8 ++++---- app/views/shared/_sidebar.html.haml | 10 +++++----- app/views/shared/_userbox.html.haml | 6 +++--- config/locales/en.yml | 19 +++++++++++++++++++ 9 files changed, 49 insertions(+), 37 deletions(-) diff --git a/app/views/group/index.html.haml b/app/views/group/index.html.haml index 1ce3ecac..0d8493a8 100644 --- a/app/views/group/index.html.haml +++ b/app/views/group/index.html.haml @@ -14,5 +14,5 @@ - if @timeline.next_page %button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @timeline.current_page }} - Load more + = t 'views.actions.load' .visible-xs= render 'shared/links' diff --git a/app/views/moderation/_discussion.html.haml b/app/views/moderation/_discussion.html.haml index 231bb0f4..2603519f 100644 --- a/app/views/moderation/_discussion.html.haml +++ b/app/views/moderation/_discussion.html.haml @@ -1,5 +1,5 @@ - if report.moderation_comments.all.count == 0 - There are no comments yet. + = t 'views.answerbox.no_comment' - else %ul.comments - report.moderation_comments.order(:created_at).each do |comment| @@ -21,7 +21,7 @@ %li.text-danger %a{href: '#', tabindex: -1, data: { action: 'mod-comment-destroy', id: comment.id }} %i.fa.fa-trash-o - Delete + = t 'views.actions.delete' %p.comments--content= comment.content .form-group.has-feedback{name: 'mod-comment-new-group', data: { id: report.id }} %input.form-control.comments--box{type: :text, placeholder: 'Comment...', name: 'mod-comment-new', data: { id: report.id }} diff --git a/app/views/moderation/_moderation_nav.html.haml b/app/views/moderation/_moderation_nav.html.haml index f33f013a..081abced 100644 --- a/app/views/moderation/_moderation_nav.html.haml +++ b/app/views/moderation/_moderation_nav.html.haml @@ -6,11 +6,11 @@ %span.icon-bar %span.icon-bar %span.icon-bar - %a.navbar-brand{href: "/"} Moderation + %a.navbar-brand{href: moderation_path} Moderation #j2-tl-navbar-collapse.collapse.navbar-collapse %ul.nav.navbar-nav - = nav_entry "All reports", moderation_path - = nav_entry "Answers", moderation_path('answer') - = nav_entry "Comments", moderation_path('comment') - = nav_entry "Users", moderation_path('user') - = nav_entry "Questions", moderation_path('question') \ No newline at end of file + = nav_entry t('views.moderation.tabs.all'), moderation_path + = nav_entry t('views.general.answer').pluralize(2) , moderation_path('answer') + = nav_entry t('views.general.comment').pluralize(2), moderation_path('comment') + = nav_entry t('views.general.user').pluralize(2) , moderation_path('user') + = nav_entry t('views.general.question').pluralize(2), moderation_path('question') diff --git a/app/views/moderation/_moderation_tabs.html.haml b/app/views/moderation/_moderation_tabs.html.haml index 51363d73..f933578b 100644 --- a/app/views/moderation/_moderation_tabs.html.haml +++ b/app/views/moderation/_moderation_tabs.html.haml @@ -1,8 +1,8 @@ .col-md-3.col-sm-3.col-xs-12 .panel.panel-default.hidden-xs %ul.nav.nav-pills.nav-stacked - = list_group_item "All reports", moderation_path - = list_group_item "Answers", moderation_path('answer') - = list_group_item "Comments", moderation_path('comment') - = list_group_item "Users", moderation_path('user') - = list_group_item "Questions", moderation_path('question') + = list_group_item t('views.moderation.tabs.all'), moderation_path + = list_group_item t('views.general.answer').pluralize(2), moderation_path('answer') + = list_group_item t('views.general.comment').pluralize(2), moderation_path('comment') + = list_group_item t('views.general.user').pluralize(2), moderation_path('user') + = list_group_item t('views.general.question').pluralize(2), moderation_path('question') diff --git a/app/views/moderation/_moderationbox.html.haml b/app/views/moderation/_moderationbox.html.haml index 2e44b39e..60676dc8 100644 --- a/app/views/moderation/_moderationbox.html.haml +++ b/app/views/moderation/_moderationbox.html.haml @@ -2,12 +2,7 @@ .panel.panel-default.moderationbox{data: { id: report.id }} .panel-heading %img.img-rounded.answerbox--img{src: gravatar_url(report.user)} - = user_screen_name report.user - reported a - = report.type.sub('Reports::', '') - %span{title: report.created_at, data: { toggle: :tooltip, placement: :bottom }} - = time_ago_in_words(report.created_at) - ago + = raw t('views.moderation.moderationbox.reported', user: user_screen_name(report.user), content: report.type.sub('Reports::', ''), time: time_tooltip(report)) .panel-body %p - if report.type == 'Reports::User' @@ -15,8 +10,7 @@ - else = report.target.content %p - %b - Reason: + %b= t 'views.moderation.moderationbox.reason' %br - (report.reason || "No reason provided.").lines.each do |reason| - next unless reason.strip.length > 0 @@ -25,11 +19,10 @@ .row .col-md-6.col-sm-4.col-xs-6.text-left %a.btn.btn-primary{href: content_url(report)} - View reported - = report.type.sub('Reports::', '') + = t('views.moderation.moderationbox.view', content: report.type.sub('Reports::', '')) - if report.target.respond_to? :user and not report.target.user.nil? %a.btn.btn-primary{href: show_user_profile_path(report.target.user.screen_name)} - View reported User + = t('views.moderation.moderationbox.view', content: t('views.general.user')) .col-md-6.col-sm-8.col-xs-6.text-right %span.mod-count{id: "mod-count-#{report.id}"} = report.votes diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml index a198bce9..803ed7ac 100644 --- a/app/views/services/index.html.haml +++ b/app/views/services/index.html.haml @@ -6,13 +6,13 @@ .panel.panel-default .panel-body - if @services.count > 0 - Sharing is enabled for the following services: + = t 'views.settings.service.enabled' - else - You have not connected any services yet. + = t 'views.settings.service.none' - APP_CONFIG['sharing'].each do |service, service_options| - if service_options['enabled'] and !@services.any? { |x| x.provider == service.to_s } - %p=link_to "Connect to #{service.capitalize}", "/auth/#{service}" + %p=link_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}" - if @services.count > 0 %ul.list-group @@ -21,4 +21,4 @@ %i{class: "fa fa-#{service.provider}"} %strong= service.provider.capitalize (#{service.nickname}) - = link_to 'Disconnect', service_path(service), data: { confirm: "Really disconnect service #{service.provider.capitalize}?" }, method: :delete + = link_to t('views.settings.service.disconnect'), service_path(service), data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) }, method: :delete diff --git a/app/views/shared/_sidebar.html.haml b/app/views/shared/_sidebar.html.haml index d9304d8d..afa71294 100644 --- a/app/views/shared/_sidebar.html.haml +++ b/app/views/shared/_sidebar.html.haml @@ -17,21 +17,21 @@ %a{href: show_user_followers_path(current_user.screen_name)} .col-md-6.col-sm-6.col-xs-6 %h4.entry-text#follower-count= current_user.follower_count - %h6.entry-subtext Followers + %h6.entry-subtext= t('views.general.follower').pluralize(current_user.follower_count) %a{href: show_user_friends_path(current_user.screen_name)} .col-md-6.col-sm-6.col-xs-6 %h4.entry-text#friend-count= current_user.friend_count - %h6.entry-subtext Following + %h6.entry-subtext= t('views.general.following') .panel.panel-default.hidden-xs %ul.nav.nav-pills.nav-stacked - = list_group_item "Timeline", root_path - = list_group_item "Public", public_timeline_path + = list_group_item t('views.general.timeline'), root_path + = list_group_item t('views.general.public'), public_timeline_path - current_user.groups.each do |group| = list_group_item group.display_name, group_timeline_path(group.name) - unless @group.nil? .panel.panel-default.profile--panel.hidden-xs .panel-heading - %h3.panel-title Members + %h3.panel-title= t('views.group.members') .panel-body - @group.members.each do |member| %a{href: show_user_profile_path(member.user.screen_name), title: member.user.screen_name, data: { toggle: :tooltip, placement: :top }} diff --git a/app/views/shared/_userbox.html.haml b/app/views/shared/_userbox.html.haml index 74d1222a..2c5e5e67 100644 --- a/app/views/shared/_userbox.html.haml +++ b/app/views/shared/_userbox.html.haml @@ -18,8 +18,8 @@ .row .col-md-6.col-sm-6.col-xs-6 %h4.entry-text#asked-count= user.asked_count - %h6.entry-subtext Questions + %h6.entry-subtext= t('views.general.question').pluralize(user.asked_count) .col-md-6.col-sm-6.col-xs-6 %h4.entry-text#answered-count= user.answered_count - %h6.entry-subtext Answers - = render 'user/actions', user: user, type: type \ No newline at end of file + %h6.entry-subtext= t('views.general.answer').pluralize(user.answered_count) + = render 'user/actions', user: user, type: type diff --git a/config/locales/en.yml b/config/locales/en.yml index 35551de7..2838357d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -75,6 +75,12 @@ en: smile: "Smile" follower: "Follower" following: "Following" + timeline: "Timeline" + public: "Public" + user: "User" + group: + title: "Group" + members: "Members" actions: title: "Actions" answer: "Answer" @@ -100,6 +106,13 @@ en: destroy: "Logout" create: "Sign in" new: "Sign up" + moderation: + tabs: + all: "All reports" + moderationbox: + reported: "%{user} reported a %{content} %{time} ago" + reason: "Reason:" + view: "View reported %{content}" navigation: timeline: "Timeline" inbox: "Inbox" @@ -227,6 +240,12 @@ en: anonymous: "Allow anonymous questions" public: "Show your answers in the public timeline" stranger: "Allow other people to answer your questions" + service: + enabled: "Sharing is enabled for the following services:" + none: "You have not connected any services yet." + connect: "Connect to %{service}" + disconnect: "Disconnect" + confirm: "Really disconnect service %{service}?" modal: bancontrol: title: "Ban Control Center"