<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/115485/">https://git.reviewboard.kde.org/r/115485/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On February 22nd, 2014, 2:35 p.m. CET, <b>Chusslove Illich</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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?
</pre>
 </blockquote>




 <p>On February 22nd, 2014, 2:47 p.m. CET, <b>Kevin Krammer</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
 </blockquote>





 <p>On February 22nd, 2014, 2:52 p.m. CET, <b>Alex Merry</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">And, indeed, there are a lot of other things in QtCore that break if you do not have a QCoreApplication instance.  In short, if you are making a Qt application (GUI or not), you need to create an instance of QCoreApplication (or one of its subclasses).</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">To my knowledge there was no technical need for presence of QCoreApplication
in ki18n so far, e.g. the above example works with KJS.

Also, what happens if one wants to place an i18n call before creating
Q*Application? We had such cases, and had to work around them in few ways.
</pre>
<br />










<p>- Chusslove</p>


<br />
<p>On February 22nd, 2014, 2:58 p.m. CET, Kevin Krammer wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Frameworks and Chusslove Illich.</div>
<div>By Kevin Krammer.</div>


<p style="color: grey;"><i>Updated Feb. 22, 2014, 2:58 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
ki18n
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Attempt at replacing the KJS dependency with a QtScript, i.e. making ki18n a tier1 framework.
Needs more testing and likely fixing</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>CMakeLists.txt <span style="color: grey">(06fb696)</span></li>

 <li>autotests/CMakeLists.txt <span style="color: grey">(c4d6b9b)</span></li>

 <li>src/CMakeLists.txt <span style="color: grey">(9e3ce9f)</span></li>

 <li>src/ktranscript.cpp <span style="color: grey">(b9e0551)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/115485/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>