diff options
| author | Zog | 2018-03-16 16:35:13 +0100 |
|---|---|---|
| committer | Luc Donnet | 2018-03-23 17:21:56 +0100 |
| commit | 3b2f216a3f48b155b25235084aad8d5b16b21d7b (patch) | |
| tree | 6463f597c0306c43c43d05609f0f44151974af45 | |
| parent | 05f5d754df15f1d5cd19eb393f96fd2fe7f0973e (diff) | |
| download | chouette-core-3b2f216a3f48b155b25235084aad8d5b16b21d7b.tar.bz2 | |
Refs #6238; Update `t_action` method to handle the 'update' and 'create' actions
| -rw-r--r-- | config/initializers/i18n.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index 21fff6ff2..02d42f899 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -136,10 +136,19 @@ class ActiveRecord::Base # Translate the given action on the model, with default def self.t_action(action, params={}) + key = case action.to_sym + when :create + :new + when :update + :edit + else + action + end + begin - I18n.translate_without_fallback "#{i18n_key.pluralize}.actions.#{action}", ({raise: true}.update(params)) + I18n.translate_without_fallback "#{i18n_key.pluralize}.actions.#{key}", ({raise: true}.update(params)) rescue - I18n.translate_without_fallback "actions.#{action}", params + I18n.translate_without_fallback "actions.#{key}", params end end |
