Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tutorial: Localizing PHP Applications the Right Way, with gettext

DZone's Guide to

Tutorial: Localizing PHP Applications the Right Way, with gettext

· Web Dev Zone
Free Resource

Get the senior executive’s handbook of important trends, tips, and strategies to compete and win in the digital economy.

English has become the default language of software development for economic and historical reasons. But maintaining only English-language code is not ideal, because plenty of developers' first language isn't English; and maintaining multiple codebases, in different languages, is, like every code-multiplication, an easy recipe for disaster.

The gettext utilities offer a workaround -- but implementation isn't always obvious. (The full documentation is quite thorough, but rather long.) The continuing popularity of PHP makes gettext particularly useful for PHP developers -- but the php.net documentation is pretty terse, and barely addresses Windows (where PHP is growing rapidly).

The solution? Abdullah Abouzekry's step-by-step guide to localizing PHP, recently posted on phpmaster.com.

As Abdullah explains:

In this series of articles you will learn how to gettext to localize your PHP application. Part 1 will provide just a quick foray into gettext. Each subsequent part will build on preceding parts, teaching you how to handle multiple translation domains, plural forms, and even how you can automate some of the localization process.

One of the neat things about this walkthrough is its attention to detail: in 'Preparing the Environment', for example, Abdullah includes special instructions for Windows and Linux users, something the php.net documentation left out (resulting in a small patchwork of anonymously contributed notes).

Only Part 1 is up so far. But check it out and, if it helps you, stay tuned for additions in the future.


Read this guide to learn everything you need to know about RPA, and how it can help you manage and automate your processes.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}