Обработка строки после перевода #1228
Unanswered
GreenEyeInvestor
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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