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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature : Interpolate Strings #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Suryac72
Copy link
Contributor

@Suryac72 Suryac72 commented Oct 5, 2023

Description: Added a function to replace string inside { } with dynamic field values.

Use-case: This method helps when we use language translation in our application and want to replace dynamic values in our translated message

Example : Hello {name}, your age is {age}
Output: Hello John Doe, your age is 30.

@Suryac72
Copy link
Contributor Author

Hi @appgurueu @raklaptudirm please review this PR also once you free

Copy link
Contributor

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this does what it says on the tin the way it should be done (using regex replace and a dict, with proper tests and doc comments). It's fine in that regard.

What I'm concerned about however is this being more of a typical JS "programming" problem than an "algorithm" problem, so I'm not sure whether an algorithm repo is a good fit for it.

@Suryac72
Copy link
Contributor Author

Hi @appgurueu, I used this algo for injecting dynamic text in my email and messaging notifications usecase in my current project. This helps when our message is dependent on more than one language translations so that we can inject user details in our messages and email template translations.

this was the reason I contribute this small approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants