You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"niceList": [
"hello",
"nice",
[
"first item in nested list",
"second item in nested list"
],
{
"wow": "WOW!",
"ok": "OK!"
},
{
"a map entry": "access via key",
"another entry": "access via second key"
}
]
}
when dart run slang is run to generate translations I get
// **THIS WORKS AS INTENDED**
class Translations$niceList$0i4$$niceList$0i3$EnIn {
Translations$niceList$0i4$$niceList$0i3$EnIn.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
String get wow => 'WOW!';
String get ok => 'OK!';
}
// THIS IS GENERATAED AS THE SAME AS SINGLE WORD
class Translations$niceList$0i4$$niceList$0i4$EnIn {
Translations$niceList$0i4$$niceList$0i4$EnIn.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
String get a map entry => 'access via key'; // ERROR
String get another entry => 'access via second key'; // ERROR
}
With symbols, "ok!!": "OK!" also generates String get ok!! => 'OK!'; and causes error.
When used with (map), works well
"a(map)":{
"a map entry1": "access via key",
"another entry1": "access via second key",
"ok!!": "OK!"
}
Manual Fix:
uncomment all errors and its classes and add map manually. (works for simple cases and needs to be done again when code is generated afterwards)
Translations$niceList$0i3$EnIn.internal(_root),
// Translations$niceList$0i4$EnIn.internal(_root),
{
"a map entry": "access via key",
"another entry": "access via second key"
}
Recommend to change the README.md with working examples.
The text was updated successfully, but these errors were encountered:
Using example from README.md
when
dart run slang
is run to generate translations I getWith symbols,
"ok!!": "OK!"
also generatesString get ok!! => 'OK!';
and causes error.When used with
(map)
, works wellManual Fix:
uncomment all errors and its classes and add map manually. (works for simple cases and needs to be done again when code is generated afterwards)
Recommend to change the README.md with working examples.
The text was updated successfully, but these errors were encountered: