Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cem256/flutter_modular_localizations
Demonstrates the implementation of independent localizations for each module in Flutter
https://github.com/cem256/flutter_modular_localizations
flutter flutter-localizations modular-architecture
Last synced: 18 days ago
JSON representation
Demonstrates the implementation of independent localizations for each module in Flutter
- Host: GitHub
- URL: https://github.com/cem256/flutter_modular_localizations
- Owner: cem256
- License: mit
- Created: 2024-04-16T20:39:22.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-04-19T09:13:26.000Z (8 months ago)
- Last Synced: 2024-04-20T15:25:46.657Z (8 months ago)
- Topics: flutter, flutter-localizations, modular-architecture
- Language: Dart
- Homepage: https://medium.com/@cem256/implementing-modular-localizations-in-flutter-1ec1be409ac9
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Modular Localizations
Demonstrates the implementation of independent localizations for each module in Flutter. For a detailed guide, check out [Medium article](https://medium.com/@cem256/implementing-modular-localizations-in-flutter-1ec1be409ac9).## Why Use Modular Localization?
When dealing with a codebase consisting of multiple modules (packages), it is common to have a single, large localization file that is used by both the modules and the main project. However, this approach increases the modules' dependency on the main project and reduces their reusability. For example, extracting a module to use in another project requires also transferring parts of the localization file. A more effective strategy is to develop individual localization classes for each module, along with a shared localization class for commonly used terms in the app.## How it Works?
Each module and the application have their own ".arb" and "l10n.yaml" files. The application's "AppLocalizations" class stores shared terms, while each module, such as 'ModuleA' has its own 'ModuleALocalizations' class for its specific localization needs.## Generating Translations
To generate translations, navigate to the root of the project and execute the following script:```sh
sh scripts/generate_translations.sh
```