how to replace some string from outside in json file

106

I solved with format package in pub dev (it's the same as python's format funct.)

Share:
106
alperefesahin
Author by

alperefesahin

Updated on January 04, 2023

Comments

  • alperefesahin
    alperefesahin 5 months

    I have a localization map like:

      'en': {
        "timeIsUpTitle": "Time is Up!",
    
        "workingTimeText": "You are working for{{}} {{}} {{}}.."
      },
      'tr': {
        'timeIsUpTitle': 'Zaman doldu!',
    
        "workingTimeText": "{}{}{}çalışıyorsun..."
      },
    

    how can I fill these {} sections on the outside? I have some getters for these strings such as,

      String  workingTimeText(String hours, String minutes, String seconds) => localeValues['workingTimeText']!;
    
      String get timeIsUpTitle => localeValues['timeIsUpTitle']!;