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
Describe the bug
When I create string in crowdin website with variable {business} inside text it creates arb file with string with such structure
"some_translation": "Discount for {business}"
As it's not structure, crowdin generator makes corrupted class
"some_translation": "Discount for {business}",
"@some_translation": {
"placeholders": {
"business": {
"type": "String"
}
}
},
To Reproduce
Steps to reproduce the behavior:
Latest sdk (0.6.3)
Create arb file:
{
"@@locale": "en",
"some_translation": "Discount for {business}"
}
Generate class with
fvm flutter gen-l10n
fvm dart run crowdin_sdk:gen
Try to run app
See an error
Expected behavior
Generator makes not getter for this string but function with parameter that could be passed into as default intl generates
String some_translation(Object business);
Environment
Crowdin Flutter SDK: 0.6.3
Flutter version: 3.24.1
Dart version: bundled in flutter
Additional context
I'm using crowdin on the web to create strings
The text was updated successfully, but these errors were encountered:
Since in Steps to reproduce you use .arb file with the string without any placeholders - it's expected behaviour that Flutter SDK generates simple getter.
Could you please clarify what do you get in your .arb files from Crowdin website?
For translation with variable in your .arb file you should receive such structure: "some_translation": "Discount for {business}", "@some_translation": { "placeholders": { "business": { "type": "String" } } },
And with such structure Flutter SDK generates function with parameter
@FlutterOd i'm using this placeholder {business}. I know that metadata structure is a preferable way of using vars but flutter can generate func with param from simple placeholder (using intl generation). Is it possible to create string with correct placeholder in crowdin web?
Currently Crowdin doesn't have mechanism to generate structure with placeholders when you add new strings with Crowdin UI.
To manage strings with variables we recommend to add them in your Flutter project .arb file with needed placeholders and then update the source file in Crowdin.
We will consider supporting simple strings with variables (without placeholder structure) on SDK side in the future
@FlutterOd the problem is more on a crowdin package. Because intl_utils supports generating translation with variable even though i don't have metadata property.
Describe the bug
When I create string in crowdin website with variable {business} inside text it creates arb file with string with such structure
"some_translation": "Discount for {business}"
As it's not structure, crowdin generator makes corrupted class
"some_translation": "Discount for {business}",
"@some_translation": {
"placeholders": {
"business": {
"type": "String"
}
}
},
To Reproduce
Steps to reproduce the behavior:
fvm flutter gen-l10n
fvm dart run crowdin_sdk:gen
Expected behavior
Generator makes not getter for this string but function with parameter that could be passed into as default intl generates
String some_translation(Object business);
Environment
Additional context
I'm using crowdin on the web to create strings
The text was updated successfully, but these errors were encountered: