Flutter中FCM通知的国际化

jgwigjjp  于 6个月前  发布在  Flutter
关注(0)|答案(1)|浏览(79)

我遵循这个教程https://firebase.google.com/docs/cloud-messaging/flutter/receive
string.xml添加到android\app\src\main\res\values

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

字符串
我可以在前台使用右notification.titleLocKey在Flutter应用程序中获取RemoteMessage。但是在AppLocalizations.of(context)!中没有accountBlocked键。
我如何从中获取标题?我应该手动下载string.xml并在应用程序中处理它吗?
我看到消息在后台按预期工作(显示标题)。

axkjgtzd

axkjgtzd1#

我将翻译添加到.arb文件中,然后使用AppLocalizations.of(context)!访问相应的密钥。我认为这是最有效的方法。

相关问题