Skip to content

Commit 7e1ed32

Browse files
committed
GITBOOK-338: change request with no subject merged in GitBook
1 parent c7ed1e6 commit 7e1ed32

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎translation-function/formatting.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Formatting
22

3-
Starting with **i18next>=21.3.0** you can use the built-in formatting functions based on the [Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl).
3+
Starting with **i18next>=21.3.0** you can use the built-in formatting functions based on the [Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).
44

55
_You may need to_ [_polyfill_](https://formatjs.io/docs/polyfills/) _the Intl API:_
66

@@ -14,7 +14,7 @@ _You may need to_ [_polyfill_](https://formatjs.io/docs/polyfills/) _the Intl AP
1414
* [_Intl.DateTimeFormat_](https://formatjs.io/docs/polyfills/intl-datetimeformat) _(ES2020)_
1515

1616
{% hint style="info" %}
17-
🎓 Check out this topic in the [i18next crash course video](https://youtu.be/SA\_9i4TtxLQ?t=557).
17+
🎓 Check out this topic in the [i18next crash course video](https://youtu.be/SA_9i4TtxLQ?t=557).
1818
{% endhint %}
1919

2020
## Basic usage
@@ -28,6 +28,10 @@ The translation string has the following signature:
2828
}
2929
```
3030

31+
{% hint style="info" %}
32+
Use a "semicolon" delimited list of options.
33+
{% endhint %}
34+
3135
#### Passing options to the formatting:
3236

3337
1. In the translation string using `{{value, formatname(options1: options1Value)}}`
@@ -122,7 +126,7 @@ i18next.t('intlNumberWithOptions', { val: 2000, minimumFractionDigits: 3 });
122126
// --> Some 2,000.000
123127
```
124128

125-
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat)
129+
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat)
126130

127131
### Currency
128132

@@ -150,7 +154,7 @@ i18next.t('twoIntlCurrencyWithUniqueFormatOptions',
150154
// --> The value is $12,345.67 or 16 543,21 $ CA
151155
```
152156

153-
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat)
157+
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat)
154158

155159
### DateTime
156160

@@ -172,7 +176,7 @@ i18next.t('intlDateTime',
172176
// --> On the Thursday, December 20, 2012
173177
```
174178

175-
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/DateTimeFormat)
179+
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)
176180

177181
### RelativeTime
178182

@@ -194,7 +198,7 @@ i18next.t('intlRelativeTimeWithOptionsExplicit', { val: -3, style: 'long' });
194198
// --> Lorem 3 quarters ago
195199
```
196200

197-
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/RelativeTimeFormat)
201+
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat)
198202

199203
### List
200204

@@ -208,11 +212,11 @@ i18next.t('intlList', { val: ['locize', 'i18next', 'awesomeness'] });
208212
// --> A list of locize, i18next, and awesomeness
209213
```
210214

211-
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/ListFormat)
215+
For options see: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Intl/ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat)
212216

213217
## Legacy format function i18next<21.3.0
214218

215-
You can add formatting using [moment.js](http://momentjs.com/) and [numeral.js](http://numeraljs.com/) or the [intl api](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global\_Objects/Intl).
219+
You can add formatting using [moment.js](http://momentjs.com/) and [numeral.js](http://numeraljs.com/) or the [intl api](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Intl).
216220

217221
As a sample using momentjs to format dates.
218222

0 commit comments

Comments
 (0)