If statement in .arb files

392 Views Asked by At

I have a problem with my mobile application. I developed my application with flutter and implemented Flutter Internationalization. After creating files with .arb extension I wanted to be able to choose the file by platform ( IOS or Android ) as well as language . Is it possible to use an If statement in the files with .arb extension? Are there any solutions for this problem of mine?

2

There are 2 best solutions below

0
On

You can put that condition in dart file also.

For ex., Platform.isAndroid ? "Localization string 1" : "Localization string 2"

0
On

Just do that in your dart file, like this:

child: Platform.isAndroid 
  ? Text(AppLocalizations.of(context)!.stringForAndroid) 
  : Text(AppLocalizations.of(context)!.otherString)