dart - 国际化 Fluter by intl
问题描述
我学会了颤振。我使用 intl 依赖项构建了一个国际化应用程序(遵循此)
- 我很好地运行了第一个命令(没有错误消息):
flutter packages pub run intl_translation:extract_to_arb --output-dir=lib/l10n lib/main.dart
生成了 3 个文件:
我需要在运行下一个命令之前创建 intl_{locale}.arb 文件。
下一个命令:
颤振包发布运行 intl_translation:generate_from_arb \ --output-dir=lib/l10n --no-use-deferred-loading \ lib/main.dart lib/l10n/intl_*.arb
尽管生成了相应的消息(messages_en.dart)文件,但它始终返回消息:
No @@locale or _locale field found in intl_en, assuming 'en' based on the file name.
No @@locale or _locale field found in intl_messages, assuming 'messages' based on the file name.
如何在没有消息的情况下运行第二个命令,因为我认为它们是意外消息?
解决方案
You should write in each file the following. Then flutter will automatically identify the language.
{
"@@locale": "en",
"title": "Flutter Example App",
"@title": {
"type": "text",
"placeholders": {}
}
}
推荐阅读
- bash - bash 变量的远程命令后跟 if 语句,但输出读取不正确?
- flutter - 文本字段焦点触发 UI 的重建
- android - 执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障
- java - OSX Catalina 以管理员权限打破了 osascript 启动
- python - 按索引和列排序
- android - 如何通过使用带有子元素的Scrollview将底部导航保持在底部是LinearLayout作为根
- python - 这个脚本运行良好,直到他停下来并显示错误
- c++ - 双模板对象
- c# - 如何将 f(x) = sin(x)*sin(x) 函数拟合到您的数据中?
- python-3.x - 如何在图像 JtessBoxEditor 上创建框?