smartnsoft / FlappyTranslator

A tool which automatically generates Flutter localization resources from CSV and Excel files.
MIT License
58 stars 19 forks source link

bugfix/correct behavior for variables with name text #33

Closed xalanq closed 4 years ago

xalanq commented 4 years ago

text is really common and it should not be a temporary value's name.

E.g.

in csv

test,for testing %text$s

plugin will generate the codes like

static String test({
    @required String text,
  }) {
    String text = getText("test");
    if (text != null) {
      text = text.replaceAll("%text\$s", text);
    }
    return text;
  }

It will get a wrong string for testing for testing %text$s when call the test method

defuncart commented 4 years ago

Hi @xalanq, thanks for using flappy_translator, spotting this issue and opening a PR! I will take a look tomorrow, seems like a good improvement :)

defuncart commented 4 years ago

Hi @xalanq. Can you run 'flutter pub run flappy_translatorin example folder and pushi18n.dart`? Then PR will be ready to be merged 🥳 You may need to pull upstream master into your fork as I just updated the example project to be compatible with newer versions of flutter.

xalanq commented 4 years ago

Sorry for the late reply. I've merged the upstream/master and generated i18n.dart, plz check it!

defuncart commented 4 years ago

@xalanq Once again thank you very much for your contribution. This fix will be part of version 1.5.0 which I hope to release over the weekend/next week.