php-i18n Digest 14 Aug 2003 11:04:44 -0000 Issue 189

Topics (messages 604 through 605):

Re: gettext and variable parsing
        604 by: Christophe Chisogne

gettext - translating .po files
        605 by: Rudi Starcevic

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- Ramil Sagum wrote:
echo _("Displaying records from $from to $to of $total");

Try with printf( _("Displaying records from %d to %d of %d"), $from, $to, $total );

It seems you must quote the strings with ".." for gettext to work.
For all "variable content" to be translated, you have to use
"format strings" (1st argument of printf, sprintf...).
By example, "%d" means to write the var as an integer.

With printf, sprintf etc gettext translate a static string
        "Displaying records from %d to %d of %d"
It can translate it to, say,
        "Affichage des enregistrements de %d à %d parmi %d".
Next, printf receive this format string, as if no i18n
has occured before.

For other informations, see gettext manual (gnu.org)

--
Christophe Chisogne
Developper, Publicityweb sprl
http://www.publicityweb.com


--- End Message ---
--- Begin Message ---
Hi,

I'm trying to create multi-language web pages using 'gettext' with PHP
but am stuck alittle. I've searched the web without joy so I thought I'd ask.

My problem lies in between the .po and .mo files.
After using xgettext to extract the text strings into a .po file I 
don't know exactly how to translate that 'english' text.

How do I translate a .po file ?
I sure I'm missing something simple.

Here is a small example from a .po file:

# page1.php:3
msgid "Hello this is a web page"
msgstr ""

I understand this is my base or root .po file ( messages.po is full name ).
How do I go about translating the msgid string into the msgstr string ?

So far my thinking is once I've translated the msgid strings into the msgid
strings then I create my .mo ( messages.mo ) files.

Is that correct ?
Do I now need some other translating program so that I can actually turn
the English text into other language text ?

It feels like I'm missing one last tiny part to the puzzle.
Once I've understand this last part I'll be the happiest web developer
out there :-)

Thanks very much.
Cheers
Rudi.









--- End Message ---

Reply via email to