summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/development/i18n/externalization.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md
index f493ad4ae66..b2a2eef216d 100644
--- a/doc/development/i18n/externalization.md
+++ b/doc/development/i18n/externalization.md
@@ -211,10 +211,18 @@ There is also and alternative method to [translate messages from validation erro
- In JavaScript:
```js
- import { __, sprintf } from '../../../locale';
+ import { __, sprintf } from '~/locale';
sprintf(__('Hello %{username}'), { username: 'Joe' }) => 'Hello Joe'
```
+By default, `sprintf` escapes the placeholder values.
+If you want to take care of that yourself, you can pass `false` as third argument.
+
+ ```js
+ import { __, sprintf } from '~/locale';
+ sprintf(__('This is %{value}'), { value: '<strong>bold</strong>' }, false) => 'This is <strong>bold</strong>'
+ ```
+
The placeholders should match the code style of the respective source file.
For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript.