gettext functions

gettext functions

PHP’s gettext functions provide an interface to the GNU gettext utility, which is a utility for programmers to internationalize their programs. Gettext helps manage the messages output by the software. we can also use it for internationalization (often abbreviated to I18N) of website using PHP.

The basic usage in your PHP script :
1. set the language to be used
2. echo/print your text as you normally would, prepending ‘gettext’ or an underscore ‘_’. So instead of
‘echo “Hello World”‘, you would write ‘echo _(”Hello World”)’ or ‘echo gettext(”Hello World”)’

The translations are stored in a compressed binary file (.mo files), which you create from the plain ASCII files created by gettext from script (.po files).

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.