feat: add dynamic params to text #384
Open
+9
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do?
This PR extends the
Text
component to support translation parameters by modifying thetx
prop to accept an object with a translation key and parameters. This allows developers to use dynamic, interpolated values within translations (e.g., inserting names or numbers into strings).Why did you do this?
This change was made to improve the flexibility of the
Text
component, particularly for internationalization. In many cases, translations require dynamic content (e.g., greetings with a user’s name), and this update allows developers to pass those parameters directly through the component. It simplifies the code needed for multi-language support and enhances readability.Who/what does this impact?
This change impacts developers using the
Text
component for localized content, as it enables dynamic translations without requiring custom workarounds. This is especially relevant for teams working on multilingual applications that need flexibility in handling text. It should not introduce any breaking changes to existing functionality, as it maintains backward compatibility with the previoustx
prop type.How did you test this?
Text
component correctly renders static translations as before.