Altinn / Altinn/app-frontend-react
Ability to override frontend language with parameters
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description
Even after rewriting the language-system to unify language and text-resources into a common `useLanguage`, language and text-resources in app-frontend are treated differently when it comes to parameters and variables.
- Text-resources can have variables defined next to them in the resource files, that can reference the data model among other things
- Language can have parameters that are injected directly into them from our internal logic
You can now override any language in app-frontend by specifying a text-resource with the same ID, however, since text-resources only look for variables, it cannot make use of parameters that would be injected into the original language reference. So overriding language which makes use of parameters in them will not be able to use those parameters at all.
This is also related to #1723 where we would like to inject parameters into a custom text resource from the backend for validation purposes. The suggested solution in #1723 of:
> One way to accomplish this is to make "parameters" a new data source that can be referenced in variables where you simply specify the index.
Would also be a solution to this issue.
Slack report: https://altinndevops.slack.com/archives/C037GCAHZSS/p1710400113049479
### Additional Information
_No response_
Contributor guide
Research direction
Start at the app-frontend useLanguage implementation and trace how language parameters and text-resource variables are handled. Compare the behavior described in #1723 and the linked Slack report; done means a text-resource override can receive the parameters expected by the original language, including the proposed backend-validation use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, internationalization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100