Explicitly accessing translations as a hash during testing (ex. participatory_process.description["en"]) feels coupled to the implementation & can be prone to errors (what if you provide a symbol by mistake?).
I think it'd be a good idea to create a translate helper that automatically uses I18n.current_locale & coerces it into a string. This helper could be adapted to a possible future implementation as well.
Draft:
def translated(field, locale: I18n.locale)
field.try(:[], locale.to_s)
end
Explicitly accessing translations as a hash during testing (ex.
participatory_process.description["en"]) feels coupled to the implementation & can be prone to errors (what if you provide a symbol by mistake?).I think it'd be a good idea to create a
translatehelper that automatically usesI18n.current_locale& coerces it into a string. This helper could be adapted to a possible future implementation as well.Draft: