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.
精彩评论