Skip to content

Create a translation helper for testing #132

@josepjaume

Description

@josepjaume

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions