The package intl
exists to localize the flutter application but the Intl.message
only returns String
How can I have a rich content localization?
Hello $name!
, and make only $name
bold, Consider that the order of hello and $name can be different in different languagesI read terms of services and accepted it
, and link only terms of services
partin [TEXT_INPUT] days
, the [TEXT_INPUT] has a text after and a text before, but in some languages there is no 2 text, just one text after or before, or days
is before and in
is after [TEXT_INPUT]
The slang package has built-in rich text support.
It will look like this:
{
"myRichText(rich)": "Welcome {name}"
}
Widget a = Text.rich(t.myRichText(
// Show name in blue color
name: TextSpan(text: 'Tom', style: TextStyle(color: Colors.blue)),
));