Skip to content

Commit

Permalink
Styleguide: _html and _markdown i18n suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik committed Dec 17, 2015
1 parent 754ebd6 commit 3c9c3e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions styleguide/README.md
Expand Up @@ -429,6 +429,16 @@ Do `t("this.here")` and not `t(:"this.here")`.

Where a simple unquoted symbol will do, they're fine: `t(:this)`

### Use `_html` and `_markdown` i18n key suffixes.

If a translation string contains HTML, use a `_html` suffix, e.g. `t("foo.bar_html")`

If a translation string contains Markdown, use a `_markdown` suffix, e.g. `t("foo.bar_markdown")`

Rails will automatically consider `_html` i18n values to be HTML safe, and this also communicates to the translator what they're allowed to do.

The `_markdown` suffix gets no automatic special treatment, but it also communicates to the translator what they can do.

### Use `%r{}` for regular expressions with slashes.

`%r{https?://}` reads better than `/https?:\/\//`.
Expand Down

0 comments on commit 3c9c3e4

Please sign in to comment.