@intlayer/docs 5.7.7 → 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.
Files changed (142) hide show
  1. package/blog/ar/intlayer_with_next-i18next.md +3 -4
  2. package/blog/ar/intlayer_with_next-intl.md +3 -4
  3. package/blog/ar/intlayer_with_react-i18next.md +1 -1
  4. package/blog/ar/intlayer_with_react-intl.md +1 -1
  5. package/blog/de/intlayer_with_next-i18next.md +3 -4
  6. package/blog/de/intlayer_with_react-intl.md +1 -1
  7. package/blog/en/intlayer_with_next-i18next.md +3 -4
  8. package/blog/en/intlayer_with_next-intl.md +3 -4
  9. package/blog/en/intlayer_with_react-i18next.md +1 -1
  10. package/blog/en/intlayer_with_react-intl.md +1 -1
  11. package/blog/en-GB/intlayer_with_next-i18next.md +3 -4
  12. package/blog/en-GB/intlayer_with_next-intl.md +3 -4
  13. package/blog/en-GB/intlayer_with_react-i18next.md +1 -1
  14. package/blog/en-GB/intlayer_with_react-intl.md +1 -1
  15. package/blog/es/intlayer_with_next-i18next.md +3 -4
  16. package/blog/es/intlayer_with_next-intl.md +3 -4
  17. package/blog/es/intlayer_with_react-i18next.md +1 -1
  18. package/blog/es/intlayer_with_react-intl.md +1 -1
  19. package/blog/fr/intlayer_with_next-i18next.md +3 -4
  20. package/blog/fr/intlayer_with_next-intl.md +3 -4
  21. package/blog/fr/intlayer_with_react-i18next.md +1 -1
  22. package/blog/fr/intlayer_with_react-intl.md +1 -1
  23. package/blog/hi/intlayer_with_next-i18next.md +3 -4
  24. package/blog/hi/intlayer_with_next-intl.md +3 -4
  25. package/blog/hi/intlayer_with_react-i18next.md +1 -1
  26. package/blog/hi/intlayer_with_react-intl.md +1 -1
  27. package/blog/it/intlayer_with_next-i18next.md +3 -4
  28. package/blog/it/intlayer_with_next-intl.md +3 -4
  29. package/blog/it/intlayer_with_react-i18next.md +1 -1
  30. package/blog/it/intlayer_with_react-intl.md +1 -1
  31. package/blog/ja/intlayer_with_next-i18next.md +3 -4
  32. package/blog/ja/intlayer_with_next-intl.md +3 -4
  33. package/blog/ja/intlayer_with_react-intl.md +1 -1
  34. package/blog/ko/intlayer_with_next-i18next.md +3 -4
  35. package/blog/ko/intlayer_with_next-intl.md +3 -4
  36. package/blog/ko/intlayer_with_react-intl.md +1 -1
  37. package/blog/pt/intlayer_with_next-i18next.md +3 -4
  38. package/blog/pt/intlayer_with_next-intl.md +3 -4
  39. package/blog/pt/intlayer_with_react-intl.md +1 -1
  40. package/blog/ru/intlayer_with_next-i18next.md +3 -4
  41. package/blog/ru/intlayer_with_next-intl.md +3 -4
  42. package/blog/ru/intlayer_with_react-i18next.md +1 -1
  43. package/blog/ru/intlayer_with_react-intl.md +1 -1
  44. package/blog/zh/intlayer_with_next-i18next.md +3 -4
  45. package/blog/zh/intlayer_with_next-intl.md +3 -4
  46. package/blog/zh/intlayer_with_react-i18next.md +1 -1
  47. package/blog/zh/intlayer_with_react-intl.md +1 -1
  48. package/dist/cjs/generated/docs.entry.cjs +41 -0
  49. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  50. package/dist/esm/generated/docs.entry.mjs +41 -0
  51. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  52. package/dist/types/generated/docs.entry.d.ts +1 -0
  53. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  54. package/docs/ar/CI_CD.md +67 -41
  55. package/docs/ar/formatters.md +239 -0
  56. package/docs/ar/interest_of_intlayer.md +162 -49
  57. package/docs/ar/introduction.md +3 -3
  58. package/docs/ar/packages/intlayer/index.md +3 -3
  59. package/docs/ar/packages/next-intlayer/index.md +3 -3
  60. package/docs/de/CI_CD.md +63 -37
  61. package/docs/de/formatters.md +239 -0
  62. package/docs/de/interest_of_intlayer.md +161 -47
  63. package/docs/de/introduction.md +3 -3
  64. package/docs/de/packages/intlayer/index.md +3 -3
  65. package/docs/de/packages/next-intlayer/index.md +3 -3
  66. package/docs/de/packages/react-intlayer/index.md +3 -3
  67. package/docs/en/CI_CD.md +51 -27
  68. package/docs/en/formatters.md +250 -0
  69. package/docs/en/interest_of_intlayer.md +159 -46
  70. package/docs/en/introduction.md +3 -3
  71. package/docs/en/packages/intlayer/index.md +3 -3
  72. package/docs/en/packages/next-intlayer/index.md +3 -3
  73. package/docs/en/packages/react-intlayer/index.md +3 -3
  74. package/docs/en-GB/CI_CD.md +58 -32
  75. package/docs/en-GB/formatters.md +239 -0
  76. package/docs/en-GB/interest_of_intlayer.md +160 -53
  77. package/docs/en-GB/packages/intlayer/index.md +3 -3
  78. package/docs/en-GB/packages/next-intlayer/index.md +3 -3
  79. package/docs/en-GB/packages/react-intlayer/index.md +3 -3
  80. package/docs/es/CI_CD.md +68 -42
  81. package/docs/es/formatters.md +239 -0
  82. package/docs/es/interest_of_intlayer.md +159 -47
  83. package/docs/es/introduction.md +3 -3
  84. package/docs/es/packages/intlayer/index.md +3 -3
  85. package/docs/es/packages/next-intlayer/index.md +3 -3
  86. package/docs/fr/formatters.md +239 -0
  87. package/docs/fr/interest_of_intlayer.md +160 -46
  88. package/docs/fr/introduction.md +3 -3
  89. package/docs/fr/packages/intlayer/index.md +3 -3
  90. package/docs/fr/packages/next-intlayer/index.md +3 -3
  91. package/docs/fr/packages/react-intlayer/index.md +3 -3
  92. package/docs/hi/CI_CD.md +69 -44
  93. package/docs/hi/formatters.md +239 -0
  94. package/docs/hi/interest_of_intlayer.md +158 -42
  95. package/docs/hi/introduction.md +3 -3
  96. package/docs/hi/packages/intlayer/index.md +3 -3
  97. package/docs/hi/packages/next-intlayer/index.md +3 -3
  98. package/docs/hi/packages/react-intlayer/index.md +3 -3
  99. package/docs/it/CI_CD.md +67 -41
  100. package/docs/it/formatters.md +239 -0
  101. package/docs/it/interest_of_intlayer.md +160 -46
  102. package/docs/it/introduction.md +3 -3
  103. package/docs/it/packages/intlayer/index.md +3 -3
  104. package/docs/it/packages/next-intlayer/index.md +3 -3
  105. package/docs/it/packages/react-intlayer/index.md +3 -3
  106. package/docs/ja/CI_CD.md +67 -41
  107. package/docs/ja/formatters.md +261 -0
  108. package/docs/ja/interest_of_intlayer.md +157 -48
  109. package/docs/ja/introduction.md +3 -3
  110. package/docs/ja/packages/intlayer/index.md +3 -3
  111. package/docs/ja/packages/next-intlayer/index.md +3 -3
  112. package/docs/ja/packages/react-intlayer/index.md +3 -3
  113. package/docs/ko/CI_CD.md +63 -37
  114. package/docs/ko/formatters.md +258 -0
  115. package/docs/ko/interest_of_intlayer.md +160 -48
  116. package/docs/ko/introduction.md +3 -3
  117. package/docs/ko/packages/intlayer/index.md +3 -3
  118. package/docs/ko/packages/next-intlayer/index.md +3 -3
  119. package/docs/ko/packages/react-intlayer/index.md +3 -3
  120. package/docs/pt/CI_CD.md +67 -41
  121. package/docs/pt/formatters.md +239 -0
  122. package/docs/pt/interest_of_intlayer.md +162 -47
  123. package/docs/pt/introduction.md +3 -3
  124. package/docs/pt/packages/intlayer/index.md +3 -3
  125. package/docs/pt/packages/next-intlayer/index.md +3 -3
  126. package/docs/pt/packages/react-intlayer/index.md +3 -3
  127. package/docs/ru/CI_CD.md +70 -44
  128. package/docs/ru/formatters.md +239 -0
  129. package/docs/ru/interest_of_intlayer.md +168 -50
  130. package/docs/ru/introduction.md +3 -3
  131. package/docs/ru/packages/intlayer/index.md +3 -3
  132. package/docs/ru/packages/next-intlayer/index.md +3 -3
  133. package/docs/ru/packages/react-intlayer/index.md +3 -3
  134. package/docs/zh/CI_CD.md +62 -36
  135. package/docs/zh/formatters.md +239 -0
  136. package/docs/zh/interest_of_intlayer.md +158 -48
  137. package/docs/zh/introduction.md +3 -3
  138. package/docs/zh/packages/intlayer/index.md +3 -3
  139. package/docs/zh/packages/next-intlayer/index.md +3 -3
  140. package/docs/zh/packages/react-intlayer/index.md +3 -3
  141. package/package.json +12 -12
  142. package/src/generated/docs.entry.ts +41 -0
