bug-gettext
[Top][All Lists]
Advanced

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

[bug-gettext] Bug#682580: xgettext: fails to properly replace some place


From: Santiago Vila
Subject: [bug-gettext] Bug#682580: xgettext: fails to properly replace some placeholders in output .pot (PACKAGE, YEAR, C. HOLDER) (fwd)
Date: Mon, 13 Jul 2015 12:42:33 +0200 (CEST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

Hello.

A long time ago I received this from the Debian bug system.
(Yes, I apologize for taking so long to forward this upstream).

---------- Forwarded message ----------
From: "Francesco Poli (wintermute)" <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Mon, 23 Jul 2012 23:32:08 +0200
Subject: Bug#682580: xgettext: fails to properly replace some placeholders in
    output .pot (PACKAGE, YEAR, C. HOLDER)

Package: gettext
Version: 0.18.1.1-9
Severity: normal

Hello!
Thanks for maintaining gettext in Debian!


I noticed that xgettext does not properly replace all the relevant
placeholders in the output .pot file, when told to do so through
command-line options.

I'll try to explain the issues with a minimal test case.

Let's consider the example in the official Python library reference [1].
This should be minimal enough, I think.

[1] http://docs.python.org/library/gettext.html#module-gettext

Here's the example code:

  $ cat myapplication.py 
  import gettext
  gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')
  gettext.textdomain('myapplication')
  _ = gettext.gettext
  # ...
  print _('This is a translatable string.')

Let's generate the corresponding .pot file:

  $ xgettext --language=python myapplication.py -o myapplication.pot
  $ cat myapplication.pot 
  # SOME DESCRIPTIVE TITLE.
  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  # This file is distributed under the same license as the PACKAGE package.
  # FIRST AUTHOR <address@hidden>, YEAR.
  #
  #, fuzzy
  msgid ""
  msgstr ""
  "Project-Id-Version: PACKAGE VERSION\n"
  "Report-Msgid-Bugs-To: \n"
  "POT-Creation-Date: 2012-07-23 22:49+0200\n"
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  "Last-Translator: FULL NAME <address@hidden>\n"
  "Language-Team: LANGUAGE <address@hidden>\n"
  "Language: \n"
  "MIME-Version: 1.0\n"
  "Content-Type: text/plain; charset=CHARSET\n"
  "Content-Transfer-Encoding: 8bit\n"

  #: myapplication.py:6
  msgid "This is a translatable string."
  msgstr ""

This seems to be OK, but some placeholders should be replaced by actual
values.
It is my understanding that (before the .pot file is made available to
prospective translators who wish to start a localization in a new
language) the second line should be replaced by appropriate copyright
notices, and that PACKAGE and VERSION should be replaced by the actual
package name and version number.
Let's try with the following command-line options:

  $ xgettext --copyright-holder="Python Software Foundation" \
             --package-name=myapplication --package-version=0.1 \
             --language=python myapplication.py -o myapplication2.pot
  $ cat myapplication2.pot 
  # SOME DESCRIPTIVE TITLE.
  # Copyright (C) YEAR Python Software Foundation
  # This file is distributed under the same license as the PACKAGE package.
  # FIRST AUTHOR <address@hidden>, YEAR.
  #
  #, fuzzy
  msgid ""
  msgstr ""
  "Project-Id-Version: myapplication 0.1\n"
  "Report-Msgid-Bugs-To: \n"
  "POT-Creation-Date: 2012-07-23 22:49+0200\n"
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  "Last-Translator: FULL NAME <address@hidden>\n"
  "Language-Team: LANGUAGE <address@hidden>\n"
  "Language: \n"
  "MIME-Version: 1.0\n"
  "Content-Type: text/plain; charset=CHARSET\n"
  "Content-Transfer-Encoding: 8bit\n"

  #: myapplication.py:6
  msgid "This is a translatable string."
  msgstr ""
  $ diff myapplication.pot myapplication2.pot 
  2c2
  < # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  ---
  > # Copyright (C) YEAR Python Software Foundation
  9c9
  < "Project-Id-Version: PACKAGE VERSION\n"
  ---
  > "Project-Id-Version: myapplication 0.1\n"

That's better, but there are a few issues left:

 (A) first of all, the YEAR placeholder in the second line is not
     replaced, and I failed to find an option to do so

 (B) secondly, I cannot find a way to include multi-line copyright
     notices, as in [2]:

     # Copyright (C) 2001-2012 Python Software Foundation.
     # Copyright (C) 2000 BeOpen.com.
     # Copyright (C) 1995-2000 Corporation for National Research Initiatives.
     # Copyright (C) 1991-1995 Stichting Mathematisch Centrum.

[2] http://docs.python.org/copyright.html

 (C) finally, the PACKAGE placeholder is correctly replaced in the
     Project-Id-Version field, but left untouched in the third line of
     myapplication2.pot


Please fix these issues and/or forward this bug report upstream,
as appropriate.

Thanks for your time!

[...]



reply via email to

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