views:

997

answers:

4

I have a few questions:

I know what gettext is. I've read a few posts where they mentioned xgettext and was curious as to what is the difference between the two.

How can I install xgettext on Windows?

And finally, does anybody have a tutorial on how to install the library php-gettext http://savannah.nongnu.org/projects/php-gettext/ (this one usually doesn't come with PHP) I've read about it in an article but I'm not sure how to get it working in Windows. The thing is, sometimes when you make changes, you need to restart Apache to see the new data with the gettext that comes with PHP (but with the library you don't need to restart it) so I wanted to use the library for development. Thanks!

A: 

The online function reference reference tells me there is no xgettext.

Maybe they mean one of

ngettext dgettext dngettext dcgettext dcngettext

treating the 'x' like a wildcard

pavium
ah ok, maybe you're right
Kentor
A: 

xgettext is part of gettext, it's a program that extracts translatable strings from program sources. See gettext's manual.

I don't know about its availability on Windows, Google tells me there's a port.

Josh Davis
could that help me with this -> http://stackoverflow.com/questions/1351259/php-string-variables-in-gettext-forgot-one-case-scenario ?
Kentor
+1  A: 

Install Cygwin and select the gettext-devel package.
This will install the xgettext.exe

The Zend Framework has a gettext Zend_Translate adapter that doesn't require the php gettext extention.

Bob Fanger
+3  A: 

In regards to the question:

I know what gettext is. I've read a few posts where they mentioned xgettext and was curious as to what is the difference between the two.

In short, gettext() is a function and xgettext is a utility program for extracting messages from source code.

In long, SO answer to Complete C++ i18n gettext() “hello world” example shows as part of the C++ source code file hellogt.cxx:

gettext("hello, world!")

The gettext() function is passed a text string that is used as an index to the message to be used at run-time. It returns the specified message for the language which is specified either in the code or at the time the program is invoked.

Then it shows:

xgettext --package-name hellogt --package-version 1.2 --default-domain hellogt --output hellogt.pot hellogt.cxx

which is a utility program used at build time to examine the source code file hellogt.cxx for text strings passed to gettext(). These are extracted and used to create the Portable Object Template file hellogt.pot.

The .pot file template is used by translators in the process of delivering the binary translated message file hellogt.mo used at run-time by gettext().

C.W.Holeman II
That's helpful, thanks a lot!
Kentor