Added support for grid columns translations. Translated columns in
addressbook plugin.
This commit is contained in:
@@ -59,6 +59,7 @@ void IMetaDataPlugin::init(const QJsonObject &metaData)
|
||||
if (IGridForm *pluginUi = dynamic_cast<IGridForm*>(m_ui))
|
||||
{
|
||||
pluginUi->setPluginId(pluginId());
|
||||
pluginUi->setTranslations(m_translations);
|
||||
}
|
||||
|
||||
if (m_service != NULL)
|
||||
@@ -87,6 +88,23 @@ void IMetaDataPlugin::parseMetaData(const QJsonObject &metaData)
|
||||
foreach (QJsonValue depVal, data.toObject()["dependecies"].toArray()) {
|
||||
m_dependsOn.append(depVal.toString());
|
||||
}
|
||||
|
||||
QJsonValue trVal = data.toObject()["translations"];
|
||||
QString locale = QLocale::system().name();
|
||||
QJsonValue trLocalized;
|
||||
foreach (QString key, trVal.toObject().keys()) {
|
||||
if (locale.contains(key, Qt::CaseInsensitive)) {
|
||||
trLocalized = trVal.toObject()[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!trLocalized.isNull())
|
||||
{
|
||||
foreach (QString key, trLocalized.toObject().keys()) {
|
||||
m_translations[key] = trLocalized.toObject()[key].toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString IMetaDataPlugin::parseLocaleText(const QJsonObject &object)
|
||||
|
||||
Reference in New Issue
Block a user