Can I use a default I18n config for lookups if localisation file lookup fails?
As part of Rails, http://guides.rubyonrails.org/i18n.html#how-i18n-in-ruby-on-rails-works
As part of this solution, every static string in the Rails framework — e.g. Active Record validation messages, time and date formats — has been internationalized, so localization of a Rails application means “over-riding” these defaults.
So, when I add my own localisation files, I lose the default rails error text for ActiveRecord. e.g. given the following code within a Model
validates_length_of :name, :maximum => 50
When this fails, I get
translation missing: en-gb, activerecord, errors, models, model_name, attributes, name, too_long
Two possible fixes :
Add
:message
to each and everyvalidates_*
method? e.g.validates_length_of :name, :maximum => 50, :message => "is too long (maximum is %{count} characters)"
The problem with this is there are quite a few calls, and people adding new code would have to have remember to add the text. (And I dont think variable substitution works here!)
Add the set of defaults that rails uses in each and every locale config file, e.g
errors: messages: less_than: must be less than %{count}
The problem here is that the same text has to be added to every locale file (as I am not interested in translating these), this is not that big off a deal, but seems odd.
Which, if any, routes are advised? Any other ideas or suggestions?
Is there no default/fallback file that the I18n uses, i.e. if the lookup cannot be found in the locale file?
(Using rails 2.3.5)