Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typesafe Interpolation Variables #1897

Closed
CreativeTechGuy opened this issue Jan 3, 2023 · 16 comments
Closed

Typesafe Interpolation Variables #1897

CreativeTechGuy opened this issue Jan 3, 2023 · 16 comments
Assignees

Comments

@CreativeTechGuy
Copy link

馃殌 Feature Proposal

Enable opt-in typesafe interpolation variables. Given that the user is already using #1504, this will add additional intellisense based on the contents of the string, finding any variable placeholders and requiring values to be passed for each.

Motivation

It's easy to miss passing required interpolation variables when translating a string. This will ensure that developers get both real-time Type errors and auto complete for variable names to avoid mistakes at runtime.

Example

Example TypeScript sandbox. I wrote this code to make typesafe URL path variables and realized it could be used with very minor tweaks here too. It'd be amazing if this could be integrated into the core library.

Notes

  • I know the variable placeholders can be extremely complex. This feature would only be usable for those with simple placeholders ({{name}}) and nothing more. As a result, it needs to be opt-in as it won't work for everyone. I believe this is still valuable as simple placeholders covers a majority of users.
@stale
Copy link

stale bot commented Jan 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 17, 2023
@CreativeTechGuy
Copy link
Author

Not stale

@stale
Copy link

stale bot commented Feb 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 18, 2023
@CreativeTechGuy
Copy link
Author

Still not stale

@stale stale bot removed the stale label Feb 19, 2023
@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 18, 2023
@CreativeTechGuy
Copy link
Author

Not stale

@stale stale bot removed the stale label Mar 18, 2023
@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 2, 2023
@CreativeTechGuy
Copy link
Author

Still not stale

@stale stale bot removed the stale label Apr 2, 2023
@stale
Copy link

stale bot commented May 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 4, 2023
@CreativeTechGuy
Copy link
Author

Not stale

@stale stale bot removed the stale label May 4, 2023
@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@CreativeTechGuy
Copy link
Author

Not stale

@adrai adrai removed the stale label May 24, 2023
@Lesik
Copy link

Lesik commented Jun 8, 2023

Resolved by #1911?

@adrai
Copy link
Member

adrai commented Jun 12, 2023

@CreativeTechGuy @Lesik you might want to help here: #1911 (comment)

@adrai
Copy link
Member

adrai commented Jun 15, 2023

Please try with i18next v23.0.1 and react-i18next v13.0.0

@adrai
Copy link
Member

adrai commented Jun 21, 2023

@adrai adrai closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants