Localization of notifications does not work

855

FCM isn't aware of Flutter. It focuses on the native apps. So for Flutter, this would be the code within the android and ios directories.

If you want to use title_loc_key and body_loc_key, you'll have to add labels to android/app/src/main/res/values/strings.xml on Android. Those are separate from the labels you use within your Flutter code.

Share:
855
Fatima ayaa
Author by

Fatima ayaa

Updated on December 22, 2022

Comments

  • Fatima ayaa
    Fatima ayaa over 1 year

    I want to localize notification , and i find that there is properties for that , like title_loc_key, body_loc_key

    he FCM fields used for localizing (I18N) the notification title and body are not working. For example:

    {
      "android" : {
        "priority" : "normal",
        "notification" : {
          "title_loc_key": "notify_title",
          "body_loc_key": "notify_body"
        }
      }
    }
    

    The FCM documentation states that these fields are used to localize the text in the "app's string resources", but Flutter does not have a res/values/strings.xml file. I am using the flutter_localizations library, and maintain res/values/strings_.arb files as required by Flutter for internationalization, but there is no way for me to tell firebase_messaging to use these resources.

    thank you