开发者

PHP: How to add Languages layer to MVC framework?

I am currently working on my own implementation of a MVC framework. I would like to know how to add language layer to my 开发者_如何学JAVAframework so that it could support multiple languages other than english. What's the role of unicode in this case?


Frameworks frequently utilize a concept of "localization files" (.po files as a standard) to do UI translation. In your view and controllers, whenever you want to show a piece of text, instead of calling

echo "Hello"

You'd do

echo MyFramework::Translate("Hello")

That Translate() function just looks up the right .po file, and based on the passed in "ID" of the phrase, returns the desired localized text.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