You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything is really cool and I'm glad that I found such a library, so thank you very much.
The only thing I'm missing is a kind of post-processing of the translation, which is what I mean.
I have translation keys with something like this content
{
"name": "Hello %{name} %{user}, some kind of text..."
}
t("name", {name, user})
For example, the name variable may be missing and as a result we get a string of the following type
Hello USER, some kind of text...
After Hello there are 2 spaces
At some points, there may be a space before the dot, or something else, all these are special cases.
I have to resort to something like this option t("name", {name, user})?.replace(/ +/g, " ")?.trim()
Which allows you to remove double problems, etc.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Everything is really cool and I'm glad that I found such a library, so thank you very much.
The only thing I'm missing is a kind of post-processing of the translation, which is what I mean.
I have translation keys with something like this content
t("name", {name, user})
For example, the name variable may be missing and as a result we get a string of the following type
After Hello there are 2 spaces
At some points, there may be a space before the dot, or something else, all these are special cases.
I have to resort to something like this option
t("name", {name, user})?.replace(/ +/g, " ")?.trim()
Which allows you to remove double problems, etc.
What should be done in such cases?
Beta Was this translation helpful? Give feedback.
All reactions