Using PHP Gettext Extension vs PHP Arrays in Multilingual Websites?

Usually, programs are written and documented in English, and use English at execution time for interacting with users. This is true not only from within Sngine. Using a common language is quite handy for communication between developers, maintainers and users from all countries. On the other hand, most people are less comfortable with English than with their own native language, and would rather be using their mother tongue for day to day’s work, as far as possible. Many would simply love seeing their computer screen showing a lot less of English, and far more of their own language.

One of the great tools to support multiple language software is gettext. Gettext is a well established set of tools. There is a tool to automatically extract text strings from your source code (xgettext) and there are other tools that help you with translating your localization files, for example poedit ( ).

Gettext is used by the WordPress

The most obvious pro for using gettext() is of course that the source string is positioned where it belongs. I.e. it makes much more sense to write this

echo __(“This is a string”);


echo $lang[‘a_string’];

Not to mention that you have to craft a new variable placeholder for every possible translation. With gettext() the translation string itself acts as the index.

Also it’s very fast and has some additional features for plurals and stuff, also poedit for example makes the life easier by having a translation db so you must not translate the same stuff over and over again, those you did already will be prefilled and marked as “check if it’s right”. Very comfortable.

Sngine is exactly what you need to build your Online Community:

Sngine is the Best Social Networking Platform in the world with complete features you need to create an amazing community with little or no technical experience because of its simplicity. It is 100% faster than any other platform out there with a clean code, cache system with no framework. Users can Design their profile, Create photo album, Chat with friends and Group Chat, Tag their friends, Share videos, Share music, Saving of Posts, Pages, Groups And Pinning post to the top and much more.