[原创中文翻译]symfony askeet24:第二十三天,网站国际化。

October 11, 2007 – 2:07 am

[欢迎转载,转载请注名出处http://symfony.net.cn。本文英文版权归symfony官方网站所有]

Localization

本地化

What if the call to an address like:

这个URL如何:

http://fr.askeet.com/

…displayed only the French questions? Well, this is quite easy, because since the eighteenth day, such an URI is understood as a universe.

… …只显示法语问题。很简单,第八天的教材URL可以被当作标签处理。

Content

内容

Creating a question in a language universe will have it tagged automatically with the language tag (here: ‘fr’). And, if you browse the ‘fr’ universe, only the questions with the ‘fr’ tag will appear.

在对应预言二级域名下创建的问题会自动按照语言标签被加上标签(这里是fr)。如果你访问带fr的二级域名,只有带fr标签的问题会显示。

So the universe filter already takes care of content localization. That was an easy move.

那么过滤器该关心本地化内容了。这是个很简单的修改。

Look and feel

感官感受

The universes can have their own stylesheet. This means that the look and feel of a localized askeet can be easily adapted as well, with the same mechanism. Next, please.

二级域名下的页面可以有他们自己的样式。这意味着本地化askeet的不同界面显示可以很简单,用同样的原理实现。下面,请吧。

Language-dependent functions

语言-支持功能

The database indexing system built during the twenty-first day relies on a stemming algorithm which is language-dependant. In a localized version, it has to be adapted.

第二十一天数据库索引系统建立,靠的是stemming算法,其中就是种语言-支持。在本地版本里,这需要被改写。

For now, there is no available stemming library for other languages than English in PHP, but what if there was one, or what if someone decided to port one of the Perl stemming libraries to PHP?

现在,除了英语,PHP里还没有适合的stemming库给其他语言,但是这里有一个,有人打算加一个perl写的stemming库给PHP。

Then, in the myTools::stemPhrase() method, we should call a factory method instead of a simple PorterStemmer (left as an exercise for now).

那么,在myTools::stemPhrase()方法里,我们应该调用factory方法代替简单的PorterStemmer(现在算个练习吧)。

(译者:先翻译到这里吧,基本内容是要进行多语言显示,类似“换肤”。由于时间有限,后面的就不翻译了。)

Post a Comment