Commit 1de3048d authored by Laurent Montel's avatar Laurent Montel 😁

Fix translation. Use correct domain name

parent 133a9ea8
......@@ -19,7 +19,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(PIM_VERSION "5.2.41")
set(PIM_VERSION "5.2.42")
set(GRANTLEETHEME_LIB_VERSION ${PIM_VERSION})
set(QT_REQUIRED_VERSION "5.5.0")
......
......@@ -77,8 +77,8 @@ QString GrantleeKi18nLocalizer::processArguments(const KLocalizedString &kstr,
}
// Return localized in the currenctly active locale
const QString translatedStr = str.toString(str.applicationDomain().constData());
//qDebug() << " translatedStr"<< translatedStr << " domain :" << str.applicationDomain() << " currentLocale() "<< currentLocale();
const QString translatedStr = str.toString(mApplicationDomain.isEmpty() ? str.applicationDomain().constData() : mApplicationDomain.constData());
qDebug() << " translatedStr"<< translatedStr << " domain :" << str.applicationDomain() << " currentLocale() "<< currentLocale() << " Specific applicationDomain" << mApplicationDomain;
return translatedStr;
}
......@@ -122,3 +122,8 @@ QString GrantleeKi18nLocalizer::currentLocale() const
}
return locale;
}
void GrantleeKi18nLocalizer::setApplicationDomain(const QByteArray &domain)
{
mApplicationDomain = domain;
}
......@@ -45,12 +45,16 @@ public:
// Only exception, Grantlee's implementation is not using QLocale for this
// for some reason
QString localizeMonetaryValue(qreal value, const QString &currenctCode) const Q_DECL_OVERRIDE;
QString localizeMonetaryValue(qreal value, const QString &currentCode) const Q_DECL_OVERRIDE;
QString currentLocale() const Q_DECL_OVERRIDE;
void setApplicationDomain(const QByteArray &domain);
private:
QString processArguments(const KLocalizedString &str,
const QVariantList &arguments) const;
QByteArray mApplicationDomain;
};
#endif // GRANTLEEKI18NLOCALIZER_H
......@@ -80,12 +80,12 @@ void ThemePrivate::setupLoader()
sEngine->addTemplateLoader(loader);
}
Grantlee::Context ThemePrivate::createContext(const QVariantHash &data)
Grantlee::Context ThemePrivate::createContext(const QVariantHash &data, const QByteArray &applicationDomain)
{
if (!sLocalizer) {
sLocalizer.reset(new GrantleeKi18nLocalizer());
}
sLocalizer->setApplicationDomain(applicationDomain);
Grantlee::Context ctx(data);
ctx.setLocalizer(sLocalizer);
return ctx;
......@@ -198,7 +198,7 @@ QString Theme::authorEmail() const
return d->email;
}
QString Theme::render(const QString &templateName, const QVariantHash &data)
QString Theme::render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain)
{
if (!d->loader) {
d->setupLoader();
......@@ -215,7 +215,7 @@ QString Theme::render(const QString &templateName, const QVariantHash &data)
return d->errorTemplate(i18n("Template parsing error"), templateName, tpl);
}
Grantlee::Context ctx = d->createContext(data);
Grantlee::Context ctx = d->createContext(data, applicationDomain);
const QString result = tpl->render(&ctx);
if (tpl->error()) {
return d->errorTemplate(i18n("Template rendering error"), templateName, tpl);
......
......@@ -53,7 +53,7 @@ public:
QString author() const;
QString authorEmail() const;
QString render(const QString &templateName, const QVariantHash &data);
QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray());
static void addPluginPath(const QString &path);
......
......@@ -37,7 +37,7 @@ public:
static void setupEngine();
void setupLoader();
Grantlee::Context createContext(const QVariantHash &data = QVariantHash());
Grantlee::Context createContext(const QVariantHash &data = QVariantHash(), const QByteArray &applicationDomain = QByteArray());
QString errorTemplate(const QString &reason,
const QString &templateName,
const Grantlee::Template &errorTemplate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment