Commit graph

32 commits

Author SHA1 Message Date
joerg
0a5067d86c Pass some additional options down as used by the scmgit-base build.
Tested by full bulk build, ok wiz@
2009-03-27 14:44:36 +00:00
joerg
91ae4afc96 Rename MSGFMT_STRIP_MSGCTX to MSGFMT_STRIP_MSGCTXT to reflect what is
stripped. Allow the script to be used for pkgsrc msgfmt as well. Set
MSGFMT_STRIP_MSGCTXT automatically for msgfmt before 0.15.
2009-03-22 17:57:58 +00:00
joerg
5f72a77f4a Refactor msgfmt.sh script to conditionally strip the msgid_plural for
old NetBSD versions and to strip msgctx if requested by the package.
This allows to replace the use of msgfmtstrip in various packages by
setting MSGFMT_STRIP_MSGCTX.
2009-03-20 16:13:02 +00:00
hira
a67f295a78 Fix a comment (gnome-vfs2 -> gnome-vfs). 2007-09-25 10:32:17 +00:00
obache
2bce931566 Recognize argment "-" as $pofile. 2007-05-10 15:42:29 +00:00
obache
6615c8e011 Change input file lookup behavior to close to gnu msgfmt's implementation.
* allow "-" (stdin)
 * allow other than regurar file (should fix PR 36257).
 * if doesn't exist, try to append extension ".po" and ".pot".
2007-05-07 09:31:05 +00:00
martti
e2610fb8c8 Remove trailing tabs. 2006-12-15 13:15:06 +00:00
jlam
3a15b8b8b2 Change the way that "\c" is processed within the msg strings: if we
see \c, where c is anything but a legal character as defined by
msgfmt-0.10.35, then replace the backslash with a '?'.  Yes, this is
a hack, but it works around a bug in the way that older msgfmt
mis-identifies some "control" sequences.  This fixes building of
zh_TW.po in x11/matchbox-panel as noted in the bulk build results:

    http://mail-index.netbsd.org/pkgsrc-bulk/2006/06/20/0000.html

While here, note in a header comment which packages' *.po files to
use for regression tests whenever changes to this file are made.
2006-06-23 21:05:43 +00:00
jlam
1fb77f9a70 Executiing "msgfmt ru" should look for "ru" and then "ru.po" for
processing.  Allow for this possiblity by falling through both names
when given input files.  This fixes the builds of sysutils/dfuibe_installer
and sysutils/dfuife_curses noted in the bulk build results:

	http://mail-index.netbsd.org/pkgsrc-bulk/2006/06/20/0000.html
2006-06-20 23:11:36 +00:00
jlam
1c971f32bc Allow for arbitrary whitespace on the line before seeing any of the
msg* keywords.  This fixes parsing es.po in multimedia/gmencoder noted
in the bulk build results:

	http://mail-index.netbsd.org/pkgsrc-bulk/2006/06/20/0000.html
2006-06-20 22:35:25 +00:00
jlam
50131e16fc At the point where we invoke msgfmt during the build phase, the software
author has presumably given us valid *.po files, so skip performing
validity checks on the *.po file.  This fixes building software where
the author has actually *not* produced proper *.po files, e.g.
net/gtk-gnutella, where the de.po files have msgid/msgstr pairs that
do not have matching numbers of format specifiers (%[a-z]).
2006-06-13 13:30:40 +00:00
jlam
53a538f33a Minor fix for last commit... in the case where msgstr is just the
empty string (because no translation has yet been made), it's okay to
have mismatching "\n" in the msgid and msgstr texts.  This should fix
PR pkg/33645 by Carl Brewer.
2006-06-05 13:36:14 +00:00
jlam
8699ebde7b Extend msgfmt.sh script to handle the following cases:
(1) "msgstr" not followed by any string (GNU extension), e.g.

	msgid "foo"
	msgstr
	"bar"

(2) "\n" mismatch between msgid and msgstr, e.g.

	msgid "foo\n"
	msgstr "bar"

This fixes .po compilation problems in www/epiphany and
multimedia/gnome2-media.
2006-06-04 23:18:38 +00:00
jlam
5b63911cc1 Modify msgfmt.sh to make the following changes when filtering *.po files:
msgid		-> msgid ""
	msgid"..."	-> msgid "..."
	msgstr		-> msgstr ""
	msgstr"..."	-> msgstr "..."

The filtered *.po files can then be processed by msgfmt<=0.10.35.

