{
"helloWorldOn": "Hello World on {date}",
"@helloWorldOn": {
"description": "A message with a date parameter",
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMd"
}
}
}
}我有两个问题
1-如何扩展格式化程序以添加额外的日历和格式,如jalaali日历的jyjMjd,考虑我想添加额外的格式化程序,我传递了一个DateTime作为参数,格式化程序决定日历
2-如何支持其他type,即我自己定义的类
发布于 2021-10-12 07:05:46
我也有同样的问题。我的解决方案是将格式放在*.arb文件中,并在dart中设置日期的格式。
{
"@@locale": "en",
"dateFormat": "EEEE, MMMM dd",
"dateTimeFormat": "EEEE, MMMM dd, y h:mm a",
"helloWorldOn": "Hello World on {date}",
"@helloWorldOn": {
"description": "A message with a date parameter",
"placeholders": {
"date": {
"type": "String"
}
}
}
}l10n.helloWorldOn(DateFormat(l10n.dateFormat, l10n.localeName).format(DateTime.now().toLocal()))https://stackoverflow.com/questions/69536214
复制相似问题