Awesome
Custom assets loaders for Easy Localization package
<!-- ![Coveralls github branch](https://img.shields.io/coveralls/github/aissat/easy_localization/dev?style=flat-square) --> <!-- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/aissat/easy_localization/Flutter%20Tester?longCache=true&style=flat-square&logo=github) -->
Supported formats
- JSON (JsonAssetLoader)
- CSV (CsvAssetLoader)
- HTTP (HttpAssetLoader)
- XML (XmlAssetLoader, XmlSingleAssetLoader)
- Yaml (YamlAssetLoader, YamlSingleAssetLoader)
- FILE (FileAssetLoader)
Configuration
- Add this to your package's pubspec.yaml file:
dependencies:
#Easy Localization main package
easy_localization: <last_version>
# stable version install from https://pub.dev/packages
easy_localization_loader: <last_version>
# Dev version install from git REPO
easy_localization_loader:
git: https://github.com/aissat/easy_localization_loader.git
- Change assetLoader and path
...
void main(){
runApp(EasyLocalization(
child: MyApp(),
supportedLocales: [Locale('en', 'US'), Locale('ar', 'DZ')],
path: 'resources/langs/langs.csv',
assetLoader: CsvAssetLoader()
));
}
...
- All done!.
Loaders Specification
HttpAssetLoader
In order to use HttpAssetLoader you must provide a path to a folder (i.e. base path) where all your translations are placed like https://example.com/translations
Your translations should be created as separate files with .json
extension. Placing translations as individual files reduces the size of the file to load on application init.
Example:
translations/
├── en-US.json
└── uk-UA.json