Skip to content

Generate Flutter localizations from a simple CSV file (exported from Excel or Google Sheets).

License

Notifications You must be signed in to change notification settings

bxxasn/flutter_csv_localization

 
 

Repository files navigation

Flutter localizations generator from CSV files.

Generates a localizations delegate from a CSV file.

Usage

Install globally the tool :

$ pub global activate flutter_csv_localization

CSV

Then run the generator :

$ pub global run flutter_csv_localization:generate -o example.g.dart example.csv

Google Sheet

Make sure that your sheet is shared :

share

Extract from the link the DOCID and SHEETID values : https://docs.google.com/spreadsheets/d/<DOCID>/edit#gid=<SHEETID>) :

Run the command :

$ pub global run flutter_csv_localization:generate -g -o example.g.dart <DOCID>/<SHEETID>

Example

.csv -> .dart

CSV format

The csv file should have :

  • Row
    • Column 0 : "Key"
    • then each supported language code ("en", "fr", ...)
  • Following rows for labels
    • Column 0 : the label key (can be a hierarchy, separated by dots)
    • then each translation based on language code of the column

example

Key,fr,en
dates.weekday.monday,lundi,monday
dates.weekday.tuesday,mardi,tuesday
dates.weekday.wednesday,mercredi,wednesday
dates.weekday.thursday,jeudi,thursday
dates.weekday.friday,vendredi,friday
dates.weekday.saturday,samedi,saturday
dates.weekday.sunday,dimanche,sunday

Roadmap / Ideas

  • Multiple values per label (plural, gender, ...)
  • Native labels (plist, xml, ...)

Why ?

I find the Flutter internationalization tools not really easy to use, and I wanted a simple tool for sharing translations.

About

Generate Flutter localizations from a simple CSV file (exported from Excel or Google Sheets).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 92.7%
  • Java 3.3%
  • Objective-C 3.0%
  • Shell 1.0%