Re: How could you load only once a Linux ultility without a batch --input-files kind of option and repeatedly use it on many files? . . .
On Fri, May 15, 2020 at 05:48:23PM +0300, Andrei POPESCU wrote:
> I just stumbled upon an interesting case:
>
> $ find po -name ro.po -exec msgfmt --statistics {} \;
> 66 translated messages.
> 705 translated messages, 14 fuzzy translations.
> 52 translated messages.
> 485 translated messages.
> 527 translated messages, 22 fuzzy translations, 1 untranslated message.
>
> but
>
> $ find po -name ro.po -exec msgfmt --statistics {} +
> po/sublevel3/ro.po:21: duplicate message definition...
> po/sublevel4/ro.po:19: ...this is the location of the first definition
> msgfmt: found 1 fatal error
>
> In this particular case it is actually necessary to issue a separate
> 'msgfmt' command for each .po file, while in most other cases the '{} +'
> form is better (and shorter to write ;).
Yes. There are many commands that *can't* handle multiple input files,
and have to be fed one file at a time.
As the programmer, you need to know which commands can be invoked in
which way(s). Usually a quick glance at the man page will suffice.
Now, in the case of msgfmt(1), I don't actually know the right answer
for you -- it's not a tool I'm really familiar with. I will note,
though, that its manual explicitly says it should be able to handle
multiple input files:
SYNOPSIS
msgfmt [OPTION] filename.po ...
[...]
Input file location:
filename.po ...
input files
There's something about *your* particular input files that it doesn't
seem to like. It seems to be complaining about duplicates. Maybe
you've defined something multiple times across multiple files, and it
doesn't like that?
> po/sublevel3/ro.po:21: duplicate message definition...
> po/sublevel4/ro.po:19: ...this is the location of the first definition
I would start by comparing line 21 of po/sublevel3/ro.po with
line 19 of po/sublevel4/ro.po.
Anyway, that's why there are several different tools available. You
can choose the right one for your task.
Reply to: