In summary, the problem is that some "translated values" in the
built-in Rails en.yml files have non-string values such as
booleans, . For example in
activesupport/lib/active_support/locale/en.yml:
en:
<---- snip ---->
Used in array.to_sentence.
support: array:
sentence_connector: "and"
skip_last_comma: false
When globalize2 gets the "translation" for
:"support.array.skip_last_comma", which is false, it assumes there
is no translation (but there is... it's just the boolean value of
false). This problem goes unnoticed until you extend the
I18n.exception_handler (to do more fallback logic, exception
notification, etc) like so:
module I18n
def self.just_raise_that_exception(exception, locale, key,
options)
if MissingTranslationData === exception
# fallbacks, exception notification, etc
raise exception
end
end end
I18n.exception_handler = :just_raise_that_exception
To reproduce this problem, just extend the I18n module as above,
then go into the console and create an invalid object then look at
its error messages in sentence form:
o = SomeObjectThatHasValidations.new
o.valid?
c.errors.full_messages.to_sentence
I18n::MissingTranslationData: translation missing: en, support,
array, skip_last_comma