admin管理员组文章数量:1415491
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?
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?
Share Improve this question edited Jun 20, 2020 at 16:09 Venkat asked Jun 16, 2020 at 9:37 VenkatVenkat 2,5993 gold badges31 silver badges64 bronze badges 2- 1 Does a translation for the input text already exist in the i18n message repository? If not would you explain further what you intend. – Martin Connell Commented Jun 22, 2020 at 0:27
-
1
i18n
does not translate for us (IMO) it actually retrieve values from the already set object based on defined locale. But if you can use google translate to first get your desired language string and set the value in i18n translation repo , than help – Farooq Ahmed Khan Commented Jun 25, 2020 at 5:49
2 Answers
Reset to default 3 +50The 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./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?
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:
- Dynamic texts that are not changing often and can be done by dedicated operator(s) could be translated using a CMS system where the operator has to provide the texts, titles, images in each of the languages. Most CMS systems you can find out there will support this out of the box or can be easily added with plugins. It is useful when you have a webshop and to translate the product name, descriptions etc. Or in a scenario where you have changing content like banners, mercials.
- In the case of user input where it actually makes sense to translate you could use a third-party translation service like amazon or google translate. Scenarios like this I can imagine would be ments or blog posts etc. In this case, the costs can go high if you have a website that is used by a lot of users and it makes sense to only translate one string once and store the translations in your own database.
Both solutions require extra setup of course and I don't think it would be solved by the package you linked.
本文标签: javascriptDynamic localization using i18n packageStack Overflow
版权声明:本文标题:javascript - Dynamic localization using i18n package - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745191903a2646951.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论