I am working on a Flutter project following a clean code architecture, and I use ARB files for localization. I’d like to organize the translation files within each feature and component, but I’m unsure of the best way to structure them. Currently, my project looks like this:
lib/
├── features/
│ ├── feature_1/
│ │ ├── data/
│ │ ├── domain/
│ │ ├── presentation/
├── l10n/
└── main.dart
My goal is to move the localization files closer to each feature, like this:
lib/
├── features/
│ ├── feature_1/
│ │ ├── data/
│ │ ├── domain/
│ │ ├── presentation/
│ │ │ └── l10n/
│ │ │ ├── feature_1_en.arb
│ │ │ └── feature_1_de.arb
└── main.dart
Some specific questions I have:
- Is there a way to split the translation
.arb
files so that they reside inside each feature’spresentation
folder (e.g.,lib/features/feature_1/presentation/l10n
)? - Would placing the ARB files inside feature-specific folders still allow the localization logic to work correctly, or would there be limitations in managing them this way?
- Are there any recommended practices or tools for handling feature-based localization in a clean code architecture?
Any advice or examples would be greatly appreciated!
You need to sign in to view this answers
Leave feedback about this