In I18n, you can pass the :default option, comprised of an array with other places to look for the translation, just in case it cannot find it with the given key. The problem is that when using the html suffix in the key, ActionView::Helpers::TranslationHelper.translate doesn't check any of the default options. It only checks the given key (the first argument).
I propose translate should loop through the array of keys to search (comprised of the given key, and then the default). It can rescue the exception I18n::MissingTranslationData to continue looking through the loop until it finds a match. When it finds a match, then it can mark it as html_safe if need be. If it doesn't find a match, then it can raise that exception.
Problem, in code:
template.translate('key.that.does.not.exist', :default => 'key.that.exists.html') # returns value of `key.that.exists.html` **but** it is not `html_safe`.
What do you think? I can give a shot at doing this, but decided to run by you guys first.
Added tests for HABTM associations with counter_sql
Signed-off-by: Michael Koziarski <firstname.lastname@example.org>
I'm sorry, I'm not sure I quite understand what you're saying here. Are you reporting two bugs?
Or is it just one of these? Or did I misinterpret you completely?
2 :) But this was posted earlier this year -- not sure if it's been fixed in the later versions of Rails.
Can you check if it is fixed in later versions ? Thanks.
@ramontayag what is the status of this issue. Can I close it?
wrap translate defaults to use translate helper features, closes #1102