0 purchases
easy localization sheet
easy_localization_sheet #
Download the csv file and generate json files for easy_localization or any package that supports localization from json.
This package generates json files only. Let your localization package do the rest with generated files.
Installation #
Add to your project:
dart pub add --dev easy_localization_sheet or dart pub add --dev easy_localization_sheet
Your pubspec.yaml will look like below:
dependencies:
...
dev_dependencies:
...
easy_localization_sheet: <last_version>
copied to clipboard
Usage #
Add below section to your pubspec.yaml
easy_localization_sheet:
csv_url: 'your url'
output_dir: 'assets/translations' # Optional, default is assets
easy_localization_generate: # For use easy_localization:generate command, remove this block to disable
output_dir: lib/generated
output_file_name: locale_keys.g.dart
copied to clipboard
Then run dart run easy_localization_sheet or flutter pub run easy_localization_sheet
Example #
Google sheet example:
Make google sheet public
Extract SHEET_ID from Google sheet url: https://docs.google.com/spreadsheets/d/{SHEET_ID}/edit#gid=0
Set csv_url: 'https://docs.google.com/spreadsheets/d/{YOUR_ID}/export?format=csv'
Run dart run easy_localization_sheet
Syntax #
key column is required, row contains key also called header.
Rows above header will be ignored
Ignore column should be put into (), example (your column name)
Nested keys
# key name
gender.male
gender.female
copied to clipboard
# generated json
"gender": {
"male": "Male",
"female": "Female"
}
copied to clipboard
Visit example sheet for more detail
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.