我试图省略将名称和参数传递到Intl.message
. Intl
文档表明,提供了一个转换器,可以自动为您插入这些参数。
所以我添加了以下内容pubspec.yaml
:
dev_dependencies:
intl_translation: ^0.17.3
transformers:
- intl_translation:
$include: lib/localization.dart
在我的localization.dart
我有以下方法:
class AppLocalizations {
...
String greetingMessage(String name) => Intl.message(
"Hello $name!",
desc: "Greet the user as they first open the application",
examples: const {'name': "Emily"});
}
当我运行时flutter pub pub run intl_translation:extract_to_arb --output-dir=strings lib/localization.dart
,出现以下错误:
<Intl.message("Hello $name!", desc: "Greet the user as they first open the application", examples: const {'name' : "Emily"})>
reason: The 'args' argument for Intl.message must be specified for messages with parameters. Consider using rewrite_intl_messages.dart
我怎样才能启用那个变压器?