- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我正在使用 intl 包将我的应用程序翻译成西类牙语。
locales.dart
class AppLocale {
...
String get folder => Intl.message("Folder", name: 'folder');
...
}
messages_es.dart
class MessageLookup extends MessageLookupByLibrary {
get localeName => 'es';
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"folder": MessageLookupByLibrary.simpleMessage("Carpeta"),
};
}
我使用以下代码调用它:
AppLocale.of(context).folder
它工作正常。
但是,我需要创建“动态”字符串。例如:
“嗨,{$name}”
然后我会调用这个字符串,将这个“名称”作为参数传递,或者类似的东西。用西类牙语翻译为“Hola,{$name}”。
可以使用这个国际包吗?
最佳答案
如果您关注 official internationalization docs并在 .arb
文件中指定所有短语,您可以执行以下参数:
{
"greeting": "Hi, {name}!",
"@greeting": {
"description": "Greet the user by their name.",
"placeholders": {
"name": {
"type": "String",
"example": "Jane"
}
}
}
}
当你编译你的代码时,会为你生成一个类似下面的函数,并带有一个很好的 docbloc 来支持你的 IDE 工具提示:
/// Greet the user by their name.
///
/// In en, this message translates to:
/// **'Hi, {name}!'**
String greeting(String name);
所以你可以像这样使用它:
Text(AppLocalizations.of(context)!.greeting("Koos"))
关于internationalization - Flutter 国际化 - 动态字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52278035/
我有一个 Java 字符串,但在处理时遇到了问题。我有一个字符串 s,它的值为丞(我随机选择的一个汉字,我不会说中文)。如果我打电话 String t = new String(s.getBytes(
在Qt中,所有的输入部件和文本绘制方式对Qt支持的所有语言都提供了内置的支持。Qt内置的字体引擎可以在同一时间正确而且精细地绘制不同的文本,这些文本可以包含来自众多不同书写系统的字符。如果想了解更多的
如何实现字段标签、帮助文本等的国际化支持。字段的标准乘法似乎不起作用例如文档中给出的用于创建联系表单的示例。我尝试为其他语言添加额外的字段(文档中描述的第一种方法) from django.db
是否有可能当我在操作类中使用“getText(”keyName”); 时,我可以指定仅从 ENGLISH 资源包中选择值。因为我只想将此值用于日志记录目的。 任何想法我怎么能做到这一点? BR 标准委
我有一些关于 GWT 的国际化解决方法的问题。 1) 处理直接写入 ui.xml 文件的静态文本的最佳方式是什么? 目前,我正在使用 Messages-Interface 来翻译 Java 生成的文本
我在 Symfony 2 中遇到了一个奇怪的翻译问题。 这是我的config.yml imports: - { resource: parameters.yml } - { resou
对于我的大部分应用程序,我可以使用 https://developers.google.com/web-toolkit/doc/latest/DevGuideI18n 中列出的推荐国际化技术。 (主要
我使用 Android Studio 创建了一个新的 Flutter 项目。我正在使用null-safety,并且正在物理设备上运行应用程序,但代码生成无法正常工作,没有flutter_gen.dar
这里是菜鸟。 我正在尝试对基于命令行的程序实现国际化。以下是 java 国际化路径中可用的内容。 import java.util.*; public class I18NSample { s
我使用 Android Studio 创建了一个新的 Flutter 项目。我正在使用null-safety,并且正在物理设备上运行应用程序,但代码生成无法正常工作,没有flutter_gen.dar
我正在开发一个需要多语言的应用程序。 我正在尝试关注 this国际化教程。但是,当我尝试“使用基本国际化”时, View 中没有列出我的 Storyboard。 我正在使用 XCode 4.6.3 我
我住在印度(有超过20种语言)我正在尝试在网站中实现java国际化。 但是在 Locale.getAvailableLocales() 中,本地语言不可用。我的情况是否可以实现国际化? 如果可能的话字
我有以下 SDN 4 实体: 决策、特征和值: @NodeEntity public class Value { private final static String SET_FOR = "
关于MySql,是否有支持所有或绝大多数语言的字符集? 最佳答案 统一码。它有几种编码:UTF-8、UTF-16 和 UTF-32。 来自 http://en.wikipedia.org/wiki/U
我目前正在使用 Vuepress。但是我想要在我的 Vuepress 站点中使用多种语言。经过 3 天的挣扎,我决定把我的问题放在这里。 (是的,我查看了 Vuepress 文档:https://vu
我需要返回一个 strftime() 调用,该调用使用与我本地机器/操作系统上设置的语言不同的语言。是否可以选择返回语言? 最佳答案 对于可靠的 i18n/L10N,可由必须在同一运行中提供不同本地化
我有一些按钮,按下它们后我想播放一些音频。按钮的名称是音频文件的名称 private func playAudio(title : String){ audioPlayer = AVAudio
如何更改 HTML5 的消息(或者它会根据浏览器的语言自动更改?) 例如: E-mail: 当我在 Opera 运行此代码(来自 W3schools)
我发现很多关于 url schemes 的话题,最常见的是: www.mysite.com/fr/products www.mysite.com/en/products www.mysite.com/
在 Android WebView 中处理国际化/本地化的最佳方式是什么。理想情况下,我想访问以下位置的所有字符串资源: res/values/strings.xmlres/values-de/str
我是一名优秀的程序员,十分优秀!