Thu 17 Apr 2008 11:30:14 AM UTC, comment #3:
> I want to run xgettext on all source files at once, or at least
> in the same manner.
If the source files are in different encodings and thus require
different xgettext options, you cannot do that. In this case, you
need to use multiple xgettext invocations: an xgettext invocation
for each subset of source files, each producing a .pot file, and
a final xgettext invocation at the end, with these intermediate
.pot files as arguments and producing the final .pot file.
> When encoding differences concern only the comments,
> they will not be noticed during normal developement, so there
> is no way to make sure, that indeed all files are ISO-8859-1.
When some files are in ISO-8859-1 and some are in UTF-8, there
is a danger that some editor will garble the comments when
saving the file. (Except if all your developers only use 'vim'
:-)). Therefore I would recommend to have all files in the
same encoding.
How to guarantee that all files are in UTF-8?
for f in $files; do iconv -f UTF-8 -t UCS-4 < $f > /dev/null; done
How to guarantee that all files are not in UTF-8?
for f in $files; do
if iconv -f ASCII -t UCS-4 < $f > /dev/null 2>/dev/null; then
:
else
if iconv -f UTF-8 -t UCS-4 < $f > /dev/null 2>/dev/null; then
echo "$f is in UTF-8!" 1>&2
fi
fi
done
> As the compiler does not care, I think xgettext also should not.
In an ideal world, yes. But as I said, doing it like this would
make the xgettext code more complicated.
|