Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

[misc] Correct i18n calls from a controller #1302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions concepts/Internationalization/Internationalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ From a view:
<p> <%= i18n('That\'s right-- you can use either i18n() or __()') %> </p>
```

From a controller:
```javascript
sails.__('Hello'); // uses config.i18n.defaultLocale
req.i18n.__('Hello'); // uses language from request header
```


##### Overriding language headers

Expand Down
2 changes: 1 addition & 1 deletion concepts/Internationalization/Locales.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<h1> <%= __('Welcome to PencilPals!') %> </h1>
Expand Down