You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,8 @@ flutter:
73
73
- assets/translations/
74
74
```
75
75
76
+
77
+
76
78
### 🔌 Loading translations from other resources
77
79
78
80
You can use JSON,CSV,HTTP,XML,Yaml files, etc.
@@ -407,6 +409,34 @@ Output:
407
409
print('example.emptyNameError'.tr()); //Output: Please fill in your full name
408
410
```
409
411
412
+
### 🔥 Linked files:
413
+
414
+
You can split translations for a single locale into multiple files by using linked files. This helps keep your JSON clean and maintainable.
415
+
416
+
To link an external file, set the key’s value to a path prefixed with `:/`, relative to your translations directory. For example, with default path `assets/translations` and locale `en-US`:
417
+
418
+
```json
419
+
{
420
+
"errors": ":/errors.json",
421
+
"validation": ":/validation.json",
422
+
"notifications": ":/notifications.json"
423
+
}
424
+
```
425
+
426
+
At runtime, Easy Localization will load:
427
+
```
428
+
assets
429
+
└── translations
430
+
└── en-US
431
+
├── errors.json
432
+
├── validation.json
433
+
└── notifications.json
434
+
```
435
+
436
+
Each linked file must contain a valid object of translation keys (of the file type you are using [Other file types](#-loading-translations-from-other-resources)).
437
+
438
+
Don't forget to add your linked files (or linked files folder, here assets/translations/en-US/), to your pubspec.yaml : [See installation](#-installation).
0 commit comments