【发布时间】:2019-04-27 15:08:29
【问题描述】:
当我运行flutter pub pub run intl_translation:extract_to_arb --output-dir=lib/l10n lib/localizations.dart 时,生成器会跳过所有仅包含字符串的 Intl.message 文件,打印:
Skipping invalid Intl.message invocation
<Intl.message("MESSAGE")>
reason: The 'args' argument for Intl.message must be specified for messages with parameters. Consider using rewrite_intl_messages.dart
from lib/main.dart line: 125, column: 9
doc for the internationalization package 表示 The name and args parameters must match the name (or ClassName_methodName) and arguments list of the function respectively. For messages without parameters, both of these can be omitted. 但在我看来,在这种情况下,我的消息没有参数!
我是否误解了 Dart 开发人员所说的参数是什么意思?
【问题讨论】:
-
你没有误会。那应该行得通。您的包含消息是否也没有参数?这些也必须匹配。这是我唯一能想到的事。或者你可以提供一个失败的例子。
-
@AlanKnight 包含的消息是什么?
-
包含函数
-
@AlanKnight 你是对的。它位于 AndroidNotificationDetails 的构造函数中,这是一个来自第三方库的对象,位于 main.dart 中。这里的最佳做法是什么?指定 args,将消息移出构造函数还是完全其他?
-
您是否忘记将参数添加到方法
Intl.message(...)的args参数中?我遇到了同样的问题,现在如果我将字符串参数传递给args参数(它采用List<String>),它就可以工作。希望对您有所帮助。
标签: dart flutter internationalization flutter-dependencies