Altinn / Altinn/app-frontend-react
Add formatting to key-references in resource-files
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description
We would like to be able to format values from a data field directly in the resource-files. This would give a simple way to get f.ex. thousand separator or comma when showing a numeric value, instead of having to concat several texts each time we need formatted text in the middle of a sentence. This would also make translation easier.
I imagine this could look something like this:
```
{
"id": "lang.info.fra.prefill",
"value": "Ved forrige innrapportering oppga dere å ha dyrket totalt {0} kvadratmeter bambus.",
"variables": [
{
"key": "Prefill.kvadratmeterbambus",
"dataSource": "dataModel.A3_RA-0775_M",
"formatting": {
"number": {
"decimalScale": 0,
"thousandSeparator": " "
}
}
}
]
}
```
Formatting f.ex. dates in a similar fashion would also be useful.
### Additional Information
Related: [https://github.com/Altinn/app-frontend-react/issues/1305](url)
Contributor guide
Research direction
Start by tracing how key references are handled in resource-files, then review the related app-frontend-react issue #1305. Done means values from a data field can receive the requested number formatting in a resource-file reference; date formatting is also identified as a related consideration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, localization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100