![]() Leave an empty line after the lines that are already in the file and add the following: #Test token 1 Now close Poedit, and use your favorite text editor to open messages.po… yes, it is an ordinary text file! you can edit it by hand, but to save ourselves some hassle we let Poedit create the main definitions for us. ![]() In the settings window, fill in the information below skipping the plural forms field for now:Ĭlick OK and then save the file as messages.po inside the LC_MESSAGES directory you created earlier. Launch the program and choose from the top menu bar File > New Catalog. Next, make sure Poedit is working correctly on your platform. en_US thus means the language is English as spoken in the United States. The second part after the underscore is a two-letter uppercase country code according to the ISO 3166-1 alpha-2 specification. The first part is a two-letter lowercase abbreviation for the language according to the ISO 639-1 specification. en_US stands for the name of the locale and is made up of two parts. In future projects, you can really name the parent directory and the Locale directory any name you want, but en_US and LC_MESSAGES are standard names which are used by gettext. Within the TestI18N directory, create the following hierarchy: In your web root directory, create a sandbox directory for playing with gettext named TestI18N (I18N stands for Internationalization). You can download a copy from Hello World with gettext Then, install Poedit which will be used later. Windows users can download the latest executable and install it from /packages/gettext.htm.Īfter you install the library, you need to enable the PHP extension for gettext by editing php.ini and adding a single line: # for Windows users If you’re using another unix-like system, go to and get a copy of gettext that is compatible with your platform. Ubuntu/Debian users can use apt-get and Fedora/CentOS/Redhat users can use yum to install the gettext library. You can get a copy from Regardless of your platform, to use gettext from PHP you will need to have the gettext library installed and the PHP extension that hooks into the library. It’s a really nice tool that lets you keep your translations separate from your application code. Poedit, a cross-platform editor for gettext catalogs. ![]() You can always get the latest PHP for your platform at
0 Comments
Leave a Reply. |