A new Flutter project.
Important: Add an issue first and only then a PR linked to to the issue. So we can track changes easier.
Localization is driven through AppLocalizations autogenerated class which contains the current locale and text translations.
final localeName = AppLocalizations.of(context).localeName;
final intl.DateFormat dateFormat = intl.DateFormat("E, d.MMM", localeName);
final intl.NumberFormat relativeDeltaFormat = intl.NumberFormat("#,##0.0", localeName);
...
final String title = AppLocalizations.of(context).title;
Texts are defined in .arb
files under lib/l10n
directory. Base file is app_en.arb
.
Translations can also be done through Weblate. Current translation status:
Important: All app texts, number and date formats should be localized, no hardcoded values are allowed.
Based on Generating Dart REST API client libraries using OpenAPI Generator article.
Import OpenApi into https://editor.swagger.io/#/ (File/Import from URL), export it to sledilnik_api\sledilnik_api.yaml.
Before generating/updating library, make sure you have downloaded the generator to the sledilnik_api root directory.
Also add environment variable DART_POST_PROCESS_FILE that points to dartfmt -w
, sample: D:\Utilities\flutter\bin\cache\dart-sdk\bin\dartfmt.bat -w
.
Commands to generate:
java -jar openapi-generator-cli.jar generate -i .\sledilnik_api.yaml -g dart-dio-next -c open-generator-config.yaml --enable-post-process-file
flutter pub run build_runner build
Due to some problems with openapi-generator dart-dio[-next] Date handling, autogenerated type Date in sledilnik_api/src/models/date.dart has to be manually augmented with method
void replace(Date newValue) {
year = newValue.year;
month = newValue.month;
day = newValue.day;
}
for the time being. Also remove final decoration on all three properties.