Helping libraries load their own translation catalogs

Volker Krause vkrause at
Sun Nov 21 08:30:35 GMT 2010

On Sunday 21 November 2010 01:46:53 Albert Astals Cid wrote:
> Hi, one of the problem we find every so often in KDE-land is that our
> libraries properly extract their translation messages to a .po file but
> then the application using those libraries forget they have to add a line
> like
> KGlobal::locale()->insertCatalog("libkdepim")
> Which means the application is unfortunately shown untranslated to the
> user.
> Here comes a patch that tries to fix that by moving the catalog loading
> responsability to the library, that is in my opinion where it should live.
> Which this patch, your library would just have somewhere
> K_CATALOG_LOADER(libkdepim);
> and then all the programs linking to your library would automagically get
> the libkdepim catalog loaded.
> It achieves that by creating a static that instructs KGlobal to load a
> given translation catalog on global locale creation.
> What do you think about the patch?

very nice :) 

Especially for KDE PIM, where we probably have about twice as many libraries 
as applications, with complex dependencies, making sure to always have the 
right catalogs loaded is a painful and very error-prone job (just recently we 
did that for the mobile apps, required quite a few iterations until we had 
most strings show up translated, I wouldn't be surprised if we are still 
missing a few catalogs though).

Code looks fine to me as well.

> Is there any way i can convince you it's safe enough for KDE 4.6 inclusion?

I'd love to have that in KDE 4.6, with KDE PIM depending on the latest stable 
release of kdelibs, we'd have to wait about 9 month before we could use it 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the kde-core-devel mailing list