<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>345320</bug_id>
          
          <creation_ts>2015-03-19 00:47:45 +0000</creation_ts>
          <short_desc>Cannot see translators&apos; names</short_desc>
          <delta_ts>2015-10-22 00:31:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>Frameworks and Libraries</classification>
          <product>frameworks-kcoreaddons</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Alexander Potashev">aspotashev</reporter>
          <assigned_to name="Michael Pyne">mpyne</assigned_to>
          <cc>karl</cc>
    
    <cc>kdelibs-bugs-null</cc>
    
    <cc>smart2128vr</cc>
    
    <cc>Thomas.Eschenbacher</cc>
          
          <cf_commitlink>http://commits.kde.org/kxmlgui/e4d10c796ae8a3a7ecc6e7a338d6126259fa2583</cf_commitlink>
          <cf_versionfixedin>5.16</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      <flag name="Translation_missing"
          id="1021"
          type_id="20"
          status="+"
          setter="aspotashev"
    />

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1506187</commentid>
    <comment_count>0</comment_count>
    <who name="Alexander Potashev">aspotashev</who>
    <bug_when>2015-03-19 00:47:45 +0000</bug_when>
    <thetext>Switch Plasma5 language to something but English and open any KF5-based application (e.g. Dolphin) to make sure there is no tab &quot;Translation&quot; in the &quot;About Dolphin&quot; dialog.

I guess the problem is in KAboutData::translators() in kcoreaddons/src/lib/kaboutdata.cpp: you call QCoreApplication::translate(&quot;KAboutPerson&quot;, &quot;Your names&quot;, ...) to get the list of translators but the actual string &quot;Your names&quot;...
 1. ... comes from a .po files shipped with the application - dolphin.po in the case of Dolphin. Not sure if QCoreApplication::translate() adopts the data from .po files.
 2. ... does not have the &quot;KAboutPerson&quot; context.

Reproducible: Always</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1517753</commentid>
    <comment_count>1</comment_count>
    <who name="Vincenzo Reale">smart2128vr</who>
    <bug_when>2015-05-11 05:47:59 +0000</bug_when>
    <thetext>I can confirm the bug reported by Alexander.
No &quot;Translation&quot; tab in the About dialog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1517903</commentid>
    <comment_count>2</comment_count>
    <who name="Alexander Potashev">aspotashev</who>
    <bug_when>2015-05-11 17:50:12 +0000</bug_when>
    <thetext>Strangely the list of translators is there in the &quot;Help-&gt;About Editor Component&quot; dialog in Kate. It may be using a codebase separate from KF5.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1550646</commentid>
    <comment_count>3</comment_count>
    <who name="Thomas Eschenbacher">Thomas.Eschenbacher</who>
    <bug_when>2015-10-16 05:21:44 +0000</bug_when>
    <thetext>I can also confirm this bug, and digged a bit in the sources...

The root cause seems to be that QCoreApplication::translate(...) in general seems to be broken for any KDE application. If you look at the source code of that function you can see that it iterates over a list of &quot;translators&quot;, which is an empty list for a KDE application. Even if you try to follow the documentation and try to install a translator in main(), you will see that you need a Qt style message catalog - but such a file does not exist and I am not willing to provide and maintain two different types of message catalogs - IMO it hast to work with one.

Just for verification, you can put the following code snippet into your main() before calling app.exec():

    #define NAME_OF_TRANSLATORS &quot;Your names&quot;
    QString name;
    name = QCoreApplication::translate(&quot;KAboutPerson&quot;, NAME_OF_TRANSLATORS, &quot;NAME OF TRANSLATORS&quot;);
    qDebug(&quot;this fails: &apos;%s&apos;&quot;, name.toLocal8Bit().data());
    name = QObject::tr(NAME_OF_TRANSLATORS);
    qDebug(&quot;this fails: &apos;%s&apos;&quot;, name.toLocal8Bit().data());
    qDebug(&quot;this works: &apos;%s&apos;&quot;, i18n(NAME_OF_TRANSLATORS).toLocal8Bit().data());

=&gt; IMO the code of KAboutData::translators() should be changed to use i18nc or similar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1550843</commentid>
    <comment_count>4</comment_count>
    <who name="Thomas Eschenbacher">Thomas.Eschenbacher</who>
    <bug_when>2015-10-17 11:54:47 +0000</bug_when>
    <thetext>update:

This seems to be broken by design.

The current code within the kcoreaddons package uses QCoreApplication::translate(...), which only works with Qt translation files (*.qm). As the package provides such a file, all strings that come from this package are translated, for example KAboutData::aboutTranslationTeam() works fine and returns a translated string.

But most KDE applications do not provide *.qm files, they work with GNU message catalogs (*.mo files). As these two systems are incompatible it cannot work. I tried to find a patch for this, using direct calls from libintl, but with no luck. I was able translate &quot;normal&quot; texts (those without context) with directly calling dcgettext(...), but for the ones with context (as used for NAME_OF_TRANSLATORS from above) it did not work. Maybe it would work by using dcpgettext(...), but that function is not available here.

=&gt; so how could this be solved?
maybe move KAboutData to a different sub package (non-tier-1), to allow it to use things like ki18nc(...) ?

in my application I worked around by duplicating the code and using ki18nc :
------------------------------------------------------------------------------------
    QList&lt;KAboutPerson&gt; translators = about_data.translators(); // &lt;- currently broken, returns empty list

    if (translators.isEmpty()) {
	QString names  = ki18nc(&quot;NAME OF TRANSLATORS&quot;, NAME_OF_TRANSLATORS).toString();
	QString emails = ki18nc(&quot;EMAIL OF TRANSLATORS&quot;, EMAIL_OF_TRANSLATORS).toString();

	if (!names.isEmpty() &amp;&amp; (names != _(NAME_OF_TRANSLATORS))) {
	    const QStringList list_names(names.split(_(&quot;,&quot;)));

	    QStringList list_emails;
	    if (!emails.isEmpty() &amp;&amp; (emails != _(EMAIL_OF_TRANSLATORS)))
		list_emails = emails.split(_(&quot;,&quot;), QString::KeepEmptyParts);

	    QStringList::const_iterator it_e = list_emails.constBegin();
	    foreach (const QString &amp;name, list_names) {
		QString email;
		if (it_e != list_emails.constEnd())
		    email = *(it_e++);
		translators.append(KAboutPerson(name.trimmed(), QString(), email.trimmed()));
	    }
	}
    }
------------------------------------------------------------------------------------</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1550922</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Pyne">mpyne</who>
    <bug_when>2015-10-17 18:56:42 +0000</bug_when>
    <thetext>I&apos;m not really sure what to do with this, the translation infrastructure isn&apos;t really my area of expertise. :(

What I will do is ask for help from frameworks-devel and see whether we can either adapt the translation context, move KAboutData, or some other suitable fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1551871</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Pyne">mpyne</who>
    <bug_when>2015-10-22 00:31:34 +0000</bug_when>
    <thetext>Git commit e4d10c796ae8a3a7ecc6e7a338d6126259fa2583 by Michael Pyne.
Committed on 22/10/2015 at 00:25.
Pushed by mpyne into branch &apos;master&apos;.

kmainwindow: Pre-fill translator information when available.

KCoreAddons&apos;s KAboutData can store information about the translators for
the application when using non-en_US messages. This information is
encoded by translating a specific message string, which can no longer be
done within KAboutData (compared to KDE 4) since KCoreAddons can&apos;t use
KI18n.

Applications have been able to manually add translator information, but
there&apos;s no reason we can&apos;t do this by default for the majority of
our KF5-based applications.

Combined with updates to the KAboutData API documentation I believe this
should also fix bug 345320.
FIXED-IN:5.16
REVIEW:125682

M  +13   -0    src/kmainwindow.cpp
M  +6    -0    src/kmainwindow.h

http://commits.kde.org/kxmlgui/e4d10c796ae8a3a7ecc6e7a338d6126259fa2583</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>