Skip to content

Commit

Permalink
Merge pull request #40 from barsoom/i18n-suffixes
Browse files Browse the repository at this point in the history
Styleguide: _html and _markdown i18n suffixes
  • Loading branch information
soma committed Jan 11, 2016
2 parents 754ebd6 + 3c9c3e4 commit 94bd3be
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 94bd3be

Please sign in to comment.