Is there an existing I18N translation for booleans?
问题 I need to display "Yes" or "No" in various languages based on whether a expression is true or false. Currently I am doing it like this: fr.yml: fr: "yes": Oui "no": Non a helper method: def t_boolean(expression) (expression) ? t("yes") : t("no") end erb: Valid: <%= t_boolean(something.is_valid?) %> Is there some better way to do this? Does Rails already have translations for true/false like this? 回答1: After reading this, I got inspired and figured out this solution: fr.yml fr: "true": Oui