diff --git a/concepts/Internationalization/Internationalization.md b/concepts/Internationalization/Internationalization.md index 161fc6f80..d3c3679af 100644 --- a/concepts/Internationalization/Internationalization.md +++ b/concepts/Internationalization/Internationalization.md @@ -17,6 +17,12 @@ From a view:

<%= i18n('That\'s right-- you can use either i18n() or __()') %>

``` +From a controller: +```javascript +sails.__('Hello'); // uses config.i18n.defaultLocale +req.i18n.__('Hello'); // uses language from request header +``` + ##### Overriding language headers diff --git a/concepts/Internationalization/Locales.md b/concepts/Internationalization/Locales.md index 097d782a4..66b69fdd3 100644 --- a/concepts/Internationalization/Locales.md +++ b/concepts/Internationalization/Locales.md @@ -14,7 +14,7 @@ Here is an example locale file (`config/locales/es.json`): } ``` -Locales can be accessed in controller actions and policies through `res.i18n()`, or in views through the `__(key)` or `i18n(key)` functions. +Locales can be accessed in controller actions and policies through `req.i18n.__()`, or in views through the `__(key)` or `i18n(key)` functions. ```ejs

<%= __('Welcome to PencilPals!') %>