RFC: i18n: strict translation call-to-catalog mapping

Thomas Zander zander at kde.org
Fri Apr 6 09:27:39 BST 2012


On Wednesday 04 April 2012 22.40.22 Oswald Buddenhagen wrote:
> chusslove understood you perfectly well. ;)

Good.

> gettext never did that.
> and in qt these auto-contexts are a pita, as they lead to a lot of
> duplication within a single catalog. it's really not the right solution.
> so chusslove is suggesting an auto-context feature which works on the
> catalog level, not on the class level. seems pretty obvious to me.

Ok, that sounds sane, indeed.

> now, i'm not sure i would solve it exactly this way - the extra argument
> seems wasteful (just like in all the inlined tr() calls). i'd probably
> let the build system generate non-inline per module i18n functions and
> alias the generic one via #define to it. that would also leave some
> room for a heavier implementation of the translation function, e.g.,
> automatically instantiating a QTranslator() (if gettext was not used).

I like that idea in general, not sure how to implement it properly, though.
Simplest idea is to make cmake generate a "klocale-{module}.h" file and make 
everyone include that.  But that sounds like a lot of work.

Most solutions have the problem that the string extraction will become very 
difficult since the context (the {module} here) would depend in gcc preprocessor 
or include path setups.

Would be nice to have a solid suggestion for Chusslove :)
-- 
Thomas Zander




More information about the kde-core-devel mailing list