PHP本地化-gettext还是数组? [英] PHP Localization - gettext or array?

查看:70
本文介绍了PHP本地化-gettext还是数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置多语言网站,我现在需要确定该网站上的静态文本需要使用哪个选项.让我解释一下我的网站设置,然后再解释是否可以决定使用哪种解决方案.

Setting up the multi language site I now need to decide which option I need to use for static text on the site. Let me explain my site setup and then if you can help me decide which solution to use.

该站点是CMS系统,它允许多个域指向同一目录并根据域名提供内容.因此,所有域共享相同的代码.在该网站上,我创建了称为模块的代码块,它们可以完成特定的工作.因此,我可能拥有一个模块,它所要做的就是显示数据库中的最新新闻.然后,我可以决定该模块可以显示在哪个页面上以及该模块可以显示在哪个站点上.所以我的问题是,gettext是否可以在可能在不同页面上显示不同模块的多个域中工作?还是我应该为每个模块创建一个语言文件,其中每个模块包含一个包含该特定模块的语言对话的数组?因此,如果我有10个模块,则每个模块将具有自己的语言文件,每个模块显示的页面仅涉及该模块的语言文件中的数组,以决定显示什么文本?希望这有道理,我阅读了很多有关gettext和使用数组版本的文章,但无法确定哪种类型更适合这种站点设置.

The site is a CMS system that allows multiple domains to point to the same directory and serves content based on the domain name. So all domains share the same code. On the site I created blocks of code, called modules, that do specific jobs. So I might have a module that all it does is display the latest news from the database. I then can decide what page that module can display on and what site it will display on. So my question is, would gettext work for multiple domains that may have different modules showing up on different pages? Or should I just create a language file for each module that contains an array which has the language conversation for that specific module? So if I had 10 modules, each module would have its own language file and whatever page each module shows up it just refers to the array in the language file for that module to decide what text to show? Hope this makes sense, I read a lot about gettext and using the array version, but cant decide which one is better for this type of site setup.

推荐答案

许多CMS使用数组版本.我也看到了可扩展应用程序的GetText.阵列版本更简单,尤其是当您要从Web界面管理转换时.

A lot of CMS uses the array version. I have seen GetText as well for scalable applications. The array version is simpler especially when you want to manage the translation from a web interface.

这是理所当然的事情.

It is a matter of preference of course.

这篇关于PHP本地化-gettext还是数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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