Keep the nested structure when the LocaleKeys are generated
Let's say I have this en.json file:
{
"project": {
"name" : "project name",
"date": "project date"
},
"user": {
"name": "user name",
"age": "age",
}
}
Right now, running flutter pub run easy_localization:generate -f keys -o locale_keys.g.dart to generate the keys will flatten the nested structure and generate:
LocaleKeys.project_name;
LocaleKeys.project_date;
LocaleKeys.user_name;
LocaleKeys.user_age;
It would be nice if it could keep the nested structure and generate nested objects:
LocaleKeys.project.name;
LocaleKeys.project.date;
LocaleKeys.user.name;
LocaleKeys.user.age;
Hello @aissat, is it an acceptable proposition? I'm willing to spend some time and contribute to make it available if you validate this request.
@ValentinVignal i think it's god idea. PR welcom 😉
@ValentinVignal are you working on this? If not I can give it a try.
@TarekkMA Not yet, I have been quite busy recently.
@Overman775 right now LocalKeys.project_name and the other are all const. Would It be okay to not make the nested object const:
LocalKeys.project.name;
would not be a const anymore, is that fine?
@ValentinVignal take a look at my PR #418, I've managed to make nested objects private and const.
Your feedback is most appreciated.
This idea is very useful!
any idea if this will be merged into the project anytime soon?