Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/aissat/easy_localization_loader

custom assets loaders for easy_localization
https://github.com/aissat/easy_localization_loader

api assets csv customization-assetloader dart flutter http i18 i18n i18n-alternative json loader locales locales-translation localization localization-tool translation

Last synced: 6 days ago
JSON representation

custom assets loaders for easy_localization

Awesome Lists containing this project

README

        

## Custom assets loaders for [Easy Localization](https://github.com/aissat/easy_localization) package

![Pub Version](https://img.shields.io/pub/v/easy_localization_loader?style=flat-square)
![Code Climate issues](https://img.shields.io/github/issues/aissat/easy_localization_loader?style=flat-square)
![GitHub closed issues](https://img.shields.io/github/issues-closed/aissat/easy_localization_loader?style=flat-square)
![GitHub contributors](https://img.shields.io/github/contributors/aissat/easy_localization_loader?style=flat-square)
![GitHub repo size](https://img.shields.io/github/repo-size/aissat/easy_localization_loader?style=flat-square)
![GitHub forks](https://img.shields.io/github/forks/aissat/easy_localization_loader?style=flat-square)
![GitHub stars](https://img.shields.io/github/stars/aissat/easy_localization_loader?style=flat-square)

![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/aissat/easy_localization_loader?style=flat-square)
![GitHub license](https://img.shields.io/github/license/aissat/easy_localization_loader?style=flat-square)

### Supported formats

- [x] JSON (JsonAssetLoader)
- [x] CSV (CsvAssetLoader)
- [x] HTTP (HttpAssetLoader)
- [x] XML (XmlAssetLoader, XmlSingleAssetLoader)
- [x] Yaml (YamlAssetLoader, YamlSingleAssetLoader)
- [x] FILE (FileAssetLoader)

### Configuration

1. Add this to your package's pubspec.yaml file:

```yaml
dependencies:
#Easy Localization main package
easy_localization:

# stable version install from https://pub.dev/packages
easy_localization_loader:

# Dev version install from git REPO
easy_localization_loader:
git: https://github.com/aissat/easy_localization_loader.git

```

2. Change assetLoader and path

```dart
...
void main(){
runApp(EasyLocalization(
child: MyApp(),
supportedLocales: [Locale('en', 'US'), Locale('ar', 'DZ')],
path: 'resources/langs/langs.csv',
assetLoader: CsvAssetLoader()
));
}
...
```

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