Open JSBmanD opened 1 week ago
Hi @JSBmanD
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?
@JSBmanD
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:
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