How to customize Rails I18n key suffixes like?`_md`?for Markdown | Island94.org
18-Jul-2025 22
If you’ve had reason to use internationalization in Rails on Rails, you’ve probably used a nifty feature of it:
Keys with a _html suffix… are marked as HTML safe. When you use them in views the HTML will not be escaped.
Authoring HTML within translations can be a pain because HTML is quite verbose and easy to mess up when maintaining multiple versions of the same phrase, or paragraph, or page across multiple languages.
It would be nice 💅 to have something like this:
Keys with a _md suffix can be authored in Markdown and will be automatically converted to HTML and marked as HTML safe.
Markdown is a lot less verbose than HTML and easier to write and eyeball. Let’s do it!
First, we have to patch into the I18n translate method. It looks something like this:.
How to customize Rails I18n key suffixes like?`_md`?for Markdown | Island94.org #ruby #rubydeveloper #rubyonrails #customize #Rails #suffixes #like?`_md`?for #Markdown #Island94.org https://rubyonrails.ba/link/how-to-customize-rails-i18n-key-suffixes-like-_md-for-markdown-island94-org