Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
401 stars 118 forks source link

Support to retrieve lists and maps #117

Closed windmillcode0 closed 5 months ago

windmillcode0 commented 5 months ago

There is use case to retrieve list and map and work with sequence values of data for example

    List<dynamic> yourDataOptions =
        getValueAtKeyPath("AccountOverviewZero.yourDataOptions");
    return List.generate(yourDataOptions.length, (index) {
      return [
        DashboardCtrlZeroWidget(
          title: translate("AccountOverviewZero.yourDataOptions.$index.title"),
          desc: translate("AccountOverviewZero.yourDataOptions.$index.desc"),
      List<dynamic> navOptions = getValueAtKeyPath("global.langAbbreviations");
      final wmlNav = ref.watch(WMLNavRiverpodProvider);

      return ListView.builder(
          itemCount: navOptions.length + 1,
          itemBuilder: (context, index0) {
            final wmlSpacing = ref.read(WMLSpacingRiverpodProvider);
            if (index0 == 0) {
              return Padding(
                padding: EdgeInsets.all(wmlSpacing.medium),
                child: Row(
                  children: [
                    ButtonZeroWidget(
                        onPressed: () {
                          final rp = ref.read(DefaultLayoutRiverpodProvider);
                          ref
                              .read(DefaultLayoutRiverpodProvider.notifier)
                              .updateCurrentDrawer(rp.drawers[0]);
                        },
                        child: translate("global.back")),
                  ],
                ),
              );
            } else {
              int index1 = index0 - 1;
              return ListTile(
                title: Text(translate("global.langAbbreviations.$index1")),
                onTap: () async {
bratan commented 5 months ago

Thanks for your submission.

To add new features, please use the v5.0 branch.

Additionally, could you please include documentation and tests.

windmillcode0 commented 5 months ago

I dont understand merge into the v5.0 branch or have my changes come from the v5.0 branch?. In addition can you make a contributing.md guide For the test cases can you see if another of your cointributors can complete what is necessary

For the unit tests I see you do not have tests so I did not know where to start where are the test cases to update?

bratan commented 5 months ago
I dont understand merge into the v5.0 branch or have my changes come from the v5.0 branch?.

Both basically - you should base your changes on the v5.0 and submit the pull request for the same branch, as I don't plan to add features to the current version.

However, I first suggest you start a discussion here with your proposal for the feature and implementation.

I'm planning to create a contributing guide in the next days/weeks.

For the unit tests I see you do not have tests so I did not know where to start where are the test cases to update?

There are no tests right now, Planning to include them in v5 but have no time to focus on this at the moment.

Judimax commented 5 months ago

Ask chat gpt u have simple enough code at least for documentation. Test cases should do the trick. I'll give u the prompts and scripts shortly