KStandardDirs and locale path

Albert Astals Cid aacid at kde.org
Thu Jul 18 14:25:31 UTC 2013


El Dimecres, 10 de juliol de 2013, a les 04:14:19, Sebastian Kügler va 
escriure:
> Hi,

Hi

> Example code:
> 
> const QString translationsPath = package->filePath("translations");
> KGlobal::dirs()->addResourceDir("locale", translationsPath);
> KLocalizedString::insertCatalog(dataEngineDescription.pluginName());
> 
> Question:
> 
> How to port to QStandardPaths, i.e. where to insert the translations path?

As far as I can read the ki18n code, you can't.

All the catalogs are expected to be in 

    const QString relpath = QString::fromLatin1("%1/LC_MESSAGES/%2.mo")
                                               .arg(language).arg(name);
    const QString file = 
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
                                                QString::fromLatin1("locale/") 
+ relpath);

AFAIK you can't "edit" QStandardPaths nor you can't pass catalog/folder pairs 
to k18n, so you lost the feature you where using.

Cheers,
  Albert

> 
> Thanks =)



More information about the Kde-frameworks-devel mailing list