bugGNU gettext - Bugs: bug #64490, xgettext-0.22 makes...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #64490: xgettext-0.22 makes --join-existing less useful

Submitter:  Arsen Arsenović <arsen>
Submitted:  Sat 29 Jul 2023 08:31:41 AM UTC
   
 
Category:  Programmer tools Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Jump to the original submission

Mon 25 Sep 2023 03:38:26 PM UTC, comment #7: 

Thanks!  The changes above seem quite nice.  I've implemented your suggestion (write to temporary .pot files), too, and have sent that for review.

Have a lovely day :-)

Arsen Arsenović <arsen>
Tue 19 Sep 2023 08:39:00 AM UTC, comment #6: 

The fix is contained in gettext 0.22.1.

Bruno Haible <haible>
Group administrator
Sun 17 Sep 2023 01:07:08 PM UTC, comment #5: 

In a future release, the "warning: Charset "CHARSET" is not a portable encoding name." will be gone as well, even if the suffix is not ".pot".
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=3523d1d2753e1a5af64fffe777123c200fae40b1

Additionally, there will be a new documentation section "Combining PO Template Files".
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=cd05b2f71d8bdcd10a9885d4ec49e0d8d8020d57

Bruno Haible <haible>
Group administrator
Sat 16 Sep 2023 11:36:49 PM UTC, comment #4: 


> Perhaps it'd be good to use -o to suppress this warning anyway


Yes, regardless of gettext version, you profit of the .pot suffix handling by replacing

--default-domain=$(PACKAGE)

with

-o $(PACKAGE)-tmp.pot

(twice) and

< $(PACKAGE).po > $@-t

with

< $(PACKAGE)-tmp.pot > $@-t


Bruno Haible <haible>
Group administrator
Sat 16 Sep 2023 11:03:33 PM UTC, comment #3: 

Thanks for the fix.  Perhaps it'd be good to use -o to suppress this warning anyway, the rule currently does:


$(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
        $(XGETTEXT) --default-domain=$(PACKAGE) \
          --directory=$(top_srcdir) \
          --add-comments --keyword=_ --keyword=N_ \
          --msgid-bugs-address=https://sourceware.org/bugzilla/ \
          --files-from=$(srcdir)/SRC-POTFILES.in
        $(XGETTEXT) --default-domain=$(PACKAGE) \
          --directory=.. \
          --directory=. \
          --add-comments --keyword=_ --keyword=N_ \
          --join-existing \
          --msgid-bugs-address=https://sourceware.org/bugzilla/ \
          --files-from=$(srcdir)/BLD-POTFILES.in
        sed -e '/^#:/s,$(top_srcdir)/,,g' < $(PACKAGE).po > $@-t
        mv -f $@-t $@


... so this seems to be a roundabout way to achieve the same.  I'll see if I can clean it up soon.

Arsen Arsenović <arsen>
Sat 16 Sep 2023 10:26:52 PM UTC, comment #2: 

Note that there are two other ways to combine xgettext invocations, that don't produce this warning:


xgettext -o part1.pot a.c
xgettext -o part2.pot b.c
xgettext -o all.pot part1.pot part2.pot


and


xgettext -o all.pot a.c
xgettext -o all.pot --join-existing b.c


You may wonder: what is the difference between this last recipe and what you did? The difference is the suffix of the output file. If the suffix is ".pot", xgettext avoids the warning regarding CHARSET. In your report, you used '--default-domain=bfd', which is equivalent to '-o bfd.po', with suffix .po, not .pot. A subtle difference.

Bruno Haible <haible>
Group administrator
Sat 16 Sep 2023 10:22:18 PM UTC, comment #1: 

Thanks for the report. Fixed through
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=0b0047d6318cb5dde02a8d5e2e2ad208c9a5c694

The fix reverts to the previous behaviour, which produces only a warning.

Bruno Haible <haible>
Group administrator
Sat 29 Jul 2023 08:31:41 AM UTC, original submission:  

as of the release of gettext-0.22, it seems to be impossible to use --join-existing correctly.  this currently breaks updating translations in binutils-gdb.git, which uses xgettext in two passes.

example is below:

/tmp/foo$ xgettext --version
xgettext (GNU gettext-tools) 0.22
Copyright (C) 1995-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.
/tmp/foo$ echo 'void f () { gettext ("foobar"); }' > a.c
/tmp/foo$ echo 'void f () { gettext ("barfoo"); }' > b.c
/tmp/foo$ /usr/bin/xgettext --default-domain=bfd --directory=. --add-comments --keyword=_ --msgid-bugs-address=https://sourceware.org/bugzilla/ --files-from=/dev/stdin <<< a.c
/tmp/foo$ /usr/bin/xgettext --join-existing --default-domain=bfd --directory=. --add-comments --keyword=_ --msgid-bugs-address=https://sourceware.org/bugzilla/ --files-from=/dev/stdin <<< b.c
bfd.po: warning: Charset "CHARSET" is not a portable encoding name.
                 Message conversion to user's charset might not work.
/usr/bin/xgettext: present charset "CHARSET" is not a portable encoding name
/tmp/foo 1 $ sudo emerge =gettext-0.21.1
...
/tmp/foo$ rm *
/tmp/foo$ echo 'void f () { gettext ("foobar"); }' > a.c
/tmp/foo$ echo 'void f () { gettext ("barfoo"); }' > b.c
/tmp/foo$ xgettext --default-domain=foo --directory=. --add-comments --keyword=_ --files-from=/dev/stdin <<< a.c
/tmp/foo$ xgettext --join-existing --default-domain=foo --directory=. --add-comments --keyword=_ --f
iles-from=/dev/stdin <<< b.c
foo.po: warning: Charset "CHARSET" is not a portable encoding name.
                 Message conversion to user's charset might not work.
/tmp/foo$

Arsen Arsenović <arsen>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by arsen (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-09-19 haible StatusFixed Fix Released
    2023-09-16 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code