bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Context for gettext strings


From: Bruno Haible
Subject: Re: Context for gettext strings
Date: Fri, 20 Oct 2006 14:22:01 +0200
User-agent: KMail/1.9.1

Hello,

Vernon Meiers wrote:
> This is a feature request. I am using gettext with PHP. Most often, the
> context is important when translating strings.
> Would it be possible to implement an optional comment strings for
> translators, that would explain the reason for the message, so that
> translating is easier?
> E.g. we could have in the po files:
> 
> msgid "this text need to be translated"
> msgcom "this text explains in which situation the string is displayed"
> msgstr "this text is the translated string"
> 
> While gettext would be called as (in PHP) gettext("this text need to be
> translated","this text explains in which situation the string is displayed")

This feature is already implemented. The syntax in the PHP file is like
this:

  <?
  // TRANSLATORS: this text explains in which situation the string is displayed
  echo _("this text need to be translated");
  ?>

Then, "xgettext --add-comments=TRANSLATORS:" extracts the following into the
POT file:

  #. TRANSLATORS: this text explains in which situation the string is displayed
  msgid "this text need to be translated"
  msgstr ""

And the PO file editors know how to display the comment after "#.".

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]