package/docs/pt/CI_CD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-05-20
3
- updatedAt: 2025-06-29
3
+ updatedAt: 2025-08-13
4
4
  title: Integração CI/CD
5
5
  description: Aprenda como integrar o Intlayer em seu pipeline CI/CD para gerenciamento e implantação automatizados de conteúdo.
6
6
  keywords:
@@ -19,13 +19,13 @@ slugs:
19
19
 
20
20
  # Geração Automática de Traduções em um Pipeline CI/CD
21
21
 
22
- O Intlayer permite a geração automática de traduções para seus arquivos de declaração de conteúdo. Existem várias maneiras de alcançar isso dependendo do seu fluxo de trabalho.
22
+ O Intlayer permite a geração automática de traduções para seus arquivos de declaração de conteúdo. Existem várias maneiras de realizar isso dependendo do seu fluxo de trabalho.
23
23
 
24
24
  ## Usando o CMS
25
25
 
26
- Com o Intlayer, você pode adotar um fluxo de trabalho onde apenas um único idioma é declarado localmente, enquanto todas as traduções são gerenciadas remotamente através do CMS. Isso permite que o conteúdo e as traduções fiquem completamente desacoplados da base de código, oferecendo mais flexibilidade para os editores de conteúdo e possibilitando recarregamento dinâmico do conteúdo (sem necessidade de reconstruir a aplicação para aplicar as mudanças).
26
+ Com o Intlayer, você pode adotar um fluxo de trabalho onde apenas um único idioma é declarado localmente, enquanto todas as traduções são gerenciadas remotamente através do CMS. Isso permite que o conteúdo e as traduções fiquem completamente desacoplados da base de código, oferecendo mais flexibilidade para os editores de conteúdo e possibilitando o recarregamento dinâmico do conteúdo (sem necessidade de reconstruir a aplicação para aplicar as alterações).
27
27
 