These changes workaround bugs in *.po files in software of the "all
the world runs Linux" variety where the software author either willfully
or stupidly can't follow the format for *.po files described in section
2.2 of the gettext info manual and, in addition, makes lame excuses
when confronted with the evidence.

This closes PR pkg/33506 by Ben Collver.
2006-05-20 23:29:42 +00:00
jlam
65ded3b2ac We can simplify MSGSTRN_RE because we already catch the msgstr[0] and
msgstr[1] cases earlier.
2006-05-20 22:13:23 +00:00
jlam
55b0077b28 Rename ORE to OBSOLETE_RE for more clarity in the variable name. 2006-05-20 22:10:18 +00:00
jlam
58a3fca292 Restore "unnecessary" variable... sometimes we use named constants for
documentation/readability purposes...
2006-05-20 22:06:34 +00:00
rillig
dc1846b76d Don't let this program get confused just because there is no white-space
between msgstr and the following string. The bug showed off at
icewm-1.2.25, file po/tr.po, line 774. While at it, removed an
unnecessary variable.
2006-05-10 22:03:07 +00:00
jlam
4d60064932 Reorder the loop so that we can never get into an infinite loop. We
now pass every line we don't need to process directly through to
msgfmt.  This fixes building pt_BR.po in libgnomedb where all of the
lines end with "^M" and this script wasn't properly detecting a blank
line as a result.
2006-04-15 04:41:08 +00:00
jlam
c5dba803cb Modify the loop so that the statements and comment lines can be
interspersed.
2006-04-15 04:32:02 +00:00
jlam
32cd3f09b7 Replace a re-used regular expression with a constant. 2006-04-15 01:36:40 +00:00
jlam
1c39903d14 Drop all msgstr[N] translations besides msgstr[0] and msgstr[1] because
those translations can have no corresponding msgid anchor in the old
PO file format.  This allows all of the *.po files in gnome-vfs2 to
build correctly into *.mo files.
2006-04-14 22:37:38 +00:00
jlam
b770e349e6 Whitespace changes for proper indentation. 2006-04-14 22:23:25 +00:00
jlam
fb96576317 Remove debugging code so that we actually invoke msgfmt. 2006-04-14 22:21:04 +00:00
jlam
65abd7dc11 Avoid using the awk input loop and use our own while loop in a BEGIN
statement.  While here fix processing of *.po files containing obsolete
statements by preserving them for msgfmt to handle.  Also use a few
more constants to make the code more maintainable and readable.
2006-04-14 22:16:33 +00:00
jlam
46ac1a79cc Support a --debug flag that dumps the output of the awk script to a
*.debug file.
2006-04-14 14:40:34 +00:00
jlam
0be006d1fe Now that I understand why we strip "#~" from the head of lines, strip
it consistently whenever we read a new line of input throughout the
script.  Note that this was actually broken in the original msgfmt.pl
script as well.
2006-04-14 14:06:54 +00:00
jlam
4fd6588dbf Use the correct cat command. 2006-04-14 13:49:17 +00:00
jlam
018313ec9e Document the puzzling line that strips "#~" from the start of lines.
Explanation provided by jmmv in private email.
2006-04-14 13:43:23 +00:00
jlam
0107cd1802 Add TNF copyright to file as suggested by jmmv in private email. 2006-04-14 13:40:07 +00:00
jlam
35c719b4c3 Do a bit more error-checking -- if no input file is specified, just run
the msgfmt command to get the right error message and return code.
2006-04-13 19:41:22 +00:00
jlam
0f4967eb59 Overhaul the way packages can ask for "msgfmt". If a package needs
msgfmt, then it should set the following in the package Makefile:

	USE_TOOLS+=	msgfmt

To deal with message files that use the "msgid_plural" statement,
which isn't supported in NetBSD<=3.x and also in gettext<=0.10.35, we
determine if the built-in "msgfmt" is sufficiently new enough to
understand "msgid_plural".  If it isn't, then we use the msgfmt.sh
script to transform the msgid_plural statements to an equivalent
construct that's understood by older msgfmt tools.

The msgfmt.sh script is a straightforward translation of the original
perl script msgfmt.pl script by Julio M. Merino Vidal into shell and
awk, which are more lightweight dependencies than perl.

We remove the USE_MSGFMT_PLURALS bits in gettext-lib/builtin.mk as they
are made obsolete by the new code in mk/tools/msgfmt.mk.

BUILD_USE_MSGFMT is still supported but will be removed in a separate
commit.
2006-04-13 16:35:57 +00:00