slang-i18n / slang

Type-safe i18n for Dart and Flutter
https://pub.dev/packages/slang
MIT License
459 stars 39 forks source link

[Question] RichText feature #190

Closed sed1ka closed 8 months ago

sed1ka commented 8 months ago

Hi! Nice lib. I wondering about the RichText feature. based on the doc, I understand that the feature will look like this example below when implemented.

app.l10n.yaml

contactUs: Contact Us
helpDescription(rich): $helpButton if you have questions # wondering to set the default value of helpButton parameters with contactUs value

UI

Text.rich(
  t.helpDescription(
    helpButton: TextSpan(
      text: t.contactUs,
      style: TextStyle(
        color: Colors.blue, 
        fontWeight: FontWeight.bold,
      ),
    ), 
  ),
  style: TextStyle(color: Colors.black),
),

Question: Can I just set the contactUs as default value of existing $helpButton parameters in helpDescription ?

Expected: I just need to separate a word/sentences with different TextStyle but without needing to pass values to parameters. Something like:

contactUs: Contact Us
helpDescription(rich): $(helpButton(@:contactUs)} if you have questions