[packagechooser] Load translated strings as well

- This makes it possible to put the translations into the config
   file, and have them displayed when the Calamares language changes.
This commit is contained in:
Adriaan de Groot 2019-08-06 12:02:29 +02:00
parent 4febe477cf
commit 6e05a1ef05
3 changed files with 53 additions and 29 deletions

View file

@ -232,31 +232,7 @@ PackageChooserViewStep::fillModel( const QVariantList& items )
continue;
}
QString id = CalamaresUtils::getString( item_map, "id" );
QString package = CalamaresUtils::getString( item_map, "package" );
QString name = CalamaresUtils::getString( item_map, "name" );
QString description = CalamaresUtils::getString( item_map, "description" );
QString screenshot = CalamaresUtils::getString( item_map, "screenshot" );
if ( name.isEmpty() && id.isEmpty() )
{
name = tr( "No product" );
}
else if ( name.isEmpty() )
{
cWarning() << "PackageChooser item" << id << "has an empty name.";
continue;
}
if ( description.isEmpty() )
{
description = tr( "No description provided." );
}
if ( screenshot.isEmpty() )
{
screenshot = QStringLiteral( ":/images/no-selection.png" );
}
m_model->addPackage( PackageItem { id, package, name, description, screenshot } );
m_model->addPackage( PackageItem( item_map ) );
}
}