delay / flutter_starter

MIT License
422 stars 146 forks source link

update_localizations.dart File #20

Closed HussainON closed 3 years ago

HussainON commented 3 years ago

I'm carious about how update_localizations.dart file works. is the localization.g.dart file auto-generated? If so, how is it generated since build_runner package isn't used in this project. Because I want to use my own google translate sheet. Do I just manually write the localizations.g.dart file?

update_localizations.dart: https://github.com/delay/flutter_starter/blob/master/lib/helpers/update_localizations.dart localization.g.dart: https://github.com/delay/flutter_starter/blob/master/lib/helpers/localization.g.dart

delay commented 3 years ago

It runs from the command line. It is basically a completely separate app self contained. It does not use the build_runner package.

To handle the language translation you need to create a translation for your app in google sheets. Then open /helpers/update_localizations.dart and replace the docID and sheetId with your own documentId and sheetId. After doing that your will need to drop to the command line and go into the helpers directory. Then type: dart update_localizations.dart. This will create or overwrite the localization.g.dart file with your custom translation. There should not be a need to edit this file directly. Everytime you make changes to your translation you will need to re-run this generator.