From 17bbb0705b960cc80aefa54aa15e585ff111fa4a Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 2 Oct 2013 17:23:49 +0200 Subject: [PATCH] fix i18n --- .../finance/financial_transactions_controller.rb | 8 ++++---- config/locales/de.yml | 12 +++++++----- config/locales/en.yml | 12 +++++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/controllers/finance/financial_transactions_controller.rb b/app/controllers/finance/financial_transactions_controller.rb index a129a49d..8865958e 100644 --- a/app/controllers/finance/financial_transactions_controller.rb +++ b/app/controllers/finance/financial_transactions_controller.rb @@ -34,7 +34,7 @@ class Finance::FinancialTransactionsController < ApplicationController @financial_transaction = FinancialTransaction.new(params[:financial_transaction]) @financial_transaction.user = current_user @financial_transaction.add_transaction! - redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: t('finance.financial_transactions.create.notice') + redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: I18n.t('finance.financial_transactions.controller.create.notice') rescue ActiveRecord::RecordInvalid => error flash.now[:alert] = error.message render :action => :new @@ -44,16 +44,16 @@ class Finance::FinancialTransactionsController < ApplicationController end def create_collection - raise "Notiz wird benötigt!" if params[:note].blank? + raise I18n.t('finance.financial_transactions.controller.create_collection.error_note_required') if params[:note].blank? params[:financial_transactions].each do |trans| # ignore empty amount fields ... unless trans[:amount].blank? Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user) end end - redirect_to finance_ordergroups_url, notice: t('finance.create_collection.create.notice') + redirect_to finance_ordergroups_url, notice: I18n.t('finance.financial_transactions.controller.create_collection.notice') rescue => error - redirect_to finance_new_transaction_collection_url, alert: t('finance.create_collection.create.alert', error: error.to_s) + redirect_to finance_new_transaction_collection_url, alert: I18n.t('finance.financial_transactions.controller.create_collection.alert', error: error.to_s) end protected diff --git a/config/locales/de.yml b/config/locales/de.yml index f562bf87..b956b3f3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -649,11 +649,13 @@ de: create: notice: Rechnung wurde erstellt. financial_transactions: - create: - notice: Die Transaktion wurde gespeichert. - create_collection: - alert: ! 'Ein Fehler ist aufgetreten: %{error}' - notice: Alle Transaktionen wurden gespeichert. + controller: + create: + notice: Die Transaktion wurde gespeichert. + create_collection: + alert: ! 'Ein Fehler ist aufgetreten: %{error}' + error_note_required: ! 'Notiz wird benötigt!' + notice: Alle Transaktionen wurden gespeichert. index: balance: ! 'Kontostand: %{balance}' last_updated_at: (zuletzt aktualisiert vor %{when}) diff --git a/config/locales/en.yml b/config/locales/en.yml index e42480e3..2c89b7f1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -653,11 +653,13 @@ en: create: notice: Invoice was created financial_transactions: - create: - notice: The transaction was saved. - create_collection: - alert: ! 'An error occured: %{error}' - notice: All transactions were saved. + controller: + create: + notice: The transaction was saved. + create_collection: + alert: ! 'An error occured: %{error}' + error_note_required: ! 'Note is required!' + notice: All transactions were saved. index: balance: ! 'Balance of account: %{balance}' last_updated_at: (last updated %{when} ago)