Hello,
Why such refactor was done? I think it's regression, because it's not about Widget to be translated but String itself. For example:
Previous
AppLocalizations.of(context).tr("title")
Current
Text("title").tr()
Works well. However if we go to other widget, such InputDecoration which takes argument as a String but not widget - Localization will fail.
Previous
InputDecoration(labelText: AppLocalizations.of(context).tr("someText"))
Current
InputDecoration(labelText: ???)
I think decision to move to widget level rather than string itself is not correct. Because one has to make sure lowest level is triggered - in this case String. And we shouldn't manipulate any widgets for it.
Looking forward for fix. And in the meanwhile I have to use <1.4.0 version.
thnx @zeromaro
Previous
AppLocalizations.of(context).tr("title")
Current
Text("title").tr() or can use Text(tr("title"))
Previous
InputDecoration(labelText: AppLocalizations.of(context).tr("someText"))
Current
InputDecoration(labelText: tr("someText"))
// or u can use this
InputDecoration(labelText: "someText".tr())
new update 1.4.1 @zeromaro now u can use tr() on Strings Example usage:
// after 1.4.1
Text('title'.tr()),
InputDecoration(labelText: "someText".tr())
facing same issue , InputDecoration(labelText: "someText".tr()) didn't work for change language , I using 2.3.3
@callmejm it works without const before InputDecoration(labelText: "someText".tr()). Maybe it help you