Repository navigation
Drop the removed synthetic-package option from the flutter-setup-localization skill - #258
ArefMozafari wants to merge 2 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the Flutter localization documentation in SKILL.md to remove references to synthetic-package, which has been removed from Flutter, and updates the configuration and import examples accordingly. Feedback suggests adding a comment to the widget import example to clarify that the relative path may need adjustment depending on the file's location.
| ```dart | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
| import 'l10n/app_localizations.dart'; |
There was a problem hiding this comment.
Since widgets like GreetingWidget are commonly placed in subdirectories (e.g., lib/widgets/greeting_widget.dart), a relative import of l10n/app_localizations.dart will fail to compile unless adjusted. Adding a comment similar to the one in main.dart helps clarify that the relative path may need to be adjusted depending on the file's location.
| import 'l10n/app_localizations.dart'; | |
| import 'l10n/app_localizations.dart'; // Adjust path depending on the widget's file location |
There was a problem hiding this comment.
Good catch, added the same note as the main.dart snippet so the widget example says the path depends on where the file lives.
Task summary
Fixes #239.
skills/flutter-setup-localization/SKILL.mdtells the agent to writesynthetic-package: trueintol10n.yamland to importpackage:flutter_gen/gen_l10n/app_localizations.dart. Synthetic packages have been removed from Flutter, so an agent following the skill on current stable fails at the first generation step:This change drops the option from both
l10n.yamlsnippets and points both imports at the file the tool actually generates, matching the current Flutter i18n docs and the flutter_gen deprecation guide.The lines that carry the change:
arb-dir: lib/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart -synthetic-package: trueScope of work
synthetic-package: truefrom the setup snippet and the completel10n.yamlexample.package:flutter_gen/gen_l10n/app_localizations.dartimports withl10n/app_localizations.dart.arb-dir, oroutput-dirwhen set) and thatsynthetic-packagemust not be set.flutter pub get; it still triggers generation whengenerate: trueis set.Testing instructions
On Flutter 3.47.7 stable, in a fresh
flutter create --emptyproject, follow the skill as now written: addflutter_localizationsandintl, setgenerate: true, create the three-linel10n.yaml, addapp_en.arbandapp_es.arbwith the skill'shelloWorld,hello,nWombatsandpronounmessages, wireMaterialAppand theGreetingWidgetexample with the new import.A widget test that pumps the app finds
Hello World!,Hello Boband1 wombat, and finds¡Hola Mundo!with the platform locale set toes.dart analyze --fatal-infosanddart testintool/generatorpass (101 tests).Screenshots
Not a UI change.
Breaking changes
No. The skill now produces a project that generates on current stable; it did not generate at all before.
Documentation / links
package:flutter_genremoval: https://docs.flutter.dev/to/flutter-gen-deprecation