diff options
Diffstat (limited to 'guides/source/i18n.md')
-rw-r--r-- | guides/source/i18n.md | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 33daa79133..6b36f67874 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -492,12 +492,14 @@ Overview of the I18n API Features You should have good understanding of using the i18n library now, knowing all necessary aspects of internationalizing a basic Rails application. In the following chapters, we'll cover it's features in more depth. +These chapters will show examples using both the `I18n.translate` method as well as the [`translate` view helper method](http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate) (noting the additional feature provide by the view helper method). + Covered are features like these: * looking up translations * interpolating data into translations * pluralizing translations -* using safe HTML translations +* using safe HTML translations (view helper method only) * localizing dates, numbers, currency, etc. ### Looking up Translations @@ -585,6 +587,8 @@ you can look up the `books.index.title` value **inside** `app/views/books/index. <%= t '.title' %> ``` +NOTE: Automatic translation scoping by partial is only available from the `translate` view helper method. + ### Interpolation In many cases you want to abstract your translations so that **variables can be interpolated into the translation**. For this reason the I18n API provides an interpolation feature. @@ -654,7 +658,7 @@ I18n.default_locale = :de ### Using Safe HTML Translations -Keys with a '_html' suffix and keys named 'html' are marked as HTML safe. Use them in views without escaping. +Keys with a '_html' suffix and keys named 'html' are marked as HTML safe. When you use them in views the HTML will not be escaped. ```yaml # config/locales/en.yml @@ -673,6 +677,8 @@ en: <div><%= t('title.html') %></div> ``` +NOTE: Automatic conversion to HTML safe translate text is only available from the `translate` view helper method. + ![i18n demo html safe](images/i18n/demo_html_safe.png) How to Store your Custom Translations |