@intlayer/docs 5.7.8 → 5.8.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/intlayer_with_next-i18next.md +3 -4
- package/blog/ar/intlayer_with_next-intl.md +3 -4
- package/blog/ar/intlayer_with_react-i18next.md +1 -1
- package/blog/ar/intlayer_with_react-intl.md +1 -1
- package/blog/de/intlayer_with_next-i18next.md +3 -4
- package/blog/de/intlayer_with_react-intl.md +1 -1
- package/blog/en/intlayer_with_next-i18next.md +3 -4
- package/blog/en/intlayer_with_next-intl.md +3 -4
- package/blog/en/intlayer_with_react-i18next.md +1 -1
- package/blog/en/intlayer_with_react-intl.md +1 -1
- package/blog/en-GB/intlayer_with_next-i18next.md +3 -4
- package/blog/en-GB/intlayer_with_next-intl.md +3 -4
- package/blog/en-GB/intlayer_with_react-i18next.md +1 -1
- package/blog/en-GB/intlayer_with_react-intl.md +1 -1
- package/blog/es/intlayer_with_next-i18next.md +3 -4
- package/blog/es/intlayer_with_next-intl.md +3 -4
- package/blog/es/intlayer_with_react-i18next.md +1 -1
- package/blog/es/intlayer_with_react-intl.md +1 -1
- package/blog/fr/intlayer_with_next-i18next.md +3 -4
- package/blog/fr/intlayer_with_next-intl.md +3 -4
- package/blog/fr/intlayer_with_react-i18next.md +1 -1
- package/blog/fr/intlayer_with_react-intl.md +1 -1
- package/blog/hi/intlayer_with_next-i18next.md +3 -4
- package/blog/hi/intlayer_with_next-intl.md +3 -4
- package/blog/hi/intlayer_with_react-i18next.md +1 -1
- package/blog/hi/intlayer_with_react-intl.md +1 -1
- package/blog/it/intlayer_with_next-i18next.md +3 -4
- package/blog/it/intlayer_with_next-intl.md +3 -4
- package/blog/it/intlayer_with_react-i18next.md +1 -1
- package/blog/it/intlayer_with_react-intl.md +1 -1
- package/blog/ja/intlayer_with_next-i18next.md +3 -4
- package/blog/ja/intlayer_with_next-intl.md +3 -4
- package/blog/ja/intlayer_with_react-intl.md +1 -1
- package/blog/ko/intlayer_with_next-i18next.md +3 -4
- package/blog/ko/intlayer_with_next-intl.md +3 -4
- package/blog/ko/intlayer_with_react-intl.md +1 -1
- package/blog/pt/intlayer_with_next-i18next.md +3 -4
- package/blog/pt/intlayer_with_next-intl.md +3 -4
- package/blog/pt/intlayer_with_react-intl.md +1 -1
- package/blog/ru/intlayer_with_next-i18next.md +3 -4
- package/blog/ru/intlayer_with_next-intl.md +3 -4
- package/blog/ru/intlayer_with_react-i18next.md +1 -1
- package/blog/ru/intlayer_with_react-intl.md +1 -1
- package/blog/zh/intlayer_with_next-i18next.md +3 -4
- package/blog/zh/intlayer_with_next-intl.md +3 -4
- package/blog/zh/intlayer_with_react-i18next.md +1 -1
- package/blog/zh/intlayer_with_react-intl.md +1 -1
- package/dist/cjs/generated/docs.entry.cjs +41 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +41 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/formatters.md +239 -0
- package/docs/ar/interest_of_intlayer.md +162 -49
- package/docs/ar/introduction.md +3 -3
- package/docs/ar/packages/intlayer/index.md +3 -3
- package/docs/ar/packages/next-intlayer/index.md +3 -3
- package/docs/de/formatters.md +239 -0
- package/docs/de/interest_of_intlayer.md +161 -47
- package/docs/de/introduction.md +3 -3
- package/docs/de/packages/intlayer/index.md +3 -3
- package/docs/de/packages/next-intlayer/index.md +3 -3
- package/docs/de/packages/react-intlayer/index.md +3 -3
- package/docs/en/formatters.md +250 -0
- package/docs/en/interest_of_intlayer.md +159 -46
- package/docs/en/introduction.md +3 -3
- package/docs/en/packages/intlayer/index.md +3 -3
- package/docs/en/packages/next-intlayer/index.md +3 -3
- package/docs/en/packages/react-intlayer/index.md +3 -3
- package/docs/en-GB/formatters.md +239 -0
- package/docs/en-GB/interest_of_intlayer.md +160 -53
- package/docs/en-GB/packages/intlayer/index.md +3 -3
- package/docs/en-GB/packages/next-intlayer/index.md +3 -3
- package/docs/en-GB/packages/react-intlayer/index.md +3 -3
- package/docs/es/formatters.md +239 -0
- package/docs/es/interest_of_intlayer.md +159 -47
- package/docs/es/introduction.md +3 -3
- package/docs/es/packages/intlayer/index.md +3 -3
- package/docs/es/packages/next-intlayer/index.md +3 -3
- package/docs/fr/formatters.md +239 -0
- package/docs/fr/interest_of_intlayer.md +160 -46
- package/docs/fr/introduction.md +3 -3
- package/docs/fr/packages/intlayer/index.md +3 -3
- package/docs/fr/packages/next-intlayer/index.md +3 -3
- package/docs/fr/packages/react-intlayer/index.md +3 -3
- package/docs/hi/formatters.md +239 -0
- package/docs/hi/interest_of_intlayer.md +158 -42
- package/docs/hi/introduction.md +3 -3
- package/docs/hi/packages/intlayer/index.md +3 -3
- package/docs/hi/packages/next-intlayer/index.md +3 -3
- package/docs/hi/packages/react-intlayer/index.md +3 -3
- package/docs/it/formatters.md +239 -0
- package/docs/it/interest_of_intlayer.md +160 -46
- package/docs/it/introduction.md +3 -3
- package/docs/it/packages/intlayer/index.md +3 -3
- package/docs/it/packages/next-intlayer/index.md +3 -3
- package/docs/it/packages/react-intlayer/index.md +3 -3
- package/docs/ja/formatters.md +261 -0
- package/docs/ja/interest_of_intlayer.md +157 -48
- package/docs/ja/introduction.md +3 -3
- package/docs/ja/packages/intlayer/index.md +3 -3
- package/docs/ja/packages/next-intlayer/index.md +3 -3
- package/docs/ja/packages/react-intlayer/index.md +3 -3
- package/docs/ko/formatters.md +258 -0
- package/docs/ko/interest_of_intlayer.md +160 -48
- package/docs/ko/introduction.md +3 -3
- package/docs/ko/packages/intlayer/index.md +3 -3
- package/docs/ko/packages/next-intlayer/index.md +3 -3
- package/docs/ko/packages/react-intlayer/index.md +3 -3
- package/docs/pt/formatters.md +239 -0
- package/docs/pt/interest_of_intlayer.md +162 -47
- package/docs/pt/introduction.md +3 -3
- package/docs/pt/packages/intlayer/index.md +3 -3
- package/docs/pt/packages/next-intlayer/index.md +3 -3
- package/docs/pt/packages/react-intlayer/index.md +3 -3
- package/docs/ru/formatters.md +239 -0
- package/docs/ru/interest_of_intlayer.md +168 -50
- package/docs/ru/introduction.md +3 -3
- package/docs/ru/packages/intlayer/index.md +3 -3
- package/docs/ru/packages/next-intlayer/index.md +3 -3
- package/docs/ru/packages/react-intlayer/index.md +3 -3
- package/docs/zh/formatters.md +239 -0
- package/docs/zh/interest_of_intlayer.md +158 -48
- package/docs/zh/introduction.md +3 -3
- package/docs/zh/packages/intlayer/index.md +3 -3
- package/docs/zh/packages/next-intlayer/index.md +3 -3
- package/docs/zh/packages/react-intlayer/index.md +3 -3
- package/package.json +12 -12
- package/src/generated/docs.entry.ts +41 -0
|
@@ -149,8 +149,8 @@ const clientComponentContent = {
|
|
|
149
149
|
content: {
|
|
150
150
|
myTranslatedContent: t({
|
|
151
151
|
en: "Hello World",
|
|
152
|
-
fr: "Bonjour le monde",
|
|
153
152
|
es: "Hola Mundo",
|
|
153
|
+
fr: "Bonjour le monde",
|
|
154
154
|
}),
|
|
155
155
|
numberOfCar: enu({
|
|
156
156
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -175,8 +175,8 @@ const clientComponentContent = {
|
|
|
175
175
|
content: {
|
|
176
176
|
myTranslatedContent: t({
|
|
177
177
|
en: "Hello World",
|
|
178
|
-
fr: "Bonjour le monde",
|
|
179
178
|
es: "Hola Mundo",
|
|
179
|
+
fr: "Bonjour le monde",
|
|
180
180
|
}),
|
|
181
181
|
numberOfCar: enu({
|
|
182
182
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -201,8 +201,8 @@ const clientComponentContent = {
|
|
|
201
201
|
content: {
|
|
202
202
|
myTranslatedContent: t({
|
|
203
203
|
en: "Hello World",
|
|
204
|
-
fr: "Bonjour le monde",
|
|
205
204
|
es: "Hola Mundo",
|
|
205
|
+
fr: "Bonjour le monde",
|
|
206
206
|
}),
|
|
207
207
|
numberOfCar: enu({
|
|
208
208
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -110,8 +110,8 @@ const clientComponentContent = {
|
|
|
110
110
|
content: {
|
|
111
111
|
myTranslatedContent: t({
|
|
112
112
|
en: "Hello World",
|
|
113
|
-
fr: "Bonjour le monde",
|
|
114
113
|
es: "Hola Mundo",
|
|
114
|
+
fr: "Bonjour le monde",
|
|
115
115
|
}),
|
|
116
116
|
numberOfCar: enu({
|
|
117
117
|
"<-1": "Less than minus one car",
|
|
@@ -136,8 +136,8 @@ const clientComponentContent = {
|
|
|
136
136
|
content: {
|
|
137
137
|
myTranslatedContent: t({
|
|
138
138
|
en: "Hello World",
|
|
139
|
-
fr: "Bonjour le monde",
|
|
140
139
|
es: "Hola Mundo",
|
|
140
|
+
fr: "Bonjour le monde",
|
|
141
141
|
}),
|
|
142
142
|
numberOfCar: enu({
|
|
143
143
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -162,8 +162,8 @@ const clientComponentContent = {
|
|
|
162
162
|
content: {
|
|
163
163
|
myTranslatedContent: t({
|
|
164
164
|
en: "Hello World",
|
|
165
|
-
fr: "Bonjour le monde",
|
|
166
165
|
es: "Hola Mundo",
|
|
166
|
+
fr: "Bonjour le monde",
|
|
167
167
|
}),
|
|
168
168
|
numberOfCar: enu({
|
|
169
169
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -110,8 +110,8 @@ const component1Content = {
|
|
|
110
110
|
content: {
|
|
111
111
|
myTranslatedContent: t({
|
|
112
112
|
en: "Hello World",
|
|
113
|
-
fr: "Bonjour le monde",
|
|
114
113
|
es: "Hola Mundo",
|
|
114
|
+
fr: "Bonjour le monde",
|
|
115
115
|
}),
|
|
116
116
|
numberOfCar: enu({
|
|
117
117
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -136,8 +136,8 @@ const component1Content = {
|
|
|
136
136
|
content: {
|
|
137
137
|
myTranslatedContent: t({
|
|
138
138
|
en: "Hello World",
|
|
139
|
-
fr: "Bonjour le monde",
|
|
140
139
|
es: "Hola Mundo",
|
|
140
|
+
fr: "Bonjour le monde",
|
|
141
141
|
}),
|
|
142
142
|
numberOfCar: enu({
|
|
143
143
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -162,8 +162,8 @@ const component1Content = {
|
|
|
162
162
|
content: {
|
|
163
163
|
myTranslatedContent: t({
|
|
164
164
|
en: "Hello World",
|
|
165
|
-
fr: "Bonjour le monde",
|
|
166
165
|
es: "Hola Mundo",
|
|
166
|
+
fr: "Bonjour le monde",
|
|
167
167
|
}),
|
|
168
168
|
numberOfCar: enu({
|
|
169
169
|
"<-1": "Weniger als minus ein Auto",
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-08-13
|
|
3
|
+
updatedAt: 2025-08-20
|
|
4
|
+
title: Formatters
|
|
5
|
+
description: Locale-aware formatting utilities based on Intl for numbers, percentages, currency, dates, relative time, units, and compact notation. Includes a cached Intl helper.
|
|
6
|
+
keywords:
|
|
7
|
+
- Formatters
|
|
8
|
+
- Intl
|
|
9
|
+
- Number
|
|
10
|
+
- Currency
|
|
11
|
+
- Percentage
|
|
12
|
+
- Date
|
|
13
|
+
- Relative Time
|
|
14
|
+
- Units
|
|
15
|
+
- Compact
|
|
16
|
+
- Internationalization
|
|
17
|
+
slugs:
|
|
18
|
+
- doc
|
|
19
|
+
- formatters
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Intlayer Formatters
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
Intlayer provides a set of lightweight helpers built on top of the native `Intl` APIs, plus a cached `Intl` wrapper to avoid repeatedly constructing heavy formatters. These utilities are fully locale-aware and can be used from the main `intlayer` package.
|
|
27
|
+
|
|
28
|
+
### Import
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
Intl,
|
|
33
|
+
number,
|
|
34
|
+
percentage,
|
|
35
|
+
currency,
|
|
36
|
+
date,
|
|
37
|
+
relativeTime,
|
|
38
|
+
units,
|
|
39
|
+
compact,
|
|
40
|
+
} from "intlayer";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If you are using React, hooks are also available; see `react-intlayer/format`.
|
|
44
|
+
|
|
45
|
+
## Cached Intl
|
|
46
|
+
|
|
47
|
+
The exported `Intl` is a thin, cached wrapper around the global `Intl`. It memoizes instances of `NumberFormat`, `DateTimeFormat`, `RelativeTimeFormat`, which avoids rebuilding the same formatter repeatedly.
|
|
48
|
+
|
|
49
|
+
Because formatter construction is relatively expensive, this caching improves performance without changing behavior. The wrapper exposes the same API as the native `Intl`, so usage is identical.
|
|
50
|
+
|
|
51
|
+
- Caching is per process and transparent to callers.
|
|
52
|
+
|
|
53
|
+
> If `Intl.DisplayNames` is not available in the environment, a single dev-only warning is printed (consider a polyfill).
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { Intl } from "intlayer";
|
|
59
|
+
|
|
60
|
+
const numberFormat = new Intl.NumberFormat("en-GB", {
|
|
61
|
+
style: "currency",
|
|
62
|
+
currency: "GBP",
|
|
63
|
+
});
|
|
64
|
+
numberFormat.format(1234.5); // "£1,234.50"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Formatters
|
|
68
|
+
|
|
69
|
+
All helpers below are exported from `intlayer`.
|
|
70
|
+
|
|
71
|
+
### `number(value, options?)`
|
|
72
|
+
|
|
73
|
+
Formats a numeric value using locale-aware grouping and decimals.
|
|
74
|
+
|
|
75
|
+
- **value**: `number | string`
|
|
76
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { number } from "intlayer";
|
|
82
|
+
|
|
83
|
+
number(123456.789); // "123,456.789" (in en-US)
|
|
84
|
+
number("1000000", { locale: "fr" }); // "1 000 000"
|
|
85
|
+
number(1234.5, { minimumFractionDigits: 2 }); // "1,234.50"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `percentage(value, options?)`
|
|
89
|
+
|
|
90
|
+
Formats a number as a percentage string.
|
|
91
|
+
|
|
92
|
+
Behavior: values greater than 1 are interpreted as whole percentages and normalized (e.g., `25` → `25%`, `0.25` → `25%`).
|
|
93
|
+
|
|
94
|
+
- **value**: `number | string`
|
|
95
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
96
|
+
|
|
97
|
+
Examples:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { percentage } from "intlayer";
|
|
101
|
+
|
|
102
|
+
percentage(0.25); // "25%"
|
|
103
|
+
percentage(25); // "25%"
|
|
104
|
+
percentage(0.237, { minimumFractionDigits: 1 }); // "23.7%"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `currency(value, options?)`
|
|
108
|
+
|
|
109
|
+
Formats a value as localized currency. Defaults to `USD` with two fraction digits.
|
|
110
|
+
|
|
111
|
+
- **value**: `number | string`
|
|
112
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
113
|
+
- Common fields: `currency` (e.g., `"EUR"`), `currencyDisplay` (`"symbol" | "code" | "name"`)
|
|
114
|
+
|
|
115
|
+
Examples:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { currency } from "intlayer";
|
|
119
|
+
|
|
120
|
+
currency(1234.5, { currency: "EUR" }); // "€1,234.50"
|
|
121
|
+
currency("5000", { locale: "fr", currency: "CAD", currencyDisplay: "code" }); // "5 000,00 CAD"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `date(date, optionsOrPreset?)`
|
|
125
|
+
|
|
126
|
+
Formats a date/time value with `Intl.DateTimeFormat`.
|
|
127
|
+
|
|
128
|
+
- **date**: `Date | string | number`
|
|
129
|
+
- **optionsOrPreset**: `Intl.DateTimeFormatOptions & { locale?: LocalesValues }` or one of the presets:
|
|
130
|
+
- Presets: `"short" | "long" | "dateOnly" | "timeOnly" | "full"`
|
|
131
|
+
|
|
132
|
+
Examples:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { date } from "intlayer";
|
|
136
|
+
|
|
137
|
+
date(new Date(), "short"); // e.g., "08/02/25, 14:30"
|
|
138
|
+
date("2025-08-02T14:30:00Z", { locale: "fr", month: "long", day: "numeric" }); // "2 août"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### `relativeTime(from, to = new Date(), options?)`
|
|
142
|
+
|
|
143
|
+
Formats relative time between two instants with `Intl.RelativeTimeFormat`.
|
|
144
|
+
|
|
145
|
+
- Pass "now" as the first argument and the target as the second to get natural phrasing.
|
|
146
|
+
- **from**: `Date | string | number`
|
|
147
|
+
- **to**: `Date | string | number` (defaults to `new Date()`)
|
|
148
|
+
- **options**: `{ locale?: LocalesValues; unit?: Intl.RelativeTimeFormatUnit; numeric?: Intl.RelativeTimeFormatNumeric; style?: Intl.RelativeTimeFormatStyle }`
|
|
149
|
+
- Default `unit` is `"second"`.
|
|
150
|
+
|
|
151
|
+
Examples:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { relativeTime } from "intlayer";
|
|
155
|
+
|
|
156
|
+
const now = new Date();
|
|
157
|
+
const in3Days = new Date(now.getTime() + 3 * 864e5);
|
|
158
|
+
relativeTime(now, in3Days, { unit: "day" }); // "in 3 days"
|
|
159
|
+
|
|
160
|
+
const twoHoursAgo = new Date(now.getTime() - 2 * 3600e3);
|
|
161
|
+
relativeTime(now, twoHoursAgo, { unit: "hour", numeric: "auto" }); // "2 hours ago"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### `units(value, options?)`
|
|
165
|
+
|
|
166
|
+
Formats a numeric value as a localized unit string using `Intl.NumberFormat` with `style: 'unit'`.
|
|
167
|
+
|
|
168
|
+
- **value**: `number | string`
|
|
169
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
170
|
+
- Common fields: `unit` (e.g., `"kilometer"`, `"byte"`), `unitDisplay` (`"short" | "narrow" | "long"`)
|
|
171
|
+
- Defaults: `unit: 'day'`, `unitDisplay: 'short'`, `useGrouping: false`
|
|
172
|
+
|
|
173
|
+
Examples:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import { units } from "intlayer";
|
|
177
|
+
|
|
178
|
+
units(5, { unit: "kilometer", unitDisplay: "long", locale: "en-GB" }); // "5 kilometers"
|
|
179
|
+
units(1024, { unit: "byte", unitDisplay: "narrow" }); // "1,024B" (locale-dependent)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### `compact(value, options?)`
|
|
183
|
+
|
|
184
|
+
Formats a number using compact notation (e.g., `1.2K`, `1M`).
|
|
185
|
+
|
|
186
|
+
- **value**: `number | string`
|
|
187
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }` (uses `notation: 'compact'` under the hood)
|
|
188
|
+
|
|
189
|
+
Examples:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
import { compact } from "intlayer";
|
|
193
|
+
|
|
194
|
+
compact(1200); // "1.2K"
|
|
195
|
+
compact("1000000", { locale: "fr", compactDisplay: "long" }); // "1 million"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Notes
|
|
199
|
+
|
|
200
|
+
- All helpers accept `string` inputs; they are internally coerced to numbers or dates.
|
|
201
|
+
- Locale defaults to your configured `internationalization.defaultLocale` if not provided.
|
|
202
|
+
- These utilities are thin wrappers; for advanced formatting, pass through the standard `Intl` options.
|
|
203
|
+
|
|
204
|
+
## Entry points and re-exports (`@index.ts`)
|
|
205
|
+
|
|
206
|
+
The formatters live in the core package and are re-exported from higher-level packages to keep imports ergonomic across runtimes:
|
|
207
|
+
|
|
208
|
+
Examples:
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
// App code (recommended)
|
|
212
|
+
import { number, currency, date, Intl } from "intlayer";
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### React
|
|
216
|
+
|
|
217
|
+
Client components:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
import { useNumber, useCurrency, useDate } from "react-intlayer/format";
|
|
221
|
+
// or in Next.js apps
|
|
222
|
+
import { useNumber, useCurrency, useDate } from "next-intlayer/client/format";
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Server components (or React Server runtime):
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { useNumber, useCurrency, useDate } from "react-intlayer/server/format";
|
|
229
|
+
// or in Next.js apps
|
|
230
|
+
import { useNumber, useCurrency, useDate } from "next-intlayer/server/format";
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
> That hooks will consider the locale from the `IntlayerProvider` or `IntlayerServerProvider`
|
|
234
|
+
|
|
235
|
+
### Vue
|
|
236
|
+
|
|
237
|
+
Client components:
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
import { useNumber, useCurrency, useDate } from "vue-intlayer/format";
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
> That composables will consider the locale from the injected `IntlayerProvider`
|
|
244
|
+
|
|
245
|
+
## Doc History
|
|
246
|
+
|
|
247
|
+
| Version | Date | Changes |
|
|
248
|
+
| ------- | ---------- | ---------------------------- |
|
|
249
|
+
| 5.8.0 | 2025-08-20 | Add vue formatters |
|
|
250
|
+
| 5.8.0 | 2025-08-18 | Add formatters documentation |
|