@intlayer/docs 7.0.0-canary.2 → 7.0.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/dist/cjs/common.cjs.map +1 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/types/common.d.ts +5 -0
- package/dist/types/common.d.ts.map +1 -1
- package/docs/ar/configuration.md +0 -24
- package/docs/ar/intlayer_with_nextjs_16.md +1652 -0
- package/docs/ar/releases/v7.md +485 -0
- package/docs/de/configuration.md +0 -24
- package/docs/de/intlayer_with_nextjs_16.md +1662 -0
- package/docs/de/releases/v7.md +502 -0
- package/docs/en/autoFill.md +3 -1
- package/docs/en/configuration.md +53 -58
- package/docs/en/intlayer_with_nextjs_15.md +5 -2
- package/docs/en/intlayer_with_nextjs_16.md +4 -4
- package/docs/en/releases/v7.md +142 -2
- package/docs/en-GB/configuration.md +9 -30
- package/docs/en-GB/intlayer_with_nextjs_16.md +1642 -0
- package/docs/en-GB/releases/v7.md +485 -0
- package/docs/es/configuration.md +0 -24
- package/docs/es/intlayer_with_nextjs_16.md +1670 -0
- package/docs/es/releases/v7.md +502 -0
- package/docs/fr/configuration.md +0 -24
- package/docs/fr/intlayer_with_nextjs_16.md +1692 -0
- package/docs/fr/releases/v7.md +503 -0
- package/docs/hi/configuration.md +0 -24
- package/docs/hi/intlayer_with_nextjs_16.md +1618 -0
- package/docs/hi/releases/v7.md +485 -0
- package/docs/id/intlayer_with_nextjs_16.md +1604 -0
- package/docs/id/releases/v7.md +502 -0
- package/docs/it/configuration.md +0 -24
- package/docs/it/intlayer_with_nextjs_16.md +1600 -0
- package/docs/it/releases/v7.md +504 -0
- package/docs/ja/configuration.md +0 -24
- package/docs/ja/intlayer_CMS.md +0 -9
- package/docs/ja/intlayer_with_nextjs_16.md +1788 -0
- package/docs/ja/releases/v7.md +503 -0
- package/docs/ko/configuration.md +0 -24
- package/docs/ko/intlayer_with_nextjs_16.md +1641 -0
- package/docs/ko/releases/v7.md +503 -0
- package/docs/pl/intlayer_with_nextjs_16.md +1645 -0
- package/docs/pl/releases/v7.md +485 -0
- package/docs/pt/configuration.md +0 -24
- package/docs/pt/intlayer_with_nextjs_16.md +1646 -0
- package/docs/pt/introduction.md +0 -15
- package/docs/pt/releases/v7.md +485 -0
- package/docs/ru/configuration.md +0 -24
- package/docs/ru/intlayer_with_nextjs_16.md +1610 -0
- package/docs/ru/releases/v7.md +485 -0
- package/docs/tr/configuration.md +0 -24
- package/docs/tr/intlayer_with_nextjs_16.md +1599 -0
- package/docs/tr/releases/v7.md +485 -0
- package/docs/vi/intlayer_with_nextjs_16.md +1597 -0
- package/docs/vi/releases/v7.md +485 -0
- package/docs/zh/configuration.md +0 -24
- package/docs/zh/intlayer_CMS.md +0 -23
- package/docs/zh/intlayer_with_nextjs_16.md +1628 -0
- package/docs/zh/releases/v7.md +486 -0
- package/package.json +14 -14
- package/src/common.ts +5 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-09-22
|
|
3
|
+
updatedAt: 2025-09-23
|
|
4
|
+
title: Intlayer v7 Baru - Apa yang Baru?
|
|
5
|
+
description: Temukan apa yang baru di Intlayer v7. Peningkatan besar dalam performa, pengalaman pengembang, dan fitur baru untuk meningkatkan alur kerja internasionalisasi Anda.
|
|
6
|
+
keywords:
|
|
7
|
+
- Intlayer
|
|
8
|
+
- Lokalisasi
|
|
9
|
+
- Pengembangan
|
|
10
|
+
- Performa
|
|
11
|
+
- Pengalaman Pengembang
|
|
12
|
+
- Fitur
|
|
13
|
+
- React
|
|
14
|
+
- Next.js
|
|
15
|
+
- JavaScript
|
|
16
|
+
- TypeScript
|
|
17
|
+
slugs:
|
|
18
|
+
- doc
|
|
19
|
+
- releases
|
|
20
|
+
- v7
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Intlayer v7 Baru - Apa yang Baru?
|
|
24
|
+
|
|
25
|
+
Selamat datang di Intlayer v7! Rilis besar ini memperkenalkan peningkatan signifikan dalam performa, keamanan tipe, dan pengalaman pengembang. Berikut adalah sorotan utama, dengan catatan migrasi dan contoh praktis.
|
|
26
|
+
|
|
27
|
+
## Sorotan
|
|
28
|
+
|
|
29
|
+
- Strategi caching untuk build yang lebih cepat
|
|
30
|
+
- Peningkatan pembuatan tipe TypeScript dengan tipe spesifik locale
|
|
31
|
+
- Optimasi bundel: Locale sebagai string bukan enum
|
|
32
|
+
- Mode routing baru: `prefix-no-default`, `prefix-all`, `no-prefix`, `search-params`
|
|
33
|
+
- Penyimpanan locale sesuai GDPR dengan localStorage sebagai default
|
|
34
|
+
- Konfigurasi penyimpanan yang fleksibel: cookies, localStorage, sessionStorage, atau kombinasi
|
|
35
|
+
- Ukuran paket Visual Editor 30% lebih kecil
|
|
36
|
+
- Opsi konfigurasi middleware yang ditingkatkan
|
|
37
|
+
- Perilaku perintah fill yang diperbarui untuk manajemen konten yang lebih baik
|
|
38
|
+
- Stabilitas yang ditingkatkan dengan pembaruan lengkap file deklarasi konten
|
|
39
|
+
- Manajemen retry cerdas untuk akurasi terjemahan
|
|
40
|
+
- Paralelisasi untuk pemrosesan terjemahan yang lebih cepat
|
|
41
|
+
- Pemecahan chunk cerdas untuk menangani file besar dalam batas konteks AI
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Performa: Caching untuk build yang lebih cepat
|
|
46
|
+
|
|
47
|
+
Alih-alih membangun ulang deklarasi konten dengan esbuild pada setiap build, v7 menerapkan strategi caching yang mempercepat proses build.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx intlayer build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Sistem caching baru:
|
|
54
|
+
|
|
55
|
+
- Menyimpan deklarasi konten yang sudah dikompilasi untuk menghindari pemrosesan berulang
|
|
56
|
+
- Mendeteksi perubahan dan hanya membangun ulang file yang dimodifikasi
|
|
57
|
+
- Secara signifikan mengurangi waktu build untuk proyek besar
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## TypeScript: Pembuatan tipe spesifik locale
|
|
62
|
+
|
|
63
|
+
Tipe TypeScript sekarang dibuat per locale, memberikan tipe yang lebih kuat dan menghilangkan tipe union di seluruh locale.
|
|
64
|
+
|
|
65
|
+
**Perilaku v6:**
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
const content = getIntlayer("my-title-content", "en");
|
|
69
|
+
// typeof content = { title: "My title" } | { title: "Mon titre" } | { title: "Mi título" }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Perilaku v7:**
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
const content = getIntlayer("my-title-content", "en");
|
|
76
|
+
// typeof content = { title: "My title" }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Manfaat:
|
|
80
|
+
|
|
81
|
+
- Autocomplete yang lebih tepat di IDE Anda
|
|
82
|
+
- Keamanan tipe yang lebih baik tanpa polusi tipe lintas locale
|
|
83
|
+
- Performa yang ditingkatkan dengan mengurangi kompleksitas tipe
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Optimasi bundle: Locale sebagai string
|
|
88
|
+
|
|
89
|
+
Tipe `Locales` tidak lagi berupa enum, yang berarti sekarang sepenuhnya tree-shakeable dan tidak akan membengkakkan bundle Anda dengan ribuan catatan locale yang tidak digunakan.
|
|
90
|
+
|
|
91
|
+
**v6:**
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { Locales } from "intlayer";
|
|
95
|
+
// Enum yang mencakup semua locale -> tidak tree-shakeable
|
|
96
|
+
|
|
97
|
+
const locale: Locales = Locales.ENGLISH;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**v7:**
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { Locales, Locale } from "intlayer";
|
|
104
|
+
// Tipe string -> sepenuhnya tree-shakeable
|
|
105
|
+
|
|
106
|
+
const locale: Locale = Locales.ENGLISH;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> Karena `Locales` tidak lagi berupa enum, Anda harus mengubah tipe dari `Locales` menjadi `Locale` untuk mendapatkan locale sebagai tipe.
|
|
110
|
+
|
|
111
|
+
Lihat [detail implementasi](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts) untuk informasi lebih lanjut.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Mode routing baru untuk fleksibilitas lebih besar
|
|
116
|
+
|
|
117
|
+
v7 memperkenalkan konfigurasi `routing.mode` yang terpadu yang menggantikan opsi `prefixDefault` dan `noPrefix` sebelumnya, menawarkan kontrol yang lebih rinci atas struktur URL.
|
|
118
|
+
|
|
119
|
+
### Mode routing yang tersedia
|
|
120
|
+
|
|
121
|
+
- **`prefix-no-default`** (default): Locale default tidak memiliki prefix, locale lain memiliki prefix
|
|
122
|
+
- `/dashboard` (en) atau `/fr/dashboard` (fr)
|
|
123
|
+
- **`prefix-all`**: Semua locale memiliki prefix
|
|
124
|
+
- `/en/dashboard` (en) atau `/fr/dashboard` (fr)
|
|
125
|
+
- **`no-prefix`**: Tidak ada prefix locale di URL (locale ditangani melalui penyimpanan/header)
|
|
126
|
+
- `/dashboard` untuk semua locale
|
|
127
|
+
- **`search-params`**: Locale diteruskan sebagai parameter query
|
|
128
|
+
- `/dashboard?locale=en` atau `/dashboard?locale=fr`
|
|
129
|
+
|
|
130
|
+
### Konfigurasi dasar
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// intlayer.config.ts
|
|
134
|
+
export default {
|
|
135
|
+
internationalization: {
|
|
136
|
+
locales: ["en", "fr", "es"],
|
|
137
|
+
defaultLocale: "en",
|
|
138
|
+
},
|
|
139
|
+
routing: {
|
|
140
|
+
mode: "prefix-no-default", // default
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Kepatuhan GDPR: penyimpanan localStorage / cookies
|
|
148
|
+
|
|
149
|
+
v7 memprioritaskan privasi pengguna dengan menggunakan `localStorage` sebagai mekanisme penyimpanan default menggantikan cookies. Perubahan ini membantu kepatuhan GDPR dengan menghindari kebutuhan persetujuan cookie untuk preferensi locale.
|
|
150
|
+
|
|
151
|
+
### Opsi konfigurasi penyimpanan
|
|
152
|
+
|
|
153
|
+
Field `routing.storage` baru juga tersedia selain opsi `middleware.cookieName` dan `middleware.serverSetCookie` sebelumnya, menawarkan konfigurasi penyimpanan yang fleksibel:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Nonaktifkan penyimpanan
|
|
157
|
+
storage: false
|
|
158
|
+
|
|
159
|
+
// Jenis penyimpanan sederhana
|
|
160
|
+
storage: 'cookie'
|
|
161
|
+
storage: 'localStorage'
|
|
162
|
+
storage: 'sessionStorage'
|
|
163
|
+
|
|
164
|
+
// Cookie dengan atribut khusus
|
|
165
|
+
storage: {
|
|
166
|
+
type: 'cookie',
|
|
167
|
+
name: 'custom-locale',
|
|
168
|
+
domain: '.example.com',
|
|
169
|
+
secure: true,
|
|
170
|
+
sameSite: 'strict'
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// localStorage dengan kunci khusus
|
|
174
|
+
storage: {
|
|
175
|
+
type: 'localStorage',
|
|
176
|
+
name: 'custom-locale'
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Beberapa jenis penyimpanan untuk redundansi
|
|
180
|
+
storage: ['cookie', 'localStorage']
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Contoh konfigurasi yang sesuai GDPR
|
|
184
|
+
|
|
185
|
+
Untuk aplikasi produksi yang perlu menyeimbangkan fungsionalitas dengan kepatuhan GDPR:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// intlayer.config.ts
|
|
189
|
+
export default {
|
|
190
|
+
internationalization: {
|
|
191
|
+
locales: ["en", "fr", "es"],
|
|
192
|
+
defaultLocale: "en",
|
|
193
|
+
},
|
|
194
|
+
routing: {
|
|
195
|
+
mode: "prefix-no-default",
|
|
196
|
+
storage: [
|
|
197
|
+
{
|
|
198
|
+
type: "localStorage", // Penyimpanan utama (tidak memerlukan persetujuan)
|
|
199
|
+
name: "user-locale",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: "cookie", // Penyimpanan cookie opsional (memerlukan persetujuan)
|
|
203
|
+
name: "user-locale",
|
|
204
|
+
secure: true,
|
|
205
|
+
sameSite: "strict",
|
|
206
|
+
httpOnly: false,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Aktifkan / nonaktifkan penyimpanan cookie
|
|
214
|
+
|
|
215
|
+
Contoh menggunakan React / Next.js:
|
|
216
|
+
|
|
217
|
+
Dapat didefinisikan secara global:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
<IntlayerProvider isCookieEnabled={false}>
|
|
221
|
+
<App />
|
|
222
|
+
</IntlayerProvider>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Dapat menimpanya secara lokal untuk setiap hook:
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
const { setLocale } = useLocale({ isCookieEnabled: false });
|
|
229
|
+
|
|
230
|
+
setLocale("en");
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Catatan:** Cookie diaktifkan secara default.
|
|
234
|
+
**Catatan:** Periksa [persyaratan cookie GDPR](https://gdpr.eu/cookies/) untuk kasus penggunaan spesifik Anda.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Visual Editor: Paket 30% lebih kecil
|
|
239
|
+
|
|
240
|
+
Paket Visual Editor telah dioptimalkan menjadi 30% lebih kecil dibandingkan versi sebelumnya, berkat:
|
|
241
|
+
|
|
242
|
+
- Peningkatan performa editor kode
|
|
243
|
+
- Penghapusan dependensi yang tidak perlu pada paket inti Intlayer
|
|
244
|
+
- Tree-shaking dan pengemasan modul yang lebih baik
|
|
245
|
+
|
|
246
|
+
Ini menghasilkan waktu unduh yang lebih cepat dan peningkatan performa runtime untuk aplikasi Anda.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Perintah Fill: Perilaku diperbarui untuk manajemen konten yang lebih baik
|
|
251
|
+
|
|
252
|
+
v7 memperkenalkan perilaku yang ditingkatkan untuk perintah `fill`, memberikan manajemen konten yang lebih dapat diprediksi dan fleksibel:
|
|
253
|
+
|
|
254
|
+
### Perilaku fill baru
|
|
255
|
+
|
|
256
|
+
- **`fill: true`** - Menulis ulang file saat ini dengan konten terisi untuk semua locale
|
|
257
|
+
- **`fill: "path/to/file"`** - Mengisi file yang ditentukan tanpa memodifikasi file saat ini
|
|
258
|
+
- **`fill: false`** - Menonaktifkan auto-fill sepenuhnya
|
|
259
|
+
|
|
260
|
+
### Dukungan yang ditingkatkan untuk struktur konten kompleks
|
|
261
|
+
|
|
262
|
+
Perintah fill sekarang mendukung struktur deklarasi konten yang kompleks, termasuk:
|
|
263
|
+
|
|
264
|
+
- **Objek tersusun**: Deklarasi konten yang merujuk objek lain
|
|
265
|
+
- **Konten terdestrukturisasi**: Konten yang menggunakan pola destrukturisasi
|
|
266
|
+
- **Referensi bersarang**: Objek yang saling memanggil dalam hierarki kompleks
|
|
267
|
+
- **Struktur konten dinamis**: Konten dengan properti kondisional atau terhitung
|
|
268
|
+
|
|
269
|
+
### Manfaat
|
|
270
|
+
|
|
271
|
+
- **Niat yang lebih jelas**: Perilaku sekarang lebih eksplisit tentang apa yang dimodifikasi
|
|
272
|
+
- **Pemisahan yang lebih baik**: File konten dapat disimpan terpisah dari terjemahan yang sudah diisi
|
|
273
|
+
- **Alur kerja yang ditingkatkan**: Pengembang memiliki kontrol lebih besar atas tempat penyimpanan terjemahan
|
|
274
|
+
- **Dukungan struktur kompleks**: Menangani arsitektur konten yang rumit dengan banyak objek yang saling terhubung
|
|
275
|
+
|
|
276
|
+
### Contoh penggunaan
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
// Menulis ulang file saat ini dengan semua locale
|
|
280
|
+
const content = {
|
|
281
|
+
key: "example",
|
|
282
|
+
fill: true, // Menulis ulang file ini
|
|
283
|
+
content: {
|
|
284
|
+
title: "Hello World",
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// Mengisi file terpisah tanpa memodifikasi file saat ini
|
|
289
|
+
const content = {
|
|
290
|
+
key: "example",
|
|
291
|
+
fill: "./translations.json", // Membuat/memperbarui translations.json
|
|
292
|
+
content: {
|
|
293
|
+
title: "Hello World",
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// Menonaktifkan auto-fill
|
|
298
|
+
const content = {
|
|
299
|
+
key: "example",
|
|
300
|
+
fill: false, // Tidak ada auto-fill
|
|
301
|
+
content: {
|
|
302
|
+
title: "Hello World",
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// Struktur konten kompleks dengan objek yang disusun
|
|
307
|
+
const sharedContent = {
|
|
308
|
+
buttons: {
|
|
309
|
+
save: "Simpan",
|
|
310
|
+
cancel: "Batal",
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const content = {
|
|
315
|
+
key: "complex-example",
|
|
316
|
+
fill: true,
|
|
317
|
+
content: {
|
|
318
|
+
// Referensi ke objek lain
|
|
319
|
+
sharedContent,
|
|
320
|
+
|
|
321
|
+
// Konten yang di-destrukturisasi
|
|
322
|
+
...sharedContent,
|
|
323
|
+
|
|
324
|
+
// Referensi bersarang
|
|
325
|
+
sections: [
|
|
326
|
+
{
|
|
327
|
+
...sharedContent.buttons,
|
|
328
|
+
header: "Bagian 1",
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Stabilitas dan manajemen terjemahan yang ditingkatkan
|
|
338
|
+
|
|
339
|
+
v7 memperkenalkan beberapa peningkatan untuk membuat terjemahan konten lebih andal dan efisien:
|
|
340
|
+
|
|
341
|
+
### Pembaruan lengkap file deklarasi konten
|
|
342
|
+
|
|
343
|
+
Sistem sekarang memperbarui file `.content.{ts,js,cjs,mjs}` secara penuh, bukan pembaruan parsial, memastikan:
|
|
344
|
+
|
|
345
|
+
- **Integritas data**: Penulisan ulang file secara lengkap mencegah pembaruan parsial yang dapat merusak konten
|
|
346
|
+
- **Konsistensi**: Semua lokal diperbarui secara atomik, menjaga sinkronisasi
|
|
347
|
+
- **Keandalan**: Mengurangi risiko file konten yang tidak lengkap atau rusak
|
|
348
|
+
|
|
349
|
+
### Manajemen pengulangan cerdas
|
|
350
|
+
|
|
351
|
+
Mekanisme pengulangan baru mencegah pengiriman konten dalam format yang salah, dan menghindari kegagalan seluruh proses pengisian jika satu permintaan gagal.
|
|
352
|
+
|
|
353
|
+
### Paralelisasi untuk pemrosesan lebih cepat
|
|
354
|
+
|
|
355
|
+
Operasi terjemahan sekarang dijalankan dalam antrean agar dapat berjalan secara paralel. Ini secara signifikan mempercepat proses.
|
|
356
|
+
|
|
357
|
+
### Pemecahan cerdas untuk file besar
|
|
358
|
+
|
|
359
|
+
Strategi pemecahan lanjutan menangani file konten besar tanpa melebihi jendela konteks AI:
|
|
360
|
+
|
|
361
|
+
### Contoh alur kerja
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
// File konten besar secara otomatis dipecah
|
|
365
|
+
const content = {
|
|
366
|
+
key: "large-documentation",
|
|
367
|
+
fill: true,
|
|
368
|
+
content: {
|
|
369
|
+
// Konten besar secara otomatis dibagi untuk pemrosesan AI
|
|
370
|
+
introduction: "..." // lebih dari 5000 karakter
|
|
371
|
+
sections: [
|
|
372
|
+
// Beberapa bagian besar
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Sistem secara otomatis:
|
|
379
|
+
|
|
380
|
+
1. Menganalisis ukuran dan struktur konten
|
|
381
|
+
2. Membagi konten dengan tepat
|
|
382
|
+
3. Memproses bagian secara paralel
|
|
383
|
+
4. Memvalidasi dan mencoba ulang jika diperlukan
|
|
384
|
+
5. Membangun kembali file lengkap
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Catatan migrasi dari v6
|
|
389
|
+
|
|
390
|
+
### Konfigurasi yang dihapus
|
|
391
|
+
|
|
392
|
+
- **`middleware.cookieName`**: Digantikan oleh `routing.storage`
|
|
393
|
+
- **`middleware.serverSetCookie`**: Digantikan oleh `routing.storage`
|
|
394
|
+
- **`middleware.prefixDefault`**: Digantikan oleh `routing.mode`
|
|
395
|
+
- **`middleware.noPrefix`**: Digantikan oleh `routing.mode`
|
|
396
|
+
|
|
397
|
+
### Pemetaan migrasi
|
|
398
|
+
|
|
399
|
+
#### Pemetaan konfigurasi
|
|
400
|
+
|
|
401
|
+
| Konfigurasi v6 | Konfigurasi v7 |
|
|
402
|
+
| -------------------------- | ------------------------------------------------------ |
|
|
403
|
+
| `autoFill: xxx` | `fill: xxx` |
|
|
404
|
+
| `prefixDefault: false` | `mode: 'prefix-no-default'` |
|
|
405
|
+
| `prefixDefault: true` | `mode: 'prefix-all'` |
|
|
406
|
+
| `noPrefix: true` | `mode: 'no-prefix'` |
|
|
407
|
+
| `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
|
|
408
|
+
| `serverSetCookie: 'never'` | `storage: false` atau hapus cookie dari array storage` |
|
|
409
|
+
|
|
410
|
+
#### Contoh migrasi
|
|
411
|
+
|
|
412
|
+
**Sebelum (v6):**
|
|
413
|
+
|
|
414
|
+
````typescript
|
|
415
|
+
export default {
|
|
416
|
+
#### Pemetaan konfigurasi
|
|
417
|
+
|
|
418
|
+
| Konfigurasi v6 | Konfigurasi v7 |
|
|
419
|
+
| ------------------------- | -------------------------------------------------- |
|
|
420
|
+
| `autoFill: xxx` | `fill: xxx` |
|
|
421
|
+
| `prefixDefault: false` | `mode: 'prefix-no-default'` |
|
|
422
|
+
| `prefixDefault: true` | `mode: 'prefix-all'` |
|
|
423
|
+
| `noPrefix: true` | `mode: 'no-prefix'` |
|
|
424
|
+
| `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
|
|
425
|
+
| `serverSetCookie: 'never'`| `storage: false` atau hapus cookie dari array storage` |
|
|
426
|
+
|
|
427
|
+
#### Contoh migrasi
|
|
428
|
+
|
|
429
|
+
**Sebelum (v6):**
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
export default {
|
|
433
|
+
middleware: {
|
|
434
|
+
headerName: "x-intlayer-locale",
|
|
435
|
+
cookieName: "intlayer-locale",
|
|
436
|
+
prefixDefault: false,
|
|
437
|
+
basePath: "",
|
|
438
|
+
serverSetCookie: "always",
|
|
439
|
+
noPrefix: false,
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
````
|
|
443
|
+
|
|
444
|
+
**Sesudah (v7):**
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
export default {
|
|
448
|
+
routing: {
|
|
449
|
+
mode: "prefix-no-default",
|
|
450
|
+
storage: "localStorage", // atau 'cookie' jika Anda membutuhkan penyimpanan cookie
|
|
451
|
+
headerName: "x-intlayer-locale",
|
|
452
|
+
basePath: "",
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
#### Pemetaan konten kamus
|
|
458
|
+
|
|
459
|
+
| Konten kamus v6 | Konten kamus v7 |
|
|
460
|
+
| --------------- | --------------- |
|
|
461
|
+
| `autoFill: xxx` | `fill: xxx` |
|
|
462
|
+
|
|
463
|
+
#### Contoh migrasi
|
|
464
|
+
|
|
465
|
+
**Sebelum (v6):**
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
const content = {
|
|
469
|
+
key: "example",
|
|
470
|
+
autoFill: true, // Menulis ulang file ini
|
|
471
|
+
content: {
|
|
472
|
+
title: "Hello World",
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Setelah (v7):**
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
const content = {
|
|
481
|
+
key: "example",
|
|
482
|
+
fill: true, // Menulis ulang file ini
|
|
483
|
+
content: {
|
|
484
|
+
title: "Hello World",
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Catatan migrasi dari v5 ke v6
|
|
492
|
+
|
|
493
|
+
Periksa [catatan migrasi dari v5 ke v6](https://github.com/aymericzip/intlayer/blob/main/docs/docs/id/releases/v6.md) untuk informasi lebih lanjut.
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Tautan berguna
|
|
498
|
+
|
|
499
|
+
- [Referensi Konfigurasi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/id/configuration.md)
|
|
500
|
+
- [Dokumentasi Middleware](https://github.com/aymericzip/intlayer/blob/main/docs/docs/id/packages/next-intlayer/index.md)
|
|
501
|
+
- [Tipe TypeScript](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts)
|
|
502
|
+
- [Panduan Cookie GDPR](https://gdpr.eu/cookies/)
|
package/docs/it/configuration.md
CHANGED
|
@@ -332,30 +332,6 @@ Impostazioni che controllano il comportamento del middleware, incluso come l'app
|
|
|
332
332
|
- Se `noPrefix = false`: l'URL sarà `https://example.com/my-app/en`
|
|
333
333
|
- Se `noPrefix = true`: l'URL sarà `https://example.com`
|
|
334
334
|
|
|
335
|
-
- **detectLocaleOnPrefetchNoPrefix**:
|
|
336
|
-
- _Tipo_: `boolean`
|
|
337
|
-
- _Predefinito_: `false`
|
|
338
|
-
- _Descrizione_: Controlla se il rilevamento della lingua avviene durante le richieste di prefetch di Next.js.
|
|
339
|
-
- _Esempio_: `true`
|
|
340
|
-
- _Nota_: Questa impostazione influisce su come Next.js gestisce il prefetching delle lingue:
|
|
341
|
-
- **Scenario di esempio:**
|
|
342
|
-
- La lingua del browser dell'utente è `'fr'`
|
|
343
|
-
- La pagina corrente è `/fr/about`
|
|
344
|
-
- Il link fa il prefetch di `/about`
|
|
345
|
-
- **Con `detectLocaleOnPrefetchNoPrefix: true`:**
|
|
346
|
-
- Il prefetch rileva la lingua `'fr'` dal browser
|
|
347
|
-
- Reindirizza il prefetch a `/fr/about`
|
|
348
|
-
- **Con `detectLocaleOnPrefetchNoPrefix: false` (predefinito):**
|
|
349
|
-
- Il prefetch usa la lingua predefinita
|
|
350
|
-
- Reindirizza il prefetch a `/en/about` (assumendo che `'en'` sia la predefinita)
|
|
351
|
-
- **Quando usare `true`:**
|
|
352
|
-
- La tua app utilizza link interni non localizzati (es. `<a href="/about">`)
|
|
353
|
-
- Vuoi un comportamento coerente nel rilevamento della lingua tra richieste normali e di prefetch
|
|
354
|
-
- **Quando usare `false` (default):**
|
|
355
|
-
- La tua app utilizza link con prefisso di lingua (es. `<a href="/fr/about">`)
|
|
356
|
-
- Vuoi ottimizzare le prestazioni del prefetch
|
|
357
|
-
- Vuoi evitare potenziali loop di redirect
|
|
358
|
-
|
|
359
335
|
---
|
|
360
336
|
|
|
361
337
|
### Configurazione del Contenuto
|