I'm using i18n into translate my multi language react project. I have a sentences that contain (:) character:
"e.g https://192.168.1.15 or https://example.com"
and I want to translate that to Persian like this:
"مثال: https://192.168.1.15 یا https://example.com"
I put that in my translation file like this:
export default {
"e.g https://192.168.1.15 or https://example.com": "مثال: https://192.168.1.15 یا https://example.com",
}
but it doesn't work. I realized the ":" is the issue . What I see is this:
"//192.168.1.15 or httpsfalse//example.com"
How can I Use (:) character in my translation in i18n?
I used this solution:
t("e.g.", {
urlIP: "https://192.168.1.15",
urlDomain: "https://example.com",
})
and put this code in my translation file:
en.js:
"e.g.": "e.g. {{urlIP}} or {{urlDomain}}",
fa.js:
"e.g.": "مثال: {{urlIP}} یا {{urlDomain}}",
It's not the best solution and I think there is a better way to resolve this issue, but it works for now.
If you know better solution, I am glad to hear from you.