开发者

Automatic translation for HTML files

开发者 https://www.devze.com 2023-04-09 06:11 出处:网络
I want translate a web page for multiple languages. I can create a开发者_开发技巧 .html file for each language, but I would like only one .html file and use an automatic way for translations.

I want translate a web page for multiple languages. I can create a开发者_开发技巧 .html file for each language, but I would like only one .html file and use an automatic way for translations.

Is it be possible?


It is not possible for a static website. I suggest you stick to having separate files for each locale.


The easiest way for you to achieve that (since you are obviously the beginner) would be to actually use PHP and generate appropriate language web page on the fly.

Alternatively (but I must warn you that this approach may result in very unresponsive web page) you can use JavaScript to translate your web page - in fact jQuery plus Globalize. However, this force you to use common anti-pattern, that is you would need to force users to choose their language as oppose to automatically infer it from web browser's settings.

Either way, you have a lot of things to learn...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号