@intlayer/docs 8.3.0-canary.4 → 8.3.1
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/docs/ar/compiler.md +84 -49
- package/docs/ar/configuration.md +80 -37
- package/docs/ar/intlayer_with_nextjs_16.md +174 -1
- package/docs/ar/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ar/intlayer_with_react_router_v7.md +224 -1
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ar/intlayer_with_svelte_kit.md +175 -2
- package/docs/ar/intlayer_with_tanstack.md +176 -1
- package/docs/ar/intlayer_with_vite+preact.md +174 -1
- package/docs/ar/intlayer_with_vite+react.md +174 -1
- package/docs/ar/intlayer_with_vite+solid.md +174 -1
- package/docs/ar/intlayer_with_vite+svelte.md +174 -1
- package/docs/ar/intlayer_with_vite+vue.md +174 -1
- package/docs/de/compiler.md +83 -48
- package/docs/de/configuration.md +434 -212
- package/docs/de/intlayer_with_nextjs_16.md +176 -1
- package/docs/de/intlayer_with_nextjs_compiler.md +106 -349
- package/docs/de/intlayer_with_react_router_v7.md +225 -2
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +221 -79
- package/docs/de/intlayer_with_svelte_kit.md +158 -2
- package/docs/de/intlayer_with_tanstack.md +159 -1
- package/docs/de/intlayer_with_vite+preact.md +157 -1
- package/docs/de/intlayer_with_vite+react.md +157 -1
- package/docs/de/intlayer_with_vite+solid.md +159 -3
- package/docs/de/intlayer_with_vite+svelte.md +157 -1
- package/docs/de/intlayer_with_vite+vue.md +157 -1
- package/docs/en/compiler.md +60 -33
- package/docs/en/configuration.md +80 -57
- package/docs/en/intlayer_with_nextjs_16.md +176 -0
- package/docs/en/intlayer_with_nextjs_compiler.md +179 -1
- package/docs/en/intlayer_with_react_router_v7.md +159 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +159 -0
- package/docs/en/intlayer_with_svelte_kit.md +159 -0
- package/docs/en/intlayer_with_tanstack.md +160 -1
- package/docs/en/intlayer_with_vite+preact.md +159 -0
- package/docs/en/intlayer_with_vite+react.md +159 -0
- package/docs/en/intlayer_with_vite+solid.md +148 -27
- package/docs/en/intlayer_with_vite+svelte.md +159 -0
- package/docs/en/intlayer_with_vite+vue.md +142 -41
- package/docs/en-GB/compiler.md +66 -34
- package/docs/en-GB/configuration.md +78 -36
- package/docs/es/compiler.md +83 -48
- package/docs/es/configuration.md +429 -206
- package/docs/es/intlayer_with_adonisjs.md +1 -1
- package/docs/es/intlayer_with_express.md +1 -1
- package/docs/es/intlayer_with_fastify.md +1 -1
- package/docs/es/intlayer_with_hono.md +1 -1
- package/docs/es/intlayer_with_nestjs.md +1 -1
- package/docs/es/intlayer_with_nextjs_16.md +176 -3
- package/docs/es/intlayer_with_nextjs_compiler.md +175 -2
- package/docs/es/intlayer_with_nuxt.md +1 -1
- package/docs/es/intlayer_with_react_router_v7.md +227 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +162 -4
- package/docs/es/intlayer_with_svelte_kit.md +158 -2
- package/docs/es/intlayer_with_tanstack.md +160 -2
- package/docs/es/intlayer_with_vite+preact.md +162 -6
- package/docs/es/intlayer_with_vite+react.md +160 -4
- package/docs/es/intlayer_with_vite+solid.md +163 -7
- package/docs/es/intlayer_with_vite+svelte.md +157 -1
- package/docs/es/intlayer_with_vite+vue.md +165 -9
- package/docs/fr/compiler.md +81 -46
- package/docs/fr/configuration.md +355 -134
- package/docs/fr/intlayer_with_adonisjs.md +1 -1
- package/docs/fr/intlayer_with_express.md +1 -1
- package/docs/fr/intlayer_with_fastify.md +1 -1
- package/docs/fr/intlayer_with_hono.md +1 -1
- package/docs/fr/intlayer_with_nestjs.md +1 -1
- package/docs/fr/intlayer_with_nextjs_16.md +183 -7
- package/docs/fr/intlayer_with_nextjs_compiler.md +179 -3
- package/docs/fr/intlayer_with_react_router_v7.md +229 -3
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +237 -6
- package/docs/fr/intlayer_with_svelte_kit.md +158 -2
- package/docs/fr/intlayer_with_tanstack.md +159 -1
- package/docs/fr/intlayer_with_vite+preact.md +164 -8
- package/docs/fr/intlayer_with_vite+react.md +162 -6
- package/docs/fr/intlayer_with_vite+solid.md +163 -7
- package/docs/fr/intlayer_with_vite+svelte.md +157 -1
- package/docs/fr/intlayer_with_vite+vue.md +164 -8
- package/docs/hi/compiler.md +81 -46
- package/docs/hi/configuration.md +87 -44
- package/docs/hi/intlayer_with_nextjs_16.md +174 -1
- package/docs/hi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/hi/intlayer_with_react_router_v7.md +224 -1
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/hi/intlayer_with_svelte_kit.md +158 -2
- package/docs/hi/intlayer_with_tanstack.md +159 -1
- package/docs/hi/intlayer_with_vite+preact.md +157 -1
- package/docs/hi/intlayer_with_vite+react.md +157 -1
- package/docs/hi/intlayer_with_vite+solid.md +157 -1
- package/docs/hi/intlayer_with_vite+svelte.md +157 -1
- package/docs/hi/intlayer_with_vite+vue.md +157 -1
- package/docs/id/compiler.md +84 -51
- package/docs/id/configuration.md +83 -45
- package/docs/id/intlayer_with_nextjs_16.md +174 -1
- package/docs/id/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/id/intlayer_with_react_router_v7.md +224 -1
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/id/intlayer_with_svelte_kit.md +158 -2
- package/docs/id/intlayer_with_tanstack.md +159 -1
- package/docs/id/intlayer_with_vite+preact.md +157 -1
- package/docs/id/intlayer_with_vite+react.md +157 -1
- package/docs/id/intlayer_with_vite+solid.md +157 -1
- package/docs/id/intlayer_with_vite+svelte.md +157 -1
- package/docs/id/intlayer_with_vite+vue.md +157 -1
- package/docs/it/compiler.md +81 -46
- package/docs/it/configuration.md +426 -204
- package/docs/it/intlayer_with_nextjs_16.md +174 -1
- package/docs/it/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/it/intlayer_with_react_router_v7.md +225 -2
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/it/intlayer_with_svelte_kit.md +158 -2
- package/docs/it/intlayer_with_tanstack.md +159 -1
- package/docs/it/intlayer_with_vite+preact.md +157 -1
- package/docs/it/intlayer_with_vite+react.md +157 -1
- package/docs/it/intlayer_with_vite+solid.md +159 -3
- package/docs/it/intlayer_with_vite+svelte.md +157 -1
- package/docs/it/intlayer_with_vite+vue.md +157 -1
- package/docs/ja/compiler.md +94 -58
- package/docs/ja/configuration.md +88 -45
- package/docs/ja/intlayer_with_nextjs_16.md +174 -1
- package/docs/ja/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ja/intlayer_with_react_router_v7.md +184 -394
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ja/intlayer_with_svelte_kit.md +119 -595
- package/docs/ja/intlayer_with_tanstack.md +131 -642
- package/docs/ja/intlayer_with_vite+preact.md +111 -1231
- package/docs/ja/intlayer_with_vite+react.md +129 -1304
- package/docs/ja/intlayer_with_vite+solid.md +159 -3
- package/docs/ja/intlayer_with_vite+svelte.md +157 -1
- package/docs/ja/intlayer_with_vite+vue.md +157 -1
- package/docs/ko/compiler.md +88 -52
- package/docs/ko/configuration.md +87 -44
- package/docs/ko/intlayer_with_nextjs_16.md +174 -1
- package/docs/ko/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ko/intlayer_with_react_router_v7.md +225 -2
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ko/intlayer_with_svelte_kit.md +158 -2
- package/docs/ko/intlayer_with_tanstack.md +159 -1
- package/docs/ko/intlayer_with_vite+preact.md +157 -1
- package/docs/ko/intlayer_with_vite+react.md +157 -1
- package/docs/ko/intlayer_with_vite+solid.md +159 -3
- package/docs/ko/intlayer_with_vite+svelte.md +157 -1
- package/docs/ko/intlayer_with_vite+vue.md +157 -1
- package/docs/pl/compiler.md +84 -51
- package/docs/pl/configuration.md +83 -37
- package/docs/pl/intlayer_with_nextjs_16.md +174 -1
- package/docs/pl/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pl/intlayer_with_react_router_v7.md +224 -1
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pl/intlayer_with_svelte_kit.md +158 -2
- package/docs/pl/intlayer_with_tanstack.md +159 -1
- package/docs/pl/intlayer_with_vite+preact.md +157 -1
- package/docs/pl/intlayer_with_vite+react.md +157 -1
- package/docs/pl/intlayer_with_vite+solid.md +157 -1
- package/docs/pl/intlayer_with_vite+svelte.md +157 -1
- package/docs/pl/intlayer_with_vite+vue.md +157 -1
- package/docs/pt/compiler.md +81 -46
- package/docs/pt/configuration.md +404 -194
- package/docs/pt/intlayer_with_nextjs_16.md +174 -1
- package/docs/pt/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pt/intlayer_with_react_router_v7.md +224 -1
- package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pt/intlayer_with_svelte_kit.md +158 -2
- package/docs/pt/intlayer_with_tanstack.md +159 -1
- package/docs/pt/intlayer_with_vite+preact.md +157 -1
- package/docs/pt/intlayer_with_vite+react.md +157 -1
- package/docs/pt/intlayer_with_vite+solid.md +157 -1
- package/docs/pt/intlayer_with_vite+svelte.md +157 -1
- package/docs/pt/intlayer_with_vite+vue.md +157 -1
- package/docs/ru/compiler.md +90 -57
- package/docs/ru/configuration.md +76 -46
- package/docs/ru/intlayer_with_nextjs_16.md +174 -1
- package/docs/ru/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ru/intlayer_with_react_router_v7.md +224 -1
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ru/intlayer_with_svelte_kit.md +158 -2
- package/docs/ru/intlayer_with_tanstack.md +159 -1
- package/docs/ru/intlayer_with_vite+preact.md +157 -1
- package/docs/ru/intlayer_with_vite+react.md +157 -1
- package/docs/ru/intlayer_with_vite+solid.md +157 -1
- package/docs/ru/intlayer_with_vite+svelte.md +157 -1
- package/docs/ru/intlayer_with_vite+vue.md +157 -1
- package/docs/tr/compiler.md +85 -52
- package/docs/tr/configuration.md +83 -40
- package/docs/tr/intlayer_with_nextjs_16.md +174 -1
- package/docs/tr/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/tr/intlayer_with_react_router_v7.md +224 -1
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/tr/intlayer_with_svelte_kit.md +158 -2
- package/docs/tr/intlayer_with_tanstack.md +159 -1
- package/docs/tr/intlayer_with_vite+preact.md +157 -1
- package/docs/tr/intlayer_with_vite+react.md +157 -1
- package/docs/tr/intlayer_with_vite+solid.md +157 -1
- package/docs/tr/intlayer_with_vite+svelte.md +157 -1
- package/docs/tr/intlayer_with_vite+vue.md +157 -1
- package/docs/uk/compiler.md +96 -61
- package/docs/uk/configuration.md +83 -37
- package/docs/uk/intlayer_with_nextjs_16.md +174 -1
- package/docs/uk/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/uk/intlayer_with_react_router_v7.md +224 -1
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/uk/intlayer_with_svelte_kit.md +157 -1
- package/docs/uk/intlayer_with_tanstack.md +159 -1
- package/docs/uk/intlayer_with_vite+preact.md +157 -1
- package/docs/uk/intlayer_with_vite+react.md +157 -1
- package/docs/uk/intlayer_with_vite+solid.md +157 -1
- package/docs/uk/intlayer_with_vite+svelte.md +157 -1
- package/docs/uk/intlayer_with_vite+vue.md +157 -1
- package/docs/vi/compiler.md +85 -50
- package/docs/vi/configuration.md +85 -39
- package/docs/vi/intlayer_with_nextjs_16.md +174 -1
- package/docs/vi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/vi/intlayer_with_react_router_v7.md +224 -1
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/vi/intlayer_with_svelte_kit.md +158 -2
- package/docs/vi/intlayer_with_tanstack.md +159 -1
- package/docs/vi/intlayer_with_vite+preact.md +157 -1
- package/docs/vi/intlayer_with_vite+react.md +157 -1
- package/docs/vi/intlayer_with_vite+solid.md +157 -1
- package/docs/vi/intlayer_with_vite+svelte.md +157 -1
- package/docs/vi/intlayer_with_vite+vue.md +157 -1
- package/docs/zh/compiler.md +84 -49
- package/docs/zh/configuration.md +80 -37
- package/docs/zh/intlayer_with_adonisjs.md +1 -1
- package/docs/zh/intlayer_with_express.md +1 -1
- package/docs/zh/intlayer_with_fastify.md +1 -1
- package/docs/zh/intlayer_with_hono.md +1 -1
- package/docs/zh/intlayer_with_nestjs.md +1 -1
- package/docs/zh/intlayer_with_nextjs_16.md +174 -1
- package/docs/zh/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/zh/intlayer_with_react_router_v7.md +227 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +228 -4
- package/docs/zh/intlayer_with_svelte_kit.md +158 -2
- package/docs/zh/intlayer_with_tanstack.md +159 -1
- package/docs/zh/intlayer_with_vite+preact.md +159 -3
- package/docs/zh/intlayer_with_vite+react.md +157 -1
- package/docs/zh/intlayer_with_vite+solid.md +161 -5
- package/docs/zh/intlayer_with_vite+svelte.md +157 -1
- package/docs/zh/intlayer_with_vite+vue.md +158 -2
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-04
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: React Router v7 i18n - Cách dịch ứng dụng React Router v7 năm 2026
|
|
5
5
|
description: Tìm hiểu cách thêm quốc tế hóa (i18n) vào ứng dụng React Router v7 của bạn bằng Intlayer. Theo dõi hướng dẫn toàn diện này để làm cho ứng dụng của bạn đa ngôn ngữ với định tuyến nhận biết locale.
|
|
6
6
|
keywords:
|
|
@@ -514,6 +514,229 @@ export default function RootLayout() {
|
|
|
514
514
|
}
|
|
515
515
|
```
|
|
516
516
|
|
|
517
|
+
### (Tùy chọn) Bước 1 : Trích xuất nội dung các thành phần của bạn
|
|
518
|
+
|
|
519
|
+
Nếu bạn có một cơ sở mã hiện có, việc chuyển đổi hàng nghìn tệp có thể tốn nhiều thời gian.
|
|
520
|
+
|
|
521
|
+
Để đơn giản hóa quy trình này, Intlayer đề xuất một [trình biên dịch](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/compiler.md) / [trình trích xuất](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md) để chuyển đổi các thành phần của bạn và trích xuất nội dung.
|
|
522
|
+
|
|
523
|
+
Để thiết lập, bạn có thể thêm phần `compiler` vào tệp `intlayer.config.ts` của mình:
|
|
524
|
+
|
|
525
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
526
|
+
import { type IntlayerConfig } from "intlayer";
|
|
527
|
+
|
|
528
|
+
const config: IntlayerConfig = {
|
|
529
|
+
// ... Phần còn lại của cấu hình
|
|
530
|
+
compiler: {
|
|
531
|
+
/**
|
|
532
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
533
|
+
*/
|
|
534
|
+
enabled: true,
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
538
|
+
*/
|
|
539
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
543
|
+
*/
|
|
544
|
+
saveComponents: false,
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Tiền tố khóa từ điển
|
|
548
|
+
*/
|
|
549
|
+
dictionaryKeyPrefix: "",
|
|
550
|
+
},
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
export default config;
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
557
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
558
|
+
const config = {
|
|
559
|
+
// ... Phần còn lại của cấu hình
|
|
560
|
+
compiler: {
|
|
561
|
+
/**
|
|
562
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
563
|
+
*/
|
|
564
|
+
enabled: true,
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
568
|
+
*/
|
|
569
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
573
|
+
*/
|
|
574
|
+
saveComponents: false,
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Tiền tố khóa từ điển
|
|
578
|
+
*/
|
|
579
|
+
dictionaryKeyPrefix: "",
|
|
580
|
+
},
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
export default config;
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
587
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
588
|
+
const config = {
|
|
589
|
+
// ... Phần còn lại của cấu hình
|
|
590
|
+
compiler: {
|
|
591
|
+
/**
|
|
592
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
593
|
+
*/
|
|
594
|
+
enabled: true,
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
598
|
+
*/
|
|
599
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
603
|
+
*/
|
|
604
|
+
saveComponents: false,
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Tiền tố khóa từ điển
|
|
608
|
+
*/
|
|
609
|
+
dictionaryKeyPrefix: "",
|
|
610
|
+
},
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
module.exports = config;
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
<Tabs>
|
|
617
|
+
<Tab value='Lệnh trích xuất'>
|
|
618
|
+
|
|
619
|
+
Chạy trình trích xuất để chuyển đổi các thành phần và trích xuất nội dung
|
|
620
|
+
|
|
621
|
+
```bash packageManager="npm"
|
|
622
|
+
npx intlayer extract
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
```bash packageManager="pnpm"
|
|
626
|
+
pnpm intlayer extract
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
```bash packageManager="yarn"
|
|
630
|
+
yarn intlayer extract
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
```bash packageManager="bun"
|
|
634
|
+
bunx intlayer extract
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
</Tab>
|
|
638
|
+
<Tab value='Trình biên dịch Babel'>
|
|
639
|
+
|
|
640
|
+
Cập nhật `vite.config.ts` của bạn để bao gồm plugin `intlayerCompiler`:
|
|
641
|
+
|
|
642
|
+
```ts fileName="vite.config.ts"
|
|
643
|
+
import { defineConfig } from "vite";
|
|
644
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
645
|
+
|
|
646
|
+
export default defineConfig({
|
|
647
|
+
plugins: [
|
|
648
|
+
intlayer(),
|
|
649
|
+
intlayerCompiler(), // Thêm plugin trình biên dịch
|
|
650
|
+
],
|
|
651
|
+
});
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
```bash packageManager="npm"
|
|
655
|
+
npm run build # Hoặc npm run dev
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
```bash packageManager="pnpm"
|
|
659
|
+
pnpm run build # Or pnpm run dev
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
```bash packageManager="yarn"
|
|
663
|
+
yarn build # Or yarn dev
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
```bash packageManager="bun"
|
|
667
|
+
bun run build # Or bun run dev
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
</Tab>
|
|
671
|
+
</Tabs>
|
|
672
|
+
|
|
673
|
+
---
|
|
674
|
+
|
|
675
|
+
## Configure TypeScript
|
|
676
|
+
|
|
677
|
+
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
678
|
+
|
|
679
|
+
Ensure your TypeScript configuration includes the autogenerated types:
|
|
680
|
+
|
|
681
|
+
```json5 fileName="tsconfig.json"
|
|
682
|
+
{
|
|
683
|
+
// ... your existing configurations
|
|
684
|
+
include: [
|
|
685
|
+
// ... your existing includes
|
|
686
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
687
|
+
],
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## Git Configuration
|
|
694
|
+
|
|
695
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
696
|
+
|
|
697
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
698
|
+
|
|
699
|
+
```plaintext fileName=".gitignore"
|
|
700
|
+
# Ignore the files generated by Intlayer
|
|
701
|
+
.intlayer
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
## VS Code Extension
|
|
707
|
+
|
|
708
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
709
|
+
|
|
710
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
711
|
+
|
|
712
|
+
This extension provides:
|
|
713
|
+
|
|
714
|
+
- **Autocompletion** for translation keys.
|
|
715
|
+
- **Real-time error detection** for missing translations.
|
|
716
|
+
- **Inline previews** of translated content.
|
|
717
|
+
- **Quick actions** to easily create and update translations.
|
|
718
|
+
|
|
719
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
## Go Further
|
|
724
|
+
|
|
725
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
## Documentation References
|
|
730
|
+
|
|
731
|
+
- [Intlayer Documentation](https://intlayer.org)
|
|
732
|
+
- [React Router v7 Documentation](https://reactrouter.com/)
|
|
733
|
+
- [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useIntlayer.md)
|
|
734
|
+
- [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
|
|
735
|
+
- [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
736
|
+
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
|
|
737
|
+
|
|
738
|
+
This comprehensive guide provides everything you need to integrate Intlayer with React Router v7 for a fully internationalized application with locale-aware routing and TypeScript support.
|
|
739
|
+
|
|
517
740
|
### Bước 11: Thêm middleware (Tùy chọn)
|
|
518
741
|
|
|
519
742
|
Bạn cũng có thể sử dụng `intlayerProxy` để thêm routing phía server cho ứng dụng của bạn. Plugin này sẽ tự động phát hiện locale hiện tại dựa trên URL và thiết lập cookie locale phù hợp. Nếu không có locale nào được chỉ định, plugin sẽ xác định locale phù hợp nhất dựa trên ngôn ngữ trình duyệt của người dùng. Nếu không phát hiện được locale nào, nó sẽ chuyển hướng đến locale mặc định.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-04
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: React Router v7 i18n - Cách dịch ứng dụng React Router v7 năm 2026
|
|
5
5
|
description: Tìm hiểu cách thêm quốc tế hóa (i18n) vào ứng dụng React Router v7 của bạn bằng Intlayer. Theo dõi hướng dẫn toàn diện này để làm cho ứng dụng của bạn đa ngôn ngữ với định tuyến nhận biết locale.
|
|
6
6
|
keywords:
|
|
@@ -459,6 +459,230 @@ export default function RootLayout() {
|
|
|
459
459
|
}
|
|
460
460
|
```
|
|
461
461
|
|
|
462
|
+
### (Tùy chọn) Bước 1 : Trích xuất nội dung các thành phần của bạn
|
|
463
|
+
|
|
464
|
+
Nếu bạn có một cơ sở mã hiện có, việc chuyển đổi hàng nghìn tệp có thể tốn nhiều thời gian.
|
|
465
|
+
|
|
466
|
+
Để đơn giản hóa quy trình này, Intlayer đề xuất một [trình biên dịch](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/compiler.md) / [trình trích xuất](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md) để chuyển đổi các thành phần của bạn và trích xuất nội dung.
|
|
467
|
+
|
|
468
|
+
Để thiết lập, bạn có thể thêm phần `compiler` vào tệp `intlayer.config.ts` của mình:
|
|
469
|
+
|
|
470
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
471
|
+
import { type IntlayerConfig } from "intlayer";
|
|
472
|
+
|
|
473
|
+
const config: IntlayerConfig = {
|
|
474
|
+
// ... Phần còn lại của cấu hình
|
|
475
|
+
compiler: {
|
|
476
|
+
/**
|
|
477
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
478
|
+
*/
|
|
479
|
+
enabled: true,
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
483
|
+
*/
|
|
484
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
488
|
+
*/
|
|
489
|
+
saveComponents: false,
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Tiền tố khóa từ điển
|
|
493
|
+
*/
|
|
494
|
+
dictionaryKeyPrefix: "",
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export default config;
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
502
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
503
|
+
const config = {
|
|
504
|
+
// ... Phần còn lại của cấu hình
|
|
505
|
+
compiler: {
|
|
506
|
+
/**
|
|
507
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
508
|
+
*/
|
|
509
|
+
enabled: true,
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
513
|
+
*/
|
|
514
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
518
|
+
*/
|
|
519
|
+
saveComponents: false,
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Tiền tố khóa từ điển
|
|
523
|
+
*/
|
|
524
|
+
dictionaryKeyPrefix: "",
|
|
525
|
+
},
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export default config;
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
532
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
533
|
+
const config = {
|
|
534
|
+
// ... Phần còn lại của cấu hình
|
|
535
|
+
compiler: {
|
|
536
|
+
/**
|
|
537
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
538
|
+
*/
|
|
539
|
+
enabled: true,
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
543
|
+
*/
|
|
544
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
548
|
+
*/
|
|
549
|
+
saveComponents: false,
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Tiền tố khóa từ điển
|
|
553
|
+
*/
|
|
554
|
+
dictionaryKeyPrefix: "",
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
module.exports = config;
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
<Tabs>
|
|
562
|
+
<Tab value='Lệnh trích xuất'>
|
|
563
|
+
|
|
564
|
+
Chạy trình trích xuất để chuyển đổi các thành phần và trích xuất nội dung
|
|
565
|
+
|
|
566
|
+
```bash packageManager="npm"
|
|
567
|
+
npx intlayer extract
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
```bash packageManager="pnpm"
|
|
571
|
+
pnpm intlayer extract
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
```bash packageManager="yarn"
|
|
575
|
+
yarn intlayer extract
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
```bash packageManager="bun"
|
|
579
|
+
bunx intlayer extract
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
</Tab>
|
|
583
|
+
<Tab value='Trình biên dịch Babel'>
|
|
584
|
+
|
|
585
|
+
Cập nhật `vite.config.ts` của bạn để bao gồm plugin `intlayerCompiler`:
|
|
586
|
+
|
|
587
|
+
```ts fileName="vite.config.ts"
|
|
588
|
+
import { defineConfig } from "vite";
|
|
589
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
590
|
+
|
|
591
|
+
export default defineConfig({
|
|
592
|
+
plugins: [
|
|
593
|
+
intlayer(),
|
|
594
|
+
intlayerCompiler(), // Thêm plugin trình biên dịch
|
|
595
|
+
],
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
```bash packageManager="npm"
|
|
600
|
+
npm run build # Hoặc npm run dev
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
```bash packageManager="pnpm"
|
|
604
|
+
pnpm run build # Or pnpm run dev
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
```bash packageManager="yarn"
|
|
608
|
+
yarn build # Or yarn dev
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
```bash packageManager="bun"
|
|
612
|
+
bun run build # Or bun run dev
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
</Tab>
|
|
616
|
+
</Tabs>
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## Configure TypeScript
|
|
621
|
+
|
|
622
|
+
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
623
|
+
|
|
624
|
+
Ensure your TypeScript configuration includes the autogenerated types:
|
|
625
|
+
|
|
626
|
+
```json5 fileName="tsconfig.json"
|
|
627
|
+
{
|
|
628
|
+
// ... your existing configurations
|
|
629
|
+
include: [
|
|
630
|
+
// ... your existing includes
|
|
631
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
632
|
+
],
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## Git Configuration
|
|
639
|
+
|
|
640
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
641
|
+
|
|
642
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
643
|
+
|
|
644
|
+
```plaintext fileName=".gitignore"
|
|
645
|
+
# Ignore the files generated by Intlayer
|
|
646
|
+
.intlayer
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
## VS Code Extension
|
|
652
|
+
|
|
653
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
654
|
+
|
|
655
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
656
|
+
|
|
657
|
+
This extension provides:
|
|
658
|
+
|
|
659
|
+
- **Autocompletion** for translation keys.
|
|
660
|
+
- **Real-time error detection** for missing translations.
|
|
661
|
+
- **Inline previews** of translated content.
|
|
662
|
+
- **Quick actions** to easily create and update translations.
|
|
663
|
+
|
|
664
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
## Go Further
|
|
669
|
+
|
|
670
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## Documentation References
|
|
675
|
+
|
|
676
|
+
- [Intlayer Documentation](https://intlayer.org)
|
|
677
|
+
- [React Router v7 Documentation](https://reactrouter.com/)
|
|
678
|
+
- [React Router fs-routes Documentation](https://reactrouter.com/how-to/file-route-conventions)
|
|
679
|
+
- [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useIntlayer.md)
|
|
680
|
+
- [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
|
|
681
|
+
- [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
682
|
+
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
|
|
683
|
+
|
|
684
|
+
This comprehensive guide provides everything you need to integrate Intlayer with React Router v7 using file-system based routing for a fully internationalized application with locale-aware routing and TypeScript support.
|
|
685
|
+
|
|
462
686
|
### Bước 11: Thêm middleware (Tùy chọn)
|
|
463
687
|
|
|
464
688
|
Bạn cũng có thể sử dụng `intlayerProxy` để thêm routing phía server cho ứng dụng của bạn. Plugin này sẽ tự động phát hiện locale hiện tại dựa trên URL và thiết lập cookie locale phù hợp. Nếu không có locale nào được chỉ định, plugin sẽ xác định locale phù hợp nhất dựa trên ngôn ngữ trình duyệt của người dùng. Nếu không phát hiện được locale nào, nó sẽ chuyển hướng đến locale mặc định.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-11-20
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: SvelteKit i18n - Cách dịch ứng dụng SvelteKit năm 2026
|
|
5
5
|
description: Khám phá cách làm cho trang web SvelteKit của bạn đa ngôn ngữ. Theo dõi tài liệu để quốc tế hóa (i18n) và dịch nó bằng cách sử dụng Server-Side Rendering (SSR).
|
|
6
6
|
keywords:
|
|
@@ -185,7 +185,7 @@ Bây giờ bạn có thể sử dụng hàm `useIntlayer` trong bất kỳ compo
|
|
|
185
185
|
|
|
186
186
|
> **Lưu ý:** `useIntlayer` trả về một store của Svelte, vì vậy bạn cần sử dụng tiền tố `---
|
|
187
187
|
> createdAt: 2025-11-20
|
|
188
|
-
> updatedAt:
|
|
188
|
+
> updatedAt: 2026-03-12
|
|
189
189
|
> title: Cách dịch ứng dụng SvelteKit của bạn – hướng dẫn i18n 2026
|
|
190
190
|
> description: Khám phá cách làm cho trang web SvelteKit của bạn đa ngôn ngữ. Theo dõi tài liệu để quốc tế hóa (i18n) và dịch nó bằng cách sử dụng Server-Side Rendering (SSR).
|
|
191
191
|
> keywords:
|
|
@@ -744,6 +744,162 @@ Khuyến nghị bỏ qua các tệp được tạo bởi Intlayer.
|
|
|
744
744
|
|
|
745
745
|
---
|
|
746
746
|
|
|
747
|
+
### (Tùy chọn) Bước 1 : Trích xuất nội dung các thành phần của bạn
|
|
748
|
+
|
|
749
|
+
Nếu bạn có một cơ sở mã hiện có, việc chuyển đổi hàng nghìn tệp có thể tốn nhiều thời gian.
|
|
750
|
+
|
|
751
|
+
Để đơn giản hóa quy trình này, Intlayer đề xuất một [trình biên dịch](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/compiler.md) / [trình trích xuất](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md) để chuyển đổi các thành phần của bạn và trích xuất nội dung.
|
|
752
|
+
|
|
753
|
+
Để thiết lập, bạn có thể thêm phần `compiler` vào tệp `intlayer.config.ts` của mình:
|
|
754
|
+
|
|
755
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
756
|
+
import { type IntlayerConfig } from "intlayer";
|
|
757
|
+
|
|
758
|
+
const config: IntlayerConfig = {
|
|
759
|
+
// ... Phần còn lại của cấu hình
|
|
760
|
+
compiler: {
|
|
761
|
+
/**
|
|
762
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
763
|
+
*/
|
|
764
|
+
enabled: true,
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
768
|
+
*/
|
|
769
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
773
|
+
*/
|
|
774
|
+
saveComponents: false,
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Tiền tố khóa từ điển
|
|
778
|
+
*/
|
|
779
|
+
dictionaryKeyPrefix: "",
|
|
780
|
+
},
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
export default config;
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
787
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
788
|
+
const config = {
|
|
789
|
+
// ... Phần còn lại của cấu hình
|
|
790
|
+
compiler: {
|
|
791
|
+
/**
|
|
792
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
793
|
+
*/
|
|
794
|
+
enabled: true,
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
798
|
+
*/
|
|
799
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
803
|
+
*/
|
|
804
|
+
saveComponents: false,
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Tiền tố khóa từ điển
|
|
808
|
+
*/
|
|
809
|
+
dictionaryKeyPrefix: "",
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
export default config;
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
817
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
818
|
+
const config = {
|
|
819
|
+
// ... Phần còn lại của cấu hình
|
|
820
|
+
compiler: {
|
|
821
|
+
/**
|
|
822
|
+
* Cho biết trình biên dịch có nên được bật hay không.
|
|
823
|
+
*/
|
|
824
|
+
enabled: true,
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Xác định đường dẫn các tệp đầu ra
|
|
828
|
+
*/
|
|
829
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
|
|
833
|
+
*/
|
|
834
|
+
saveComponents: false,
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Tiền tố khóa từ điển
|
|
838
|
+
*/
|
|
839
|
+
dictionaryKeyPrefix: "",
|
|
840
|
+
},
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
module.exports = config;
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
<Tabs>
|
|
847
|
+
<Tab value='Lệnh trích xuất'>
|
|
848
|
+
|
|
849
|
+
Chạy trình trích xuất để chuyển đổi các thành phần và trích xuất nội dung
|
|
850
|
+
|
|
851
|
+
```bash packageManager="npm"
|
|
852
|
+
npx intlayer extract
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
```bash packageManager="pnpm"
|
|
856
|
+
pnpm intlayer extract
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
```bash packageManager="yarn"
|
|
860
|
+
yarn intlayer extract
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
```bash packageManager="bun"
|
|
864
|
+
bunx intlayer extract
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
</Tab>
|
|
868
|
+
<Tab value='Trình biên dịch Babel'>
|
|
869
|
+
|
|
870
|
+
Cập nhật `vite.config.ts` của bạn để bao gồm plugin `intlayerCompiler`:
|
|
871
|
+
|
|
872
|
+
```ts fileName="vite.config.ts"
|
|
873
|
+
import { defineConfig } from "vite";
|
|
874
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
875
|
+
|
|
876
|
+
export default defineConfig({
|
|
877
|
+
plugins: [
|
|
878
|
+
intlayer(),
|
|
879
|
+
intlayerCompiler(), // Thêm plugin trình biên dịch
|
|
880
|
+
],
|
|
881
|
+
});
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
```bash packageManager="npm"
|
|
885
|
+
npm run build # Hoặc npm run dev
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
```bash packageManager="pnpm"
|
|
889
|
+
pnpm run build # Or pnpm run dev
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
```bash packageManager="yarn"
|
|
893
|
+
yarn build # Or yarn dev
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
```bash packageManager="bun"
|
|
897
|
+
bun run build # Or bun run dev
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
</Tab>
|
|
901
|
+
</Tabs>
|
|
902
|
+
|
|
747
903
|
### Đi xa hơn
|
|
748
904
|
|
|
749
905
|
- **Trình chỉnh sửa trực quan**: Tích hợp [Trình chỉnh sửa trực quan Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) để chỉnh sửa bản dịch trực tiếp từ giao diện người dùng.
|