28
- ### Exemplo de Configuração
28
+ ### Configuração de Exemplo
29
29
 
30
30
  ```ts fileName="intlayer.config.ts"
31
31
  import { Locales, type IntlayerConfig } from "intlayer";
@@ -37,7 +37,7 @@ const config: IntlayerConfig = {
37
37
  defaultLocale: Locales.ENGLISH,
38
38
  },
39
39
  editor: {
40
- dictionaryPriorityStrategy: "distant_first", // O conteúdo remoto tem prioridade
40
+ dictionaryPriorityStrategy: "distant_first", // Conteúdo remoto tem prioridade
41
41
 
42
42
  applicationURL: process.env.APPLICATION_URL, // URL da aplicação usada pelo CMS
43
43
 
@@ -45,7 +45,7 @@ const config: IntlayerConfig = {
45
45
  clientSecret: process.env.INTLAYER_CLIENT_SECRET,
46
46
  },
47
47
  ai: {
48
- applicationContext: "Esta é uma aplicação de teste", // Ajuda a garantir a geração consistente de traduções
48
+ applicationContext: "This is a test application", // Ajuda a garantir a geração consistente de traduções
49
49
  },
50
50
  };
51
51
 
@@ -56,9 +56,9 @@ Para saber mais sobre o CMS, consulte a [documentação oficial](https://github.
56
56
 
57
57
  ## Usando Husky
58
58
 
59
- Você pode integrar a geração de traduções ao seu fluxo de trabalho Git local usando o [Husky](https://typicode.github.io/husky/).
59
+ Você pode integrar a geração de traduções no seu fluxo de trabalho local do Git usando o [Husky](https://typicode.github.io/husky/).
60
60
 
61
- ### Exemplo de Configuração
61
+ ### Configuração de Exemplo
62
62
 
63
63
  ```ts fileName="intlayer.config.ts"
64
64
  import { Locales, type IntlayerConfig } from "intlayer";
@@ -77,7 +77,7 @@ const config: IntlayerConfig = {
77
77
  provider: "openai",
78
78
  apiKey: process.env.OPENAI_API_KEY, // Use sua própria chave API
79
79
 
80
- applicationContext: "Esta é uma aplicação de teste", // Ajuda a garantir a geração consistente de traduções
80
+ applicationContext: "This is a test application", // Ajuda a garantir a geração consistente de traduções
81
81
  },
82
82
  };
83
83
 
@@ -86,7 +86,7 @@ export default config;
86
86
 
87
87
  ```bash fileName=".husky/pre-push"
88
88
  npx intlayer build # Para garantir que os dicionários estejam atualizados
89
- npx intlayer fill --unpushed --mode fill # Preenche apenas o conteúdo faltante, não atualiza os existentes
89
+ npx intlayer fill --unpushed --mode fill # Apenas preenche o conteúdo faltante, não atualiza os existentes
90
90
  ```
91
91
 
92
92
  > Para mais informações sobre os comandos CLI do Intlayer e seu uso, consulte a [documentação CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_cli.md).
@@ -105,68 +105,94 @@ npx intlayer fill --base-dir ./app2 --unpushed --mode fill
105
105
 
106
106
  ## Usando GitHub Actions
107
107
 
108
- Intlayer fornece um comando CLI para preenchimento automático e revisão do conteúdo do dicionário. Isso pode ser integrado ao seu fluxo de trabalho CI/CD usando GitHub Actions.
108
+ O Intlayer fornece um comando CLI para preenchimento automático e revisão do conteúdo do dicionário. Isso pode ser integrado ao seu fluxo de trabalho CI/CD usando GitHub Actions.
109
109
 
110
110
  ```yaml fileName=".github/workflows/intlayer-translate.yml"
111
- name: Intlayer Auto-Fill
111
+ name: Preenchimento Automático Intlayer
112
+ # Condições de gatilho para este fluxo de trabalho
112
113
  on:
113
- push:
114
- branches: [ main ]
115
- paths:
116
- - 'src/**'
117
114
  pull_request:
118
- branches: [ main ]
119
- paths:
120
- - 'src/**'
121
- workflow_dispatch: {}
115
+ branches:
116
+ - "main"
117
+
118
+ permissions:
119
+ contents: write
120
+ pull-requests: write
122
121
 
123
122
  concurrency:
124
- group: 'autofill-${{ github.ref }}'
123
+ group: "autofill-${{ github.ref }}"
125
124
  cancel-in-progress: true
126
125
 
127
126
  jobs:
128
127
  autofill:
129
128
  runs-on: ubuntu-latest
130
129
  env:
131
- INTLAYER_CLIENT_ID: ${{ secrets.INTLAYER_CLIENT_ID }}
132
- INTLAYER_CLIENT_SECRET: ${{ secrets.INTLAYER_CLIENT_SECRET }}
133
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
130
+ # OpenAI
131
+ AI_MODEL: openai
132
+ AI_PROVIDER: gpt-5-mini
133
+ AI_API_KEY: ${{ secrets.AI_API_KEY }}
134
134
 
135
135
  steps:
136
- - name: ⬇️ Fazer checkout do repositório
137
- uses: actions/checkout@v3
136
+ # Passo 1: Obter o código mais recente do repositório
137
+ - name: ⬇️ Checkout do repositório
138
+ uses: actions/checkout@v4
138
139
  with:
139
- persist-credentials: true
140
+ persist-credentials: true # Manter credenciais para criação de PRs
141
+ fetch-depth: 0 # Obter histórico completo do git para análise de diferenças
140
142
 
143
+ # Passo 2: Configurar ambiente Node.js
141
144
  - name: 🟢 Configurar Node.js
142
- uses: actions/setup-node@v3
145
+ uses: actions/setup-node@v4
143
146
  with:
144
- node-version: 20
147
+ node-version: 20 # Usar Node.js 20 LTS para estabilidade
145
148
 
149
+ # Passo 3: Instalar dependências do projeto
146
150
  - name: 📦 Instalar dependências
147
- run: npm ci
151
+ run: npm install
152
+
153
+ # Passo 4: Instalar Intlayer CLI globalmente para gerenciamento de traduções
154
+ - name: 📦 Instalar Intlayer
155
+ run: npm install -g intlayer-cli
148
156
 
157
+ # Passo 5: Construir o projeto Intlayer para gerar arquivos de tradução
149
158
  - name: ⚙️ Construir projeto Intlayer
150
159
  run: npx intlayer build
151
160
 
161
+ # Passo 6: Usar IA para preencher automaticamente traduções faltantes
152
162
  - name: 🤖 Preencher automaticamente traduções faltantes
153
- run: npx intlayer fill --git-diff --mode fill
154
-
155
- - name: 📤 Criar ou atualizar PR de tradução
156
- uses: peter-evans/create-pull-request@v4
157
- with:
158
- commit-message: chore: auto-fill missing translations [skip ci]
159
- branch: auto-translations
160
- title: chore: update missing translations
161
- labels: translation, automated
163
+ run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
164
+
165
+ # Passo 7: Verificar se alterações e comitá-las
166
+ - name: � Verificar alterações
167
+ id: check-changes
168
+ run: |
169
+ if [ -n "$(git status --porcelain)" ]; then
170
+ echo "has-changes=true" >> $GITHUB_OUTPUT
171
+ else
172
+ echo "has-changes=false" >> $GITHUB_OUTPUT
173
+ fi
174
+
175
+ # Passo 8: Comitar e enviar alterações se existirem
176
+ - name: 📤 Comitar e enviar alterações
177
+ if: steps.check-changes.outputs.has-changes == 'true'
178
+ run: |
179
+ git config --local user.email "action@github.com"
180
+ git config --local user.name "GitHub Action"
181
+ git add .
182
+ git commit -m "chore: auto-fill missing translations [skip ci]"
183
+ git push origin HEAD:${{ github.head_ref }}
162
184
  ```
163
185
 
186
+ Para configurar as variáveis de ambiente, vá para GitHub → Configurações → Segredos e variáveis → Ações e adicione o segredo .
187
+
164
188
  > Assim como para o Husky, no caso de um monorepo, você pode usar o argumento `--base-dir` para tratar sequencialmente cada app.
165
189
 
166
190
  > Por padrão, o argumento `--git-diff` filtra os dicionários que incluem alterações da base (padrão `origin/main`) para o branch atual (padrão: `HEAD`).
167
191
 
168
192
  > Para mais informações sobre os comandos do Intlayer CLI e seu uso, consulte a [documentação do CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_cli.md).
169
193
 
170
- ## Histórico da Documentação
194
+ ## Histórico do Documento
171
195
 
172
- - 5.5.10 - 2025-06-29: Histórico inicial
196
+ | Versão | Data | Alterações |
197
+ | ------ | ---------- | ----------------- |
198
+ | 5.5.10 | 2025-06-29 | Histórico inicial |
@@ -0,0 +1,239 @@
1
+ ---
2
+ createdAt: 2024-08-13
3
+ updatedAt: 2025-08-20
4
+ title: Formatadores
5
+ description: Utilitários de formatação sensíveis à localidade baseados no Intl para números, percentuais, moeda, datas, tempo relativo, unidades e notação compacta. Inclui um helper Intl com cache.
6
+ keywords:
7
+ - Formatadores
8
+ - Intl
9
+ - Número
10
+ - Moeda
11
+ - Percentual
12
+ - Data
13
+ - Tempo Relativo
14
+ - Unidades
15
+ - Compacto
16
+ - Internacionalização
17
+ slugs:
18
+ - doc
19
+ - formatters
20
+ ---
21
+
22
+ # Formatadores Intlayer
23
+
24
+ ## Visão Geral
25
+
26
+ O Intlayer fornece um conjunto de helpers leves construídos sobre as APIs nativas `Intl`, além de um wrapper `Intl` com cache para evitar a construção repetida de formatadores pesados. Esses utilitários são totalmente sensíveis à localidade e podem ser usados a partir do pacote principal `intlayer`.
27
+
28
+ ### Importação
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
+ Se você estiver usando React, hooks também estão disponíveis; veja `react-intlayer/format`.
44
+
45
+ ## Intl com Cache
46
+
47
+ O `Intl` exportado é um wrapper leve com cache em torno do `Intl` global. Ele memoiza instâncias de `NumberFormat`, `DateTimeFormat`, `RelativeTimeFormat`, o que evita reconstruir o mesmo formatador repetidamente.
48
+
49
+ Como a construção do formatador é relativamente custosa, esse cache melhora a performance sem alterar o comportamento. O wrapper expõe a mesma API do `Intl` nativo, então o uso é idêntico.
50
+
51
+ - O cache é por processo e transparente para os chamadores.
52
+
53
+ > Se `Intl.DisplayNames` não estiver disponível no ambiente, um único aviso para desenvolvedores é exibido (considere usar um polyfill).
54
+
55
+ Exemplo:
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
+ ## Formatadores
68
+
69
+ Todos os helpers abaixo são exportados do `intlayer`.
70
+
71
+ ### `number(value, options?)`
72
+
73
+ Formata um valor numérico usando agrupamento e decimais sensíveis ao local.
74
+
75
+ - **value**: `number | string`
76
+ - **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
77
+
78
+ Exemplos:
79
+
80
+ ```ts
81
+ import { number } from "intlayer";
82
+
83
+ number(123456.789); // "123,456.789" (em 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
+ Formata um número como uma string percentual.
91
+
92
+ Comportamento: valores maiores que 1 são interpretados como percentagens inteiras e normalizados (por exemplo, `25` → `25%`, `0.25` → `25%`).
93
+
94
+ - **value**: `number | string`
95
+ - **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
96
+
97
+ Exemplos:
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
+ Formata um valor como moeda localizada. O padrão é `USD` com duas casas decimais.
110
+
111
+ - **value**: `number | string`
112
+ - **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
113
+ - Campos comuns: `currency` (por exemplo, `"EUR"`), `currencyDisplay` (`"symbol" | "code" | "name"`)
114
+
115
+ Exemplos:
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
+ Formata um valor de data/hora com `Intl.DateTimeFormat`.
127
+
128
+ - **date**: `Date | string | number`
129
+ - **optionsOrPreset**: `Intl.DateTimeFormatOptions & { locale?: LocalesValues }` ou um dos predefinidos:
130
+ - Predefinidos: `"short" | "long" | "dateOnly" | "timeOnly" | "full"`
131
+
132
+ Exemplos:
133
+
134
+ ```ts
135
+ import { date } from "intlayer";
136
+
137
+ date(new Date(), "short"); // ex., "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
+ Formata o tempo relativo entre dois instantes com `Intl.RelativeTimeFormat`.
144
+
145
+ - Passe "now" como o primeiro argumento e o alvo como o segundo para obter uma frase natural.
146
+ - **from**: `Date | string | number`
147
+ - **to**: `Date | string | number` (padrão é `new Date()`)
148
+ - **options**: `{ locale?: LocalesValues; unit?: Intl.RelativeTimeFormatUnit; numeric?: Intl.RelativeTimeFormatNumeric; style?: Intl.RelativeTimeFormatStyle }`
149
+ - O `unit` padrão é `"second"`.
150
+
151
+ Exemplos:
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" }); // "em 3 dias"
159
+
160
+ const twoHoursAgo = new Date(now.getTime() - 2 * 3600e3);
161
+ relativeTime(now, twoHoursAgo, { unit: "hour", numeric: "auto" }); // "há 2 horas"
162
+ ```
163
+
164
+ ### `units(value, options?)`
165
+
166
+ Formata um valor numérico como uma string de unidade localizada usando `Intl.NumberFormat` com `style: 'unit'`.
167
+
168
+ - **value**: `number | string`
169
+ - **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
170
+ - Campos comuns: `unit` (ex.: `"kilometer"`, `"byte"`), `unitDisplay` (`"short" | "narrow" | "long"`)
171
+ - Padrões: `unit: 'day'`, `unitDisplay: 'short'`, `useGrouping: false`
172
+
173
+ Exemplos:
174
+
175
+ ```ts
176
+ import { units } from "intlayer";
177
+
178
+ units(5, { unit: "kilometer", unitDisplay: "long", locale: "en-GB" }); // "5 quilômetros"
179
+ units(1024, { unit: "byte", unitDisplay: "narrow" }); // "1.024B" (dependente do locale)
180
+ ```
181
+
182
+ ### `compact(value, options?)`
183
+
184
+ Formata um número usando notação compacta (ex.: `1.2K`, `1M`).
185
+
186
+ - **value**: `number | string`
187
+ - **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }` (usa `notation: 'compact'` internamente)
188
+
189
+ Exemplos:
190
+
191
+ ```ts
192
+ import { compact } from "intlayer";
193
+
194
+ compact(1200); // "1.2K"
195
+ compact("1000000", { locale: "fr", compactDisplay: "long" }); // "1 milhão"
196
+ ```
197
+
198
+ ## Notas
199
+
200
+ - Todos os helpers aceitam entradas do tipo `string`; elas são internamente convertidas para números ou datas.
201
+ - O locale padrão é o configurado em `internationalization.defaultLocale` caso não seja fornecido.
202
+ - Essas utilidades são wrappers simples; para formatações avançadas, utilize as opções padrão do `Intl`.
203
+
204
+ ## Pontos de entrada e reexportações (`@index.ts`)
205
+
206
+ Os formatadores estão no pacote core e são reexportados por pacotes de nível superior para manter os imports ergonômicos em diferentes runtimes:
207
+
208
+ Exemplos:
209
+
210
+ ```ts
211
+ // Código da aplicação (recomendado)
212
+ import { number, currency, date, Intl } from "intlayer";
213
+ ```
214
+
215
+ ### React
216
+
217
+ Componentes cliente:
218
+
219
+ ```ts
220
+ import { useNumber, useCurrency, useDate } from "react-intlayer/format";
221
+ // ou em apps Next.js
222
+ import { useNumber, useCurrency, useDate } from "next-intlayer/client/format";
223
+ ```
224
+
225
+ Componentes servidor (ou runtime React Server):
226
+
227
+ ```ts
228
+ import { useNumber, useCurrency, useDate } from "intlayer/server/format";
229
+ // ou em apps Next.js
230
+ import { useNumber, useCurrency, useDate } from "next-intlayer/server/format";
231
+ ```
232
+
233
+ > Esses hooks considerarão o locale do `IntlayerProvider` ou `IntlayerServerProvider`
234
+
235
+ ## Histórico da documentação
236
+
237
+ | Versão | Data | Alterações |
238
+ | ------ | ---------- | -------------------------------------- |
239
+ | 5.8.0 | 2025-08-18 | Adiciona documentação dos formatadores |