From 75d4d5a07f5841c74e90e807ba40c090aad52d58 Mon Sep 17 00:00:00 2001 From: pixeldesu Date: Sun, 7 Jun 2015 00:24:27 +0200 Subject: [PATCH] localize inbox --- app/views/inbox/_entry.html.haml | 24 ++++++++---------------- app/views/inbox/_sidebar.html.haml | 18 +++++++++--------- app/views/inbox/show.html.haml | 4 ++-- app/views/layouts/_messages.html.haml | 4 ++-- config/locales/en.yml | 25 +++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/app/views/inbox/_entry.html.haml b/app/views/inbox/_entry.html.haml index c93e7817..1a514547 100644 --- a/app/views/inbox/_entry.html.haml +++ b/app/views/inbox/_entry.html.haml @@ -6,39 +6,31 @@ %img.img-rounded.answerbox--img{src: gravatar_url(i.question.user)} .media-body %h6.text-muted.media-heading.answerbox--question-user - = user_screen_name i.question.user, i.question.author_is_anonymous - asked - %span{title: i.question.created_at, data: { toggle: :tooltip, placement: :bottom }} - = time_ago_in_words(i.question.created_at) - ago + = raw t('views.inbox.entry.asked', user: user_screen_name(i.question.user, i.question.author_is_anonymous), time: time_tooltip(i.question)) - unless i.question.author_is_anonymous - if i.question.answer_count > 0 ยท %a{href: show_user_question_path(i.question.user.screen_name, i.question.id)} - #{i.question.answer_count} response(s) + = pluralize(i.question.answer_count, t('views.inbox.entry.response')) %p.answerbox--question-text= i.question.content .panel-body %textarea.form-control{name: 'ib-answer', placeholder: 'Write your answer here...', data: { id: i.id }} %br/ %button.btn.btn-success{name: 'ib-answer', data: { ib_id: i.id }} - Answer + = t 'views.actions.answer' %button.btn.btn-danger{name: 'ib-destroy', data: { ib_id: i.id }} - Delete + = t 'views.actions.delete' %button.btn.btn-default{name: 'ib-options', data: { ib_id: i.id, state: :hidden }} %i.fa.fa-cog - %span.sr-only Options + %span.sr-only= t 'views.actions.options' .panel-footer{id: "ib-options-#{i.id}", style: 'display: none'} - %h4 Sharing + %h4= t 'views.inbox.entry.sharing.title' - if current_user.services.count > 0 .row - current_user.services.each do |service| .col-md-3.col-sm-4.col-xs-6 %label %input{type: 'checkbox', name: 'ib-share', checked: :checked, data: { ib_id: i.id, service: service.provider }} - Post to - = service.provider.capitalize + = raw t('views.inbox.entry.sharing.post', service: service.provider.capitalize) - else - %p - You have not connected any services yet. Visit your - = link_to "service settings", services_path - to connect one. \ No newline at end of file + %p= raw t('views.inbox.entry.sharing.none', settings: link_to(t('views.inbox.entry.sharing.settings', services_path))) diff --git a/app/views/inbox/_sidebar.html.haml b/app/views/inbox/_sidebar.html.haml index dedb5906..b12bc91f 100644 --- a/app/views/inbox/_sidebar.html.haml +++ b/app/views/inbox/_sidebar.html.haml @@ -1,20 +1,20 @@ .panel.panel-default.inbox--panel .panel-heading - %h3.panel-title Out of questions? + %h3.panel-title= t 'views.inbox.sidebar.questions.title' .panel-body - %button.btn.btn-block.btn-info{type: :button, id: 'ib-generate-question'} Get new question + %button.btn.btn-block.btn-info{type: :button, id: 'ib-generate-question'}= t 'views.inbox.sidebar.questions.button' .panel.panel-default.inbox--panel .panel-heading - %h3.panel-title Share + %h3.panel-title= t 'views.inbox.sidebar.share.title' .panel-body %a.btn.btn-block.btn-primary{target: '_blank', href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{show_user_profile_url(current_user.screen_name)}"} - %i.fa.fa-twitter - Share on Twitter + %i.fa.fa-fw.fa-twitter + = raw t('views.inbox.sidebar.share.button', service: "Twitter") %a.btn.btn-block.btn-primary{target: '_blank', href: "http://www.tumblr.com/share/link?url=#{show_user_profile_url(current_user.screen_name)}&name=Ask%20me%20anything%21"} - %i.fa.fa-tumblr - Share on Tumblr + %i.fa.fa-fw.fa-tumblr + = raw t('views.inbox.sidebar.share.button', service: "Tumblr") .panel.panel-default.warning--panel .panel-heading - %h3.panel-title Actions + %h3.panel-title= t 'views.inbox.sidebar.actions.title' .panel-body - %button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (Inbox.where(user: current_user).empty? ? 'disabled' : nil), data: { ib_count: Inbox.where(user: current_user).count }} Delete all questions \ No newline at end of file + %button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (Inbox.where(user: current_user).empty? ? 'disabled' : nil), data: { ib_count: Inbox.where(user: current_user).count }}= t 'views.inbox.sidebar.actions.button' diff --git a/app/views/inbox/show.html.haml b/app/views/inbox/show.html.haml index c597545b..b93fd016 100644 --- a/app/views/inbox/show.html.haml +++ b/app/views/inbox/show.html.haml @@ -10,13 +10,13 @@ = render 'inbox/entry', i: i - if @inbox.empty? - Nothing to see here. + = t 'views.inbox.empty' #pagination= will_paginate @inbox, renderer: BootstrapPagination::Rails, page_links: false - if @inbox.next_page %button#load-more-btn.btn.btn-default{type: :button, data: { current_page: @inbox.current_page }} - Load more + = t 'views.actions.load' .col-md-9.col-xs-12.col-sm-9.visible-xs = render 'inbox/sidebar' diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml index 86ce825b..01a8e8de 100644 --- a/app/views/layouts/_messages.html.haml +++ b/app/views/layouts/_messages.html.haml @@ -1,10 +1,10 @@ %noscript .alert.alert-danger - Please activate JavaScript. + = t 'views.messages.noscript' - flash.each do |key, value| .alert.alert-dismissible{class: "alert-#{bootstrap_color key}", role: "alert"} %button.close{type: "button", "data-dismiss" => "alert"} %span{"aria-hidden" => "true"} × %span.sr-only Close - = value \ No newline at end of file + = value diff --git a/config/locales/en.yml b/config/locales/en.yml index abbdf50c..8e2511d0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,6 +21,28 @@ en: views: + messages: + noscript: "Please activate JavaScript." + inbox: + empty: "Nothing to see here." + sidebar: + questions: + title: "Out of questions?" + button: "Get new question" + share: + title: "Share" + button: "Share on %{service}" + actions: + title: "Actions" + button: "Delete all questions" + entry: + asked: "%{user} asked %{time} ago" + response: "response" + sharing: + title: "Sharing" + post: "Post to %{service}" + none: "You have not connected any services yet. Visit your %{settings} to connect one." + settings: "service settings" general: answer: "answer" question: "question" @@ -29,6 +51,8 @@ en: follower: "follower" following: "following" actions: + answer: "Answer" + options: "Options" anonymous: "Hide your name" delete: "Delete" report: "Report" @@ -36,6 +60,7 @@ en: subscribe: "Subscribe" unsubscribe: "Unsubscribe" view: "View comment smiles" + load: "Load more" sessions: destroy: "Logout" create: "Sign in"