sheets_i18n 0.0.1+3 copy "sheets_i18n: ^0.0.1+3" to clipboard
sheets_i18n: ^0.0.1+3 copied to clipboard

A flutter tool to synchronize i18n (internationalization) arb files with google sheets.

sheets_i18n #

A flutter tool to synchronize i18n (internationalization) arb files with google sheets.

Usage #

1. Prepare a Google Sheet Document #

Screenshot 2024-09-23 at 09 45 39

You can get the sample here: docs.google.com

It should look like this:

  • the first column is the message key (used to lookup the translation in the app).

  • the columns after that are the language codes.

  • the rows are for each specific translated word/sentence.

  • copy the sheet ID: https://docs.google.com/spreadsheets/d/THIS PART OF THE URL/edit?pli=1&gid=0#gid=0

2. Configure a service account #

  1. Create a new service account in the Google Cloud Console
  2. Turn on the Google Sheets API
  3. Copy the service account's email address
  4. Share the google sheet with the service account and give it edit privileges Screenshot 2024-09-23 at 09 49 49
  5. Download the service account JSON (it's local path will later be added to the pubspec configuration)

⚠️ DO NOT COMMIT YOUR SERVICE ACCOUNT JSON ⚠️

3. Prerequisites with intl_translation #

  1. Having setup intl_translation, incl. a MyAppLocalizations and MyAppLocalizationsDelegate class
  2. Having run the intl_translation commands to generate the arb files github.com/dart-lang/i18n

4. Install this package #

flutter pub add sheets_i18n

5. Configure the pubspec.yaml #

add this section:

sheets_i18n:
  service_account_path: ./service_account.json
  sheet_id: 34tv34rv324rv23rv3r43r43red89f8hs89duzfs

6. Run the sync script #

flutter pub run sheets_i18n:update

This will 2-way-sync all the changes:

  • message keys that are not present in the Google Sheet will be added
  • new translations will be pulled and written to the arb files

7. Run intl_translation's arb to dart #

Run the intl_translation commands to generate the dart code from the arb files github.com/dart-lang/i18n

4
likes
0
points
80
downloads

Publisher

verified publisherscalabs.de

Weekly Downloads

A flutter tool to synchronize i18n (internationalization) arb files with google sheets.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

gsheets, intl, intl_translation, yaml

More

Packages that depend on sheets_i18n