Closed adil192 closed 1 year ago
Hi @adil192
a temporary workaround is to use normal objects. To make each of your q-a pair reusable, you can use "interfaces".
"faq(interface=FaqModel)": {
"nextcloud": {
"q": "What is Nextcloud?",
"a": "Nextcloud is a..."
},
"encryptionPassword": {
"q": "What is the encryption password?",
"a": "..."
}
}
Then you can create a widget that needs a FaqModel
as constructor parameter.
List(
children: [
FaqItem(t.faq.nextcloud),
FaqItem(t.faq.encryptionPassword),
// ...
],
);
One drawback of this workaround is that you cannot iterate anymore.
For that I'd need to manually edit every translation file, so just catching the missing translations in PR reviews seems easier. I'm happy to implement one of the above solutions (I prefer # 3) if you want me to btw :)
The "outdated" flag should be ok in most use cases.
The problem I still see is that sometimes the lists have different lengths on purpose. Maybe there needs to be another flag to tell slang analyze
that it is ok that the list have different lengths.
Yes the "outdated" flag works for me, I'm happy to close this issue if you are
Alright!
Motivation For my app Saber I have a list (array) of FAQ questions and answers. When I add more things to this list, the changes aren't reflected in the missing translations file.
Developer Experience Running
flutter pub run slang analyze
should include lists in the missing translations file. This could be one of:Add both translations to the list and expect the translator to delete the duplicates. We could benefit from a check when running
slang apply
that the list length <= the original translation's list length.