Jan 29

I’m beginning a new effort these days, that of internationalisation and localisation of the php coding I’ve been doing lately.

GNU ‘gettext’ Utilities

These docs for gettext are C-oriented, but the associated tools such as xgettext are easily used by PHP, so let’s not get too excited about the C.
And I’m going to assume you have installed GNU’s gettext on your system.  I’m pretty sure it arrives by default with your ubuntu or other linux installation.  Mac and Windows you’re going to have to find for yourself :-)

Edited:  download GetText for Windows here

There’s also a lot of emacs crap in this doc, which I’m also going to ignore.  We’re going to use tools like poedit, gtranslator for what we need … coming posts.

on my ubuntu 9.10 box the following command installs the php-gettext stuff in /usr/share/php/php-gettext

sudo apt-get install php-gettext

and includes these three files:

  • gettext.inc
  • gettext.php
  • streams.php

I’m not going to deal with the internals of these files here in this post.

What I do is copy these into my working project somewhere, say in a subdirectory named “library”, “lib”, “i18n” … etc. I’m going to call it ./library/i18n just for this.

.po, .pot, .mo files – what are these?

http://www.gnu.org/software/gettext/manual/gettext.html#Files

That’s about all for now, sorry I couldn’t be more helpful in this post.  This is just the setup stuff I’ve done for my new entry into this world of Internationalisation (i18n), Localisation (l10n), and Native Language Support (NLS) — see Concepts.

  • Facebook
  • Share/Bookmark

One Response to “Internationalization, Localization, gettext, php – a beginning.”

  1. I found your blog post while searching Google. Very relevant especially as this is not an issue which a lot of peaople know that well

Leave a Reply

preload preload preload