php网站的国际化 [英] internationalization of php website

查看:58
本文介绍了php网站的国际化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个项目/网站,我需要提供多种语言版本.该网站是用 PHP/mysql 和大量 javascript (jQuery) 完成的.我不知道从哪里开始,我希望有人能给我一些提示.我想知道关于什么是最好的方法的意见,如果有一些好的工具可以用于这样的 php 站点,如何处理现有脚本,或者更好的是,需要翻译脚本中的文本以及.有没有人必须做这样的事情才能引导我走正确的道路:) ??谢谢

I am currently working on a project / website and I will need to make it available in several languages. The site was done with PHP / mysql and a lot of javascript (jQuery). I have no idea where to start and I was hoping somebody could give me some hints. I would like to know opinions about what is the best approach to take, if there are some good tools for such a php site, what to do with the existing scripts, or better, with the text inside of the scripts that need to be translated as well. Does anybody had to do something like this before that could guide me through the right path :) ?? thanks

推荐答案

有很多方法可以解决这个问题.它们都不是最好的方法",而且在短期或长期内都存在问题.首先要说的是多语言站点并不容易,翻译人员和可爱的人但很难与之合作,大多数程序员只将问题视为技术问题.除了本答案的范围之外,还有另一个维度,即您是翻译还是本地化.这涉及查看目标受众的文化习俗,然后根据该文化定制语言、风格、布局、颜色、字体等.最后,不要使用机器翻译,机器翻译,任何严肃的事情或者如果它需要准确,并且在获取翻译时确保他们从外语翻译成他们的母语,这意味着他们理解目标语言的所有细微差别.

There are a number of ways of tackling this. None of them "the best way" and all of them with problems in the short term or the long term. The very first thing to say is that multi lingual sites are not easy, translators and lovely people but hard to work with and most programmers see the problem as a technical one only. There is also another dimension, outside the scope of this answer, as to whether you are translating or localising. This involves looking at the target audiences cultural mores and then tailoring language, style, layout, colour, typeface etc., to that culture. Finally do not use MT, Machine Translation, for anything serious or if it needs to be accurate and when acquiring translators ensure that they are translating from a foreign language into their native language which means that they understand all the nuances of the target language.

没错.解决方案.在您不想重写站点的基础上,只需克隆您拥有的站点并将副本翻译成目标语言.假设代码库稳定,您可以使用 VCS 来管理任何代码更改.您可以调整站点的各个部分以适应目标语言,例如法语文本平均比等效的英语文本大 30%,因此使用一个站点来交付这意味着您可能(将)遇到格式问题并且需要交换一个根据语言输入和输出不同的 css 文件.这似乎是一种笨拙的方法,但这些网站还能存在多久?这样做的管理开销很可能低于其他选项.

Right. Solutions. On the basis that you do not want to rewrite the site then simply clone the site you have and translate the copies to the target language. Assuming the code base is stable you can use a VCS to manage any code changes. You can tweak individual parts of the site to fit the target language, for example French text is on average 30% larger than the equivalent English text so using one site to deliver this means you may (will) have formatting problems and need to swap a different css file in and out depending on the language. It might seem a clunky way to do it but then how long are the sites going to exist? The management overhead of doing it this way may well be less than other options.

第二种方式,无需重建.用标签替换当前站点中的所有内容,然后将不同的语言放在文件或数据库表中,嗅探用户所需的语言(您是否有可以进行偏好的注册用户或您想获取浏览器语言标签,或者是它将是 URL dot-com dot-fr, dot-de 做出选择),然后用目标语言替换标签.然后,您需要分别解决尺寸问题和图像问题.当 Symfony 和 Zend 等框架实现 l10n 时,此解决方案有效.

Second way without rebuilding. Replace all content in the current site with tags and then put the different language in file or db tables, sniff the users desired language (do you have registered users who can make a preference or do you want to get the browser language tag, or is it going to be URL dot-com dot-fr, dot-de that make the choice) and then replace the tags with the target language. Then you need to address the sizing issues and the image issues separately. This solution is in effect when frameworks like Symfony and Zend do to implement l10n.

然后您可以使用框架或 gettext 进行重建,并且可能有一个更清晰的解决方案,但请记住,框架旨在解决其他问题,而不是翻译,并且翻译组件已作为部分解决方案而不是完整解决方案进入框架.

Then you could rebuild with a framework or with gettext and and possibly have a cleaner solution but remember frameworks were designed to solve other problems, not translation and the translation component has come into the framework as partial solution not the full one.

所有解决方案的最大问题是持续维护.因为您不仅要维护代码库,还要维护多种语言库.除非你们所有的解决方案都非常聪明有效,否则正在进行的任务将是困难的.

The big problem with all the solutions is ongoing maintenance. Because not not only do you have a code base but also multiple language bases to maintain. Unless you all in one solution is really clever and effective then to ongoing task will be difficult.

这篇关于php网站的国际化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