0

I use localization 2.1.0 (https://pub.dev/packages/localization). I have a file en_US.json:

"home": {
        "welcome text": "This text is in english",
        "my page": "My page"
    }

How to call "welcome text".i18n() from "home" ?

String text = 'welcome text'.i18n(); // home?
print(text) // prints 'This text is in english'

Thanks

Dee Li
  • 1
  • 1
  • this might help https://stackoverflow.com/questions/60915140/flutter-internationalization-how-to-access-to-nested-data-in-json – MrShakila Jun 16 '23 at 03:24
  • Thanks @MrShakila, but I would like find a method for i18n() function. If there's no other way, I'll use yours. – Dee Li Jun 16 '23 at 03:35

0 Answers0