[keyboard] Translate layouts as well

This commit is contained in:
Adriaan de Groot 2020-11-01 14:28:12 +01:00
parent 6863db0dc1
commit 4746754344

View File

@ -165,7 +165,18 @@ KeyboardLayoutModel::data( const QModelIndex& index, int role ) const
switch ( role )
{
case Qt::DisplayRole:
return m_layouts.at( index.row() ).second.description;
{
auto description = m_layouts.at( index.row() ).second.description;
if ( s_kbtranslator && !s_kbtranslator->isEmpty() )
{
auto s = s_kbtranslator->translate( "kb_layouts", description.toUtf8().data() );
if ( !s.isEmpty() )
{
return s;
}
}
return description;
}
case KeyboardVariantsRole:
return QVariant::fromValue( m_layouts.at( index.row() ).second.variants );
case KeyboardLayoutKeyRole: