Closed yagmure15 closed 5 months ago
You will need to remove the whole context node. Currently, each language is generated separately from each other, so "ro" does not know what strings in "en" exist.
Another issue is that fallback works by using the extension behavior of Dart classes. There is currently no easy way to represent inheritance within a function.
The context node is very useful for us; the slang library is one of the reasons we prefer it. Otherwise, the code becomes more complicated. The likelihood of encountering the situation in the second example is very high, and in that case, the application crashes. At the very least, to prevent the application from crashing, a default "" (empty string) can be provided in the string.g.dart file.
string.g.dart file
.
.
.
@override
String sections({required Sections sections}) {
switch (sections) {
case Sections.deviceInfo:
return 'Informații dispozitiv';
case Sections.identification:
return 'Identificare';
case Sections.notes:
return 'Note';
case Sections.purchaseInfo:
return 'Informații achiziție';
default:
return '';
}
}
.
.
.
Even in this case, I will have to find the empty value in the generated files and process it. I am considering replacing "" (the empty values) with an expression like "untranslated key -> $keyvalue." That's the general situation. What do you think? Is there another way?
Im having the same issue. Any plans on handling this case?
Fixed in v3.29.0
Describe the bug I would like to sincerely thank you for the development of base_locale_empty_string. Here, I have made the necessary additions in the English JSON file. I'm also adding other languages as 'empty' just like in the examples. This way, the person doing the translations understands that they need to translate it. When I initially send the section parts like in the first example, there's no problem. However, when the translator translates some parts and not others in the second example, it becomes an issue.
Example 1 strings_en.i18n.json
strings_ro.i18n.json
Example 2 strings_en.i18n.json
strings_ro.i18n.json
Error Message Failed to build iOS app Error (Xcode): lib/translations/strings.g.dart:3819:11: Error: The type 'Sections' is not exhaustively matched by the switch cases since it doesn't match 'Sections.information'.