summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorNiels Weber <niels.weber@digia.com>2015-01-29 12:29:09 +0100
committerNiels Weber <niels.weber@theqtcompany.com>2015-02-09 10:06:46 +0000
commit52ebff797da4a29f61459fd6d183d2e07498c591 (patch)
treeafe58065d5ad36faee01a9f5268c57fa006e9a3e /src/libs
parent04dcfb68cb7e2c3995f0b66b1bbd926b1864819b (diff)
Add a translation example
Add an example showing how the translation of components works. Also document this. Make translated license files work again. Task-number: QTIFW-469 Change-Id: I3c13ecc9941b09370d0713b19b2683b42454c43c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/component.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 22b7143b0..be5d7e1b0 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -284,6 +284,10 @@ void Component::loadDataFromPackage(const LocalPackage &package)
setValue(scCurrentState, scInstalled);
}
+/*!
+ Sets variables according to the values set in the package.xml file of \a package.
+ Also loads UI files, licenses and translations if they are referenced in the package.xml.
+*/
void Component::loadDataFromPackage(const Package &package)
{
Q_ASSERT(&package);
@@ -603,9 +607,15 @@ void Component::loadLicenses(const QString &directory, const QHash<QString, QVar
QFileInfo fileInfo(fileName);
QFile file(QString::fromLatin1("%1%2_%3.%4").arg(directory, fileInfo.baseName(),
QLocale().name().toLower(), fileInfo.completeSuffix()));
+ if (!file.exists()) {
+ file.setFileName(QString::fromLatin1("%1%2_%3.%4").arg(directory, fileInfo.baseName(),
+ QLocale().name().left(2), fileInfo.completeSuffix()));
+ }
+
if (!file.open(QIODevice::ReadOnly)) {
// No translated license, use untranslated file
- qDebug("Unable to open translated license file. Using untranslated fallback.");
+ qDebug().nospace() << "Unable to open translated license file" << file.fileName()
+ << ". Using untranslated fallback.";
file.setFileName(directory + fileName);
if (!file.open(QIODevice::ReadOnly)) {
throw Error(tr("Could not open the requested license file '%1'. Error: %2").arg(fileName,