-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Write nested keys as nested objects #418
Write nested keys as nested objects #418
Conversation
66adb74
to
8048ff5
Compare
@TarekkMA sorry that nobody reviewed here. If you are still willing to put work in this, please update your branch (maybe update the readme) and I will review |
@bw-flagship Thank you for your comment, I've changed Input:{
"test1": "a",
"test2": "hello",
"test3": {
"test1": "z",
"test2": {
"test1": "a"
}
},
"test": "اختبار",
"day": {
"zero": "{} يوم",
"one": "{} يوم",
"two": "{} أيام",
"few": "{} أيام",
"many": "{} يوم",
"other": "{} يوم"
}
} Previous output:// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart
abstract class LocaleKeys {
static const test1 = 'test1';
static const test2 = 'test2';
static const test3_test1 = 'test3.test1';
static const test3_test2_test1 = 'test3.test2.test1';
static const test3_test2 = 'test3.test2';
static const test3 = 'test3';
static const test = 'test';
static const day = 'day';
} New output:// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart
abstract class LocaleKeys {
static const test1 = 'test1';
static const test2 = 'test2';
static const test3 = _test3();
static const test = 'test';
static const day = 'day';
}
class _test3 {
const _test3();
String get key => 'test3';
@override
String toString() => 'test3';
final test1 = 'test3.test1';
final test2 = const _test3_test2();
}
class _test3_test2 {
const _test3_test2();
String get key => 'test3.test2';
@override
String toString() => 'test3.test2';
final test1 = 'test3.test2.test1';
} |
@TarekkMA Thanks for updating the branch and explaining the idea. However, it is a huge breaking change because people would need to switch from
to
For my apps, it would be thousands of changes. I would suggest to "save" it for the next big version (4.0.0) and document the breaking change properly then. |
I agree this is a breaking change; we need to have it in v4, and I can explore if I can write a simple migration tool, so moving to it would be a minimal manual change. |
@aissat I created the branch future-releases/v4.0. There we can keep approved features that are too breaking to release them in 3.0. This way, people can use those features already if they want via github references in pubspec.yml. |
@TarekkMA It seems like there are some linter problems that prevent a merge. Also, could you add a small section in the changelog to describe migrating to the new style? |
1b3e300
into
aissat:future-releases/v4.0
Fixes: #390
I had to add a method that gets the object value
String val() => 'gender';
to get around the previous behavior where gender/plural objects has other objects inside also.I'm open to any changes.