Website translation onload

六月ゝ 毕业季﹏ 提交于 2019-12-11 05:09:29

问题


I have a dating site which is currently in English language. As per client requirement he told me to convert the website in Polish language. If I will create language file for the website, then I need to rework on whole project. Is there any technique so that my website is automatically translated into Polish language when it is loading in browser. There also some hidden div's that will be displayed when a specific event occurs.

The website is created in php with smarty templating.

Please help me for this.

Thanks


回答1:


If you want a custom solution, you're going to have to do some editing of your current code.

Option 1

Store all your strings in YAML files or within a database, or flat file, or however else you want them stored. The fact of the matter is that, as soon as your application loads, it'll query the database for the strings in your language (your url will have /en, /fr, /de etc at the end) and place those onto your page.

This means you'll have to code the retrieval of this data, and placement within your application.

Option 2

Use Google's "Auto Translate" as per Dainis' suggestion in the comments. This isn't as customisable, but means you don't have to do any reworking of your current code.

Option 3

Use Bing's translate API and manually request strings for the data you want translated on each request. Access to the Bing API is free for developers and has loads of free translations included - but this will be data intensive unless you cache the translations for future use.

With Option 3, you'll still have to code your own custom solution. So if you're on a tight deadline or you're just plain lazy, go with Option 2.



来源:https://stackoverflow.com/questions/14398773/website-translation-onload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!