Reputation: 2579
I am trying to localize all the text of a web page using the i18npackage. My requirement is to convert all the text in to the selected locale.
Is it possible to localize dynamic text, such as user input, like name, designation in a form into the selected locale? If so, how can I do it?
Upvotes: 8
Views: 2672
Reputation: 2395
I agree with @VivekPatel's answer but I'd like to broaden it. Also, you don't give too much context so it is a bit harder to decide however, this is what I would do:
Both solutions require extra setup of course and I don't think it would be solved by the package you linked.
Upvotes: 2
Reputation: 1057
The idea of localization is to translate information text, input labels, and all the static texts so users from any part of the world can understand. In my opinion, we should not translate the input provided by the user.
You can try out here: https://www.w3schools.com/HOWTO/tryit.asp?filename=tryhow_google_translate
Add the input field like below. Even Google will not translate the input provided by the user.
<input type="text" value="HELLO" />
I have a system where I have applied localization. Users from Germany, Netherlands, India, and USA are using the website. We have translated only static text that helps users in understanding the information or labels of input.
Regarding user input, users can provide input in their preferred language. You can store them in the Database as it is using Unicode. So when you will fetch the data it will be the same. But the idea of translating user input is not good.
Let me know if this helps or do you still want to translate then I can provide you a function which will do the translation?
Upvotes: 3