[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug with xgettext and PHP
From: |
dAniel hAhler |
Subject: |
Bug with xgettext and PHP |
Date: |
Thu, 24 Nov 2005 02:34:26 +0100 |
User-agent: |
KMail/1.9 |
Hi,
with PHP, when you use the _() function for an index of an array, it gets
extracted with xgettext, but only when you use literal indexes. Please see
the example below. The expected result is to not have any of these three
extracted.
I'm using xgettext (GNU gettext-tools) 0.14.5 on Ubuntu Breezy.
You may wonder, why you would want to use variables with _(), but quite it's
simple: we're using T_() anyway and additional NT_(). NT_() is just a
function that returns the string itself, and allows to define things like
NT_('Jan'), NT_('Feb'), ...
Later, you're able to use T_($months['01']), to translate it in the
apllication.
Extraction with xgettext is done using "--keyword=T_ --keyword=NT_".
Of course, the work around is to use non-numeric indexes.
I hope you consider fixing it.
Thank you.
$ echo "<?php echo _(\$a[1])._(\$a['2'])._(\$a[\"3\"])); ?>" | LANG=C xgettext
- --output=- --language=PHP
# 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: 2005-11-24 02:26+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <address@hidden>\n"
"Language-Team: LANGUAGE <address@hidden>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: standard input:1
msgid "2"
msgstr ""
#: standard input:1
msgid "3"
msgstr ""
- Bug with xgettext and PHP,
dAniel hAhler <=