From a0b17f60e5471aca379f9d6d8f677428f3128849 Mon Sep 17 00:00:00 2001 From: "j.wollert" Date: Fri, 8 Oct 2010 08:50:10 +0000 Subject: [PATCH] date error message gets localized git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1870 7926756e-e54e-46e6-9721-ed318f58905e --- app/controllers/cost_reports_controller.rb | 2 +- app/models/cost_query/validation.rb | 2 +- app/models/cost_query/validation/dates.rb | 2 +- app/views/cost_reports/index.rhtml | 4 ++-- config/locales/de.yml | 4 +++- config/locales/en.yml | 4 +++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/cost_reports_controller.rb b/app/controllers/cost_reports_controller.rb index 3687fefec0..9204c0ce12 100644 --- a/app/controllers/cost_reports_controller.rb +++ b/app/controllers/cost_reports_controller.rb @@ -147,7 +147,7 @@ class CostReportsController < ApplicationController def valid_query? return true unless @query errornous = @query.filters ? @query.filters.select { |f| !f.valid? } : [] - @custom_error = errornous.map do |err| + @custom_errors = errornous.map do |err| "Filter #{l(err.label)}: #{err.errors.join(", ")}" end errornous.empty? diff --git a/app/models/cost_query/validation.rb b/app/models/cost_query/validation.rb index 25f2b2f49a..903abec4be 100644 --- a/app/models/cost_query/validation.rb +++ b/app/models/cost_query/validation.rb @@ -5,7 +5,7 @@ module CostQuery::Validation begin val_module = CostQuery::Validation.const_get const_name metaclass.send(:include, val_module) - val_method = "validate_" + val_method.to_s + val_method = "validate_" + val_method.to_s.pluralize if method(val_method) validations << val_method else diff --git a/app/models/cost_query/validation/dates.rb b/app/models/cost_query/validation/dates.rb index 25b565adf0..e92afdb994 100644 --- a/app/models/cost_query/validation/dates.rb +++ b/app/models/cost_query/validation/dates.rb @@ -6,7 +6,7 @@ module CostQuery::Validation !!val.to_dateish rescue ArgumentError validate_dates(values - [val]) - errors << "\'#{val}\' is not a valid date!" + errors << "\'#{val}\' " + l(:validation_failure_date) false end end diff --git a/app/views/cost_reports/index.rhtml b/app/views/cost_reports/index.rhtml index ff29881346..1d96981b62 100644 --- a/app/views/cost_reports/index.rhtml +++ b/app/views/cost_reports/index.rhtml @@ -4,8 +4,8 @@ <%= stylesheet_link_tag 'reporting', :plugin => 'redmine_reporting' %> <% end %> -<% if @custom_error && !@custom_error.empty? %> - <% @custom_error.each do |err| %> +<% if @custom_errors && !@custom_errors.empty? %> + <% @custom_errors.each do |err| %>
<%= err %>
<% end %> <% end %> diff --git a/config/locales/de.yml b/config/locales/de.yml index def35d3136..fa2b83cd46 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -23,4 +23,6 @@ de: label_count: Anzahl label_sum: Summe - description_drill_down: Details anzeigen \ No newline at end of file + description_drill_down: Details anzeigen + + validation_failure_date: "ist kein gültiges Datum" diff --git a/config/locales/en.yml b/config/locales/en.yml index b496de7664..1813537b08 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -23,4 +23,6 @@ en: label_count: Count label_sum: Sum - description_drill_down: Show details \ No newline at end of file + description_drill_down: Show details + + validation_failure_date: "is not a valid date"