Helping libraries load their own translation catalogs

Albert Astals Cid aacid at kde.org
Sun Nov 21 00:46:53 GMT 2010


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?

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

Albert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcatalogloader.patch
Type: text/x-patch
Size: 2846 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101121/70832893/attachment.bin>


More information about the kde-core-devel mailing list