crowdin / crowdin/flutter-sdk

Crowdin package doesn't handle parameters correctly

Open
#61 4 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Dart
Stars
37
Forks
14
Avg merge
20m
Merged PRs (30d)
2

Description

**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"
}
}
},
image

**To Reproduce**
Steps to reproduce the behavior:
1. Latest sdk (0.6.3)
2. Create arb file:
```
{
"@@locale": "en",
"some_translation": "Discount for {business}"
}
```
3. Generate class with
fvm flutter gen-l10n
fvm dart run crowdin_sdk:gen
4. Try to run app
5. 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

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the supplied ARB content, Flutter 3.24.1, and the commands fvm flutter gen-l10n and fvm dart run crowdin_sdk:gen. Inspect the generator entry point used by the latter command; done means the generated localization API accepts business as a parameter instead of producing a getter that causes the app to fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.