Review Request 115485: Porting KTranscript from KJS to QtScript

Kevin Krammer krammer at kde.org
Sat Feb 22 13:47:36 UTC 2014



> On Feb. 22, 2014, 1:35 p.m., Chusslove Illich wrote:
> > I tried to run a standalone non-GUI program using ki18n:
> > 
> >   #include <QDebug>
> >   #include <KLocalizedString>
> > 
> >   int main (int argc, char *argv[])
> >   {
> >       setlocale (LC_ALL, "");
> >       KLocalizedString::setApplicationDomain("test-ki18n-01");
> >       qDebug() << i18n("Delete %1?", i18n("file"));
> >       return 0;
> >   }
> > 
> > and got abort with this message:
> > 
> >   QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine
> > 
> > It does work when I add only
> > 
> >   #include <QCoreApplication>
> >   ...
> >   QCoreApplication a(argc, argv);
> > 
> > What is the reason that this is necessary? If one does want to use ki18n in
> > non-Qt-UI program, would it be inappropriate (in whatever way) to
> > nevertheless require creation of QCoreApplication?
> >

QCoreApplication is for non-UI Qt applications, QGuiApplication and its subclass QApplication are the ones for UI programs.
I was under the impression that translations always require the presence of a QCoreApplication (or derived) instance. Qt's own tr() does.


- Kevin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115485/#review50522
-----------------------------------------------------------


On Feb. 21, 2014, 4:30 p.m., Kevin Krammer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115485/
> -----------------------------------------------------------
> 
> (Updated Feb. 21, 2014, 4:30 p.m.)
> 
> 
> Review request for KDE Frameworks and Chusslove Illich.
> 
> 
> Repository: ki18n
> 
> 
> Description
> -------
> 
> Attempt at replacing the KJS dependency with a QtScript, i.e. making ki18n a tier1 framework.
> Needs more testing and likely fixing
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 3e099d5 
>   src/CMakeLists.txt 9e3ce9f 
>   src/ktranscript.cpp c922e91 
> 
> Diff: https://git.reviewboard.kde.org/r/115485/diff/
> 
> 
> Testing
> -------
> 
> Unittest runs, but the test script is very minimal and would need to be extendedb by someone who understands the scripting requirements.
> There is also a weird crash at test shutdown, in QThreadStorage. As far as I can tell I did not change anything related to threads though.
> 
> 
> Thanks,
> 
> Kevin Krammer
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140222/f14e90fb/attachment.html>


More information about the Kde-frameworks-devel mailing list