diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index aebdc4d9..0b191a3a 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -15,7 +15,7 @@ class MessagesController < ApplicationController @message = @current_user.send_messages.new(params[:message]) if @message.save Resque.enqueue(UserNotifier, FoodsoftConfig.scope, 'message_deliver', @message.id) - redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet." + redirect_to messages_url, :notice => I18n.t('messages.create.notice') else render :action => 'new' end diff --git a/app/models/message.rb b/app/models/message.rb index 9a1ca56e..fbe586e0 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -48,9 +48,9 @@ class Message < ActiveRecord::Base def reply_to=(message_id) message = Message.find(message_id) add_recipients([message.sender]) - self.subject = "Re: #{message.subject}" - self.body = "#{message.sender.nick} schrieb am #{I18n.l(message.created_at, :format => :short)}:\n" - message.body.each_line{ |l| self.body += "> #{l}" } + self.subject = I18n.t('messages.model.reply_subject', :subject => message.subject) + self.body = I18n.t('messages.model.reply_header', :user => message.sender.nick, :when => I18n.l(message.created_at, :format => :short)) + "\n" + message.body.each_line{ |l| self.body += I18n.t('messages.model.reply_indent', :line => l) } end def mail_to=(user_id) @@ -64,7 +64,7 @@ class Message < ActiveRecord::Base end def sender_name - system_message? ? 'Foodsoft' : sender.nick rescue "??" + system_message? ? I18n.t('layouts.foodsoft') : sender.nick rescue "??" end def recipients diff --git a/app/views/messages/_messages.html.haml b/app/views/messages/_messages.html.haml index 555668ae..2874fe7a 100644 --- a/app/views/messages/_messages.html.haml +++ b/app/views/messages/_messages.html.haml @@ -11,4 +11,4 @@ %td= format_subject(message, 130) %td= h(message.sender_name) %td= format_time(message.created_at) - %td= link_to 'Antworten', new_message_path(:message => {:reply_to => message.id}), class: 'btn' \ No newline at end of file + %td= link_to t('.reply'), new_message_path(:message => {:reply_to => message.id}), class: 'btn' diff --git a/app/views/messages/index.html.haml b/app/views/messages/index.html.haml index 48885289..b8c41859 100644 --- a/app/views/messages/index.html.haml +++ b/app/views/messages/index.html.haml @@ -1,6 +1,6 @@ -- title "Nachrichten" +- title t('.title') - content_for :actionbar do - = link_to 'Neue Nachricht', new_message_path, class: 'btn btn-primary' + = link_to t('.new'), new_message_path, class: 'btn btn-primary' #messages - = render 'messages', messages: @messages, pagination: true \ No newline at end of file + = render 'messages', messages: @messages, pagination: true diff --git a/app/views/messages/new.haml b/app/views/messages/new.haml index 965bf7a5..fc291767 100644 --- a/app/views/messages/new.haml +++ b/app/views/messages/new.haml @@ -4,9 +4,9 @@ $('#message_recipient_tokens').tokenInput("#{users_path(:format => :json)}", { crossDomain: false, prePopulate: $('#message_recipient_tokens').data('pre'), - hintText: 'Nach Nutzerin suchen', - noResultText: 'Keine Nutzerin gefunden', - searchingText: 'Suche ...', + hintText: '#{t '.search_user'}', + noResultText: '#{t '.no_user_found'}', + searchingText: '#{t '.search'}', theme: 'facebook' }); @@ -19,25 +19,21 @@ }); }); -- title "Neue Nachricht" +- title t('.title') = simple_form_for @message do |f| - if FoodsoftConfig[:mailing_list].blank? = f.input :sent_to_all, :as => :boolean - else - %b Nachrichten an alle - verschickst Du bitte über den Verteiler: - = mail_to FoodsoftConfig[:mailing_list] + %b= t '.list.desc', list: mail_to(FoodsoftConfig[:mailing_list]) %br/ %small{:style => "color:grey"} - Eventuell musst Du Dich dem Verteiler erst bekannt machen. + = t '.list.subscribe_msg' %br/ - if FoodsoftConfig[:mailing_list_subscribe].blank? - Erklärungen zum Verteiler findest Du im - = link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe') + = t '.list.subscribe', link: link_to(t('.list.wiki'), wiki_page_path('MailingListe')) - else - z.b. mit einer Mail an - = mail_to FoodsoftConfig[:mailing_list_subscribe] + = t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe]) #recipients = f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json } @@ -47,4 +43,4 @@ = f.input :body, input_html: {class: 'input-xxlarge'} .form-actions = f.submit class: 'btn btn-primary' - = link_to 'oder abbrechen', :back + = link_to t('.cancel'), :back diff --git a/app/views/messages/show.haml b/app/views/messages/show.haml index e991268a..a1b0c139 100644 --- a/app/views/messages/show.haml +++ b/app/views/messages/show.haml @@ -1,21 +1,21 @@ -- title "Nachricht anzeigen" +- title t('.title') %div{:style => "width:40em"} %table{:style => "width:25em"} %tr - %td Von: + %td= t '.from' %td=h @message.sender_name %tr - %td Betreff: + %td= t '.subject' %td %b=h @message.subject %tr - %td Gesendet: + %td= t '.sent_on' %td= format_time(@message.created_at) %hr/ %p= simple_format(h(@message.body)) %hr/ %p - = link_to 'Antworten', new_message_path(:message => {:reply_to => @message.id}), class: 'btn' + = link_to t('.reply'), new_message_path(:message => {:reply_to => @message.id}), class: 'btn' | - = link_to 'Nachricht im Überblick', messages_path \ No newline at end of file + = link_to t('.all_messages'), messages_path diff --git a/config/locales/de/de.messages.yml b/config/locales/de/de.messages.yml new file mode 100644 index 00000000..edb553b6 --- /dev/null +++ b/config/locales/de/de.messages.yml @@ -0,0 +1,36 @@ +de: + messages: + index: + title: 'Nachrichten' + new: 'Neue Nachricht' + messages: + reply: 'Antworten' + new: + title: 'Neue Nachricht' + search_user: 'Nach Nutzerin suchen' + no_user_found: 'Keine Nutzerin gefunden' + search: 'Suche ...' + list: + desc: 'Nachrichten an alle verschickst Du bitte über den Verteiler: %{list}' + subscribe_msg: 'Eventuell musst Du Dich dem Verteiler erst bekannt machen.' + subscribe: 'Erklärungen zum Verteiler findest Du im %{link}.' + wiki: 'Wiki (Abschnitt Mailing-Liste)' + mail: 'z.b. mit einer Mail an %{email}.' + cancel: 'oder abbrechen' + show: + title: 'Nachricht anzeigen' + from: 'Von:' + subject: 'Betreff:' + sent_on: 'Gesendet:' + reply: 'Antworten' + all_messages: 'Nachricht im Überblick' + + # used by controller + create: + notice: 'Nachricht ist gespeichert und wird versendet.' + + # used by model + model: + reply_subject: 'Re: %{subject}' + reply_header: '%{user} schrieb am %{when}:' + reply_indent: '> %{line}'