[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gettext] Further about --kde mode for xgettext
From: |
Chusslove Illich |
Subject: |
[bug-gettext] Further about --kde mode for xgettext |
Date: |
Mon, 12 Jan 2015 12:42:31 +0100 |
User-agent: |
KMail/1.13.7 (Linux/3.0.13-0.27-default; KDE/4.10.3; x86_64; ; ) |
Hi,
The --kde option makes xgettext recognize KDE 4 format strings, and add
kde-format flag to them. For example:
#, kde-format
msgid "File %1 not found."
There is one issue with this alone, and one new speciality in KF5 (KDE
Frameworks 5, informally "KDE 5").
The issue is that in KDE 4 format placeholder substitution is performed on
every string. String such as this should also get the flag:
#, kde-format
msgid "File not found."
because if the translation were to contain %1 (e.g. left in as unfuzzing
error), the runtime would try to replace it with an argument. So, to be
technically correct, xgettext with --kde should not try to test strings for
KDE 4 format, but blindly add kde-format to all of them.
A new specialty in KF5 is that there is another set of translation calls
which is guaranteed to contain well-formed XML strings. The plain-text calls
are named i18n* and the XML ones are named xi18n*, so it is possible to
discern between them at extraction time. It would thus be a pity if all XML
strings also simply get kde-format tag, as that would prevent any XML
validation of translation. Instead it would be good if they get another
flag, e.g. kde-xml-format. Then msgfmt with -c could verify also the well-
formedness of such strings, but even until/if that is implemented, other
tools could use it for validation (e.g. a PO editor).
Taking these two things together, we could do by having only kde-xml-format
flag added in a lightweight manner, e.g. without matching by xgettext and
with msgfmt verification same as for kde-format. The rest could be achieved
by applying multiple --flag options to xgettext. Would this be acceptable?
However, since the --kde option anyway exists, and since KDE translation
call set is fixed and used as-is (no arbitrary short forms through #define
directives), it seems to me it would be nicer and non-problematic if all of
the above is automatically applied by xgettext. That is, that the user does
not have to specify many -k and --flag options just to support all the
default calls (32 in total, as [k][x]i18n[d][c][p], the ones with *x* being
XML). Of course, -k would continue to have its normal function (cancel
defaults, add more calls). Would this be acceptable?
--
Chusslove Illich (Часлав Илић)
signature.asc
Description: This is a digitally signed message part.
- [bug-gettext] Further about --kde mode for xgettext,
Chusslove Illich <=