From 80ab359860591cf363cc8157a20f0cb6269772dc Mon Sep 17 00:00:00 2001 From: wvengen Date: Mon, 7 Mar 2016 22:17:18 +0100 Subject: [PATCH] Correct messages i18n --- .../app/controllers/messages_controller.rb | 2 +- .../messages/app/mailers/messages_mailer.rb | 4 ++-- ...est_public_messages_index.html.haml.deface | 5 +---- .../add_messages_prefs.html.haml.deface | 2 +- .../messagegroups/_messagegroups.html.haml | 4 ++-- .../views/admin/messagegroups/show.html.haml | 2 +- plugins/messages/config/locales/de.yml | 19 ++++++----------- plugins/messages/config/locales/en.yml | 21 ++++++++++--------- 8 files changed, 25 insertions(+), 34 deletions(-) diff --git a/plugins/messages/app/controllers/messages_controller.rb b/plugins/messages/app/controllers/messages_controller.rb index f05c4335..6d8b25aa 100644 --- a/plugins/messages/app/controllers/messages_controller.rb +++ b/plugins/messages/app/controllers/messages_controller.rb @@ -24,7 +24,7 @@ class MessagesController < ApplicationController @message.body = I18n.t('messages.model.reply_header', :user => original_message.sender.display, :when => I18n.l(original_message.created_at, :format => :short)) + "\n" original_message.body.each_line{ |l| @message.body += I18n.t('messages.model.reply_indent', :line => l) } else - redirect_to new_message_url, alert: 'Nachricht ist privat!' + redirect_to new_message_url, alert: I18n.t('messages.new.error_private') end end end diff --git a/plugins/messages/app/mailers/messages_mailer.rb b/plugins/messages/app/mailers/messages_mailer.rb index a793d83e..85695050 100644 --- a/plugins/messages/app/mailers/messages_mailer.rb +++ b/plugins/messages/app/mailers/messages_mailer.rb @@ -7,14 +7,14 @@ class MessagesMailer < Mailer reply_email_domain = FoodsoftConfig[:reply_email_domain] if reply_email_domain hash = message.mail_hash_for_user recipient - reply_to = "Foodsoft <#{FoodsoftConfig.scope}.#{message.id}.#{recipient.id}.#{hash}@#{reply_email_domain}>" + reply_to = "#{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig.scope}.#{message.id}.#{recipient.id}.#{hash}@#{reply_email_domain}>" else reply_to = "#{show_user(message.sender)} <#{message.sender.email}>" end mail subject: "[#{FoodsoftConfig[:name]}] " + message.subject, to: recipient.email, - from: "#{show_user(message.sender)} via Foodsoft <#{FoodsoftConfig[:email_sender]}>", + from: "#{show_user(message.sender)} via #{I18n.t('layouts.foodsoft')} <#{FoodsoftConfig[:email_sender]}>", reply_to: reply_to end end diff --git a/plugins/messages/app/overrides/home/index/latest_public_messages_index.html.haml.deface b/plugins/messages/app/overrides/home/index/latest_public_messages_index.html.haml.deface index d984b61c..b264102e 100644 --- a/plugins/messages/app/overrides/home/index/latest_public_messages_index.html.haml.deface +++ b/plugins/messages/app/overrides/home/index/latest_public_messages_index.html.haml.deface @@ -4,7 +4,4 @@ %section#messages %h2= t '.messages.title' = render 'messages/messages', messages: Message.pub.order('created_at DESC').limit(5), pagination: false - %p - = link_to t('.messages.view_all'), messages_path - != ' | ' - = link_to t('.message_threads.view_all'), message_threads_path + %p= raw t '.messages.view_all.text', messages: link_to(t('.messages.view_all.messages'), messages_path), threads: link_to(t('.messages.view_all.threads'), message_threads_path) diff --git a/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface b/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface index b41ef105..88ad9a8a 100644 --- a/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface +++ b/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface @@ -5,5 +5,5 @@ - if Messagegroup.any? .controls = link_to messagegroups_path do - = t('shared.user_form_fields.messagegroups') + = t '.messagegroups' %i.icon.icon-chevron-right diff --git a/plugins/messages/app/views/admin/messagegroups/_messagegroups.html.haml b/plugins/messages/app/views/admin/messagegroups/_messagegroups.html.haml index 6b3b1733..87b45b30 100644 --- a/plugins/messages/app/views/admin/messagegroups/_messagegroups.html.haml +++ b/plugins/messages/app/views/admin/messagegroups/_messagegroups.html.haml @@ -4,8 +4,8 @@ %table.table.table-striped %thead %tr - %th= t '.name' - %th= t '.members' + %th= Messagegroup.human_attribute_name :name + %th= Messagegroup.human_attribute_name :user_tokens %th= t 'ui.actions' %tbody - for messagegroup in @messagegroups diff --git a/plugins/messages/app/views/admin/messagegroups/show.html.haml b/plugins/messages/app/views/admin/messagegroups/show.html.haml index 6e77fea2..553b7e33 100644 --- a/plugins/messages/app/views/admin/messagegroups/show.html.haml +++ b/plugins/messages/app/views/admin/messagegroups/show.html.haml @@ -2,5 +2,5 @@ %section= render 'shared/group', group: @messagegroup = link_to t('ui.edit'), edit_admin_messagegroup_path(@messagegroup), class: 'btn' -= link_to t('ui.delete'), [:admin, @messagegroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger' += link_to t('ui.delete'), [:admin, @messagegroup], :data => {:confirm => t('ui.confirm_delete', name: @messagegroup.name)}, :method => :delete, class: 'btn btn-danger' = link_to t('.send_message'), new_message_path(:message => {:group_id => @messagegroup.id}), class: 'btn' diff --git a/plugins/messages/config/locales/de.yml b/plugins/messages/config/locales/de.yml index 8fb44fd1..55e642ff 100644 --- a/plugins/messages/config/locales/de.yml +++ b/plugins/messages/config/locales/de.yml @@ -23,17 +23,15 @@ de: new: title: Nachrichtengruppe anlegen show: - confirm: Bist Du sicher? - edit: Gruppe/Mitglieder bearbeiten send_message: Nachricht senden title: Nachrichtengruppe %{name} - messagegroups: - members: Mitglieder - name: Name home: index: - message_threads: - view_all: Alle Nachrichteverläufe anzeigen + messages: + view_all: + text: '%{messages} oder %{threads} anzeigen' + messages: + threads: messagegroups: index: body: Du kannst jede der Nachrichtengruppen beitreten oder sie wieder verlassen. @@ -52,10 +50,7 @@ de: message_threads: messagegroups: messages: - create: - notice: Message is saved and will be sent. - index: - message_threads: Nachrichtenverläufe + new: Neue Nachricht thread: all_message_threads: Alle Nachrichtenverläufe reply: Antworten @@ -63,7 +58,6 @@ de: groupmessage_threads: show_message_threads: Alle Nachrichtenverläufe anzeigen index: - new: Neue Nachricht other: Allgemeine Nachrichten title: Nachrichtenverläufe message_threads: @@ -73,7 +67,6 @@ de: started_by: Gestartet von show: other: Allgemeine Nachrichten - reply: Antworten navigation: admin: messagegroups: Nachrichtengruppen diff --git a/plugins/messages/config/locales/en.yml b/plugins/messages/config/locales/en.yml index a660e426..b006f78b 100644 --- a/plugins/messages/config/locales/en.yml +++ b/plugins/messages/config/locales/en.yml @@ -31,13 +31,8 @@ en: new: title: Create message group show: - confirm: Are you sure? - edit: Edit group/members send_message: Send message title: Message group %{name} - messagegroups: - members: Members - name: Name ordergroups: show: send_message: Send message @@ -63,7 +58,10 @@ en: index: messages: title: Newest messages - view_all: See all messages + view_all: + text: 'Show %{messages} or %{threads}' + messages: all messages + threads: threads start_nav: write_message: Write message messagegroups: @@ -84,10 +82,10 @@ en: message_threads: Show as threads messagegroups: Subscribe to groups messages: Show as list + new: New message create: notice: Message is saved and will be sent. index: - new: New message title: Messages messages: reply: Reply @@ -96,6 +94,7 @@ en: reply_indent: ! '> %{line}' reply_subject: ! 'Re: %{subject}' new: + error_private: Sorry, this message is private. hint_private: Message doesn’t show in Foodsoft mail inbox list: desc: ! 'Please send messages to all using the mailing-list: %{list}' @@ -125,13 +124,15 @@ en: groupmessage_threads: show_message_threads: show all index: - new: New message other: General title: Message threads + message_threads: + last_reply_at: Last replied at + last_reply_by: Last replied by + started_at: Started at + started_by: Started by show: - all_message_threads: All message threads other: General - reply: Reply messages_mailer: foodsoft_message: footer: ! 'Reply: %{reply_url}