[rkward-devel] i18n in rkwarddev?
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Sat Jan 31 19:30:03 UTC 2015
Hi all, hi Meik,
since today we're very close to having 100% translatability of RKWard -
including plugins and help pages. One small bit that is missing is i18n
in the power analysis plugin (the bits in the .js file).
Well, the power analysis plugin is rkwarddev-based, and now I'm a bit
at a loss as to how this could best be accomplished. As a reminder,
what needs to be done in the result .js file is basically the following
two replacements:
echo ('rk.print("A translatable string")');
-> echo ('rk.print(' + i18n ("A translatable string") + ')');
echo ('# a code comment\n');
-> comment ('a code comment');
In rkwarddev, generation of the "echo()"-call is conveniently wrapped
into an rkwarddev::echo(). The problem with this is, however,
that we can't just make use of the js-function i18n() (and i18nc,
i18np, i18ncp), here. So, in rkwarddev, we'd have to make do without
the rkwarddev::echo, i.e.:
rk.paste.JS ("echo ('rk.print(' + i18n (\"A translatable string\") +
')')")
which is just the barely readable quoting-hell that rkwarddev::echo()
is meant to avoid.
What I'd like to be able to write, instead, is:
echo ('rk.print(', i18n ("A translatable string"), ')')
Would that be feasible? Or am I simply on the wrong track, and there is
a better option, already?
Some notes:
- rkwarddev::i18n() already exists, but it's the now obsolete static
approach to i18n, as far as I can see.
- We'd need functions i18n(), i18nc(), i18np(), i18ncp(), and
comment(). These would not really have to interpret their arguments,
just create an equivalent js-call that will _not_ be quoted by echo().
- For formals of these js-calls, refer to
rkward/scriptbackends/common.js or
http://api.kde.org/doc/rkwardplugins/i18n_js.html .
- Message extraction happens on the level of the generated files, so
no need to worry about this in rkwarddev.
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20150131/7f63bc55/attachment.sig>
More information about the rkward-devel
mailing list