KLocale plans

David Faure faure at kde.org
Sun Nov 25 09:16:36 UTC 2012


On Sunday 25 November 2012 00:59:59 Chusslove Illich wrote:
> > [: David Faure :]
> > Porting from KLibrary to QLibrary really brings up only one question, how
> > to locate ktranscript.so. But since the idea is that QT_PLUGIN_PATH must
> > be set to the KF5 install prefix + /lib/plugins, it might just work out of
> > the box (after you add the env var to your setup, of course).
> 
> Indeed, it would work if I just replace KLibrary with QLibrary, but for
> locating the plugin. If I give absolute path to plugin to QLibrary
> constructor, it works. With just the plugin name, no matter how I set
> QT_PLUGIN_PATH it does not find it. I tried with PREFIX/lib/plugins, and
> PREFIX/lib/plugins/kf5 (since ktranscript.so is installed in there). In the
> loading error message, I noticed lib* was prepended to the plugin name, so I
> also tried with libktranscript.so symlink, but still nothing.

I think this should be QLibrary("kf5/ktranscript"), and ensuring the file on 
disk is called ktranscript.so (no "lib" in front).

> > [...] I didn't know how to trigger loadTranscript() anyway. Well, maybe
> > the unittest does that (and otherwise, that's a bug in the unittest ;).
> 
> It doesn't test that yet, no.
> 
> I have this general issue of how to provide proper test data for
> KLocalizedString unit test. You have sidestepped this by looking for the
> already installed French kdelibs4.mo. Since there is nothing scripted in
> French kdelibs4.mo, following the same logic, for the scripted translation
> test we'd have to look for kdelibs4.mo of a language which does have
> something scripted inside.
> 
> But, can we instead provide a special test catalog, making unit tests self-
> contained? 

Yes, of course. The catalogs are located using GenericDataLocation + 
"locale/", so you could export XDG_DATA_DIRS to PWD and have the test catalog 
in a locale subdir. Wait: even better for portability, call 
QStandardPaths::enableTestMode(true) and copy the test catalog into 
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + 
"/locale/" + filename. If you do all this upfront in initTestCase, klocale 
should find that catalog just fine.

> This would involve putting a PO file somewhere in the tests
> directory, compiling it to MO when the test is built (I could write CMake
> stuff for this), and doing something in the test initialization code to
> ensure that QStandardPaths::locate will find the compiled MO (not sure how
> to do this). At any rate, I think it's better to wait until ki18n is moved
> to proper tier location.

That's unrelated, it can be done before ;)
But yeah I'd like to move it asap.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list