Flutter 中 FCM 通知的国际化

Internationalization of FCM notifications in Flutter

提问人:Andrey 提问时间:11/11/2023 最后编辑:Andrey 更新时间:11/13/2023 访问量:19

问:

https://firebase.google.com/docs/cloud-messaging/flutter/receive 遵循本教程。

我补充道:string.xmlandroid\app\src\main\res\values

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="accountBlocked">Account blocked</string>
</resources>

我能够在前台的 Flutter 应用程序中获取 RemoteMessage。但是没有键。notification.titleLocKeyaccountBlockedAppLocalizations.of(context)!

我怎样才能从中获得头衔?我应该在我的应用程序中手动下载和处理它吗?string.xml

我看到消息在后台按预期工作(按预期显示标题)。

Flutter 本地化 firebase-cloud-messaging

评论


答:

0赞 Andrey 11/13/2023 #1

我将翻译添加到文件中,然后使用 .我认为这是最有效的方法。.arbAppLocalizations.of(context)!