Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
```