Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7c2c385c authored by Albert Astals Cid's avatar Albert Astals Cid

Improve i18n handling

parent cdfe6f61
......@@ -273,7 +273,7 @@ QVariant VocabularyModel::headerData(int section, Qt::Orientation orientation, i
switch (role) {
case Qt::DisplayRole:
return VocabularyModel::columnTitle(m_document, translationId, entryColumn);
return VocabularyModel::columnTitle(m_document, translationId, entryColumn, /*addLocaleSuffix*/ true);
break;
} // switch role
} // if horizontal
......@@ -282,7 +282,7 @@ QVariant VocabularyModel::headerData(int section, Qt::Orientation orientation, i
QString VocabularyModel::columnTitle(KEduVocDocument *document, int translation, int column, bool addLocaleSuffix)
{
QString localeSuffix = (addLocaleSuffix) ? " (" + document->identifier(translation).locale() + ") " : QString();
const QString localeSuffix = document->identifier(translation).locale();
switch (column) {
case Translation:
if (document->identifierCount() - 1 < translation) {
......@@ -290,19 +290,19 @@ QString VocabularyModel::columnTitle(KEduVocDocument *document, int translation,
}
return document->identifier(translation).name(); //returns "English", "German", etc
case Pronunciation:
return i18n("Pronunciation%1", localeSuffix);
return addLocaleSuffix ? i18n("Pronunciation (%1)", localeSuffix) : i18n("Pronunciation");
case WordClass:
return i18n("Word Type%1", localeSuffix);
return addLocaleSuffix ? i18n("Word Type (%1)", localeSuffix) : i18n("Word Type");
case Synonym:
return i18n("Synonym%1", localeSuffix);
return addLocaleSuffix ? i18n("Synonym (%1)", localeSuffix) : i18n("Synonym");
case Antonym:
return i18n("Antonym%1", localeSuffix);
return addLocaleSuffix ? i18n("Antonym (%1)", localeSuffix) : i18n("Antonym");
case Example:
return i18n("Example%1", localeSuffix);
return addLocaleSuffix ? i18n("Example (%1)", localeSuffix) : i18n("Example");
case Comment:
return i18n("Comment%1", localeSuffix);
return addLocaleSuffix ? i18n("Comment (%1)", localeSuffix) : i18n("Comment");
case Paraphrase:
return i18n("Paraphrase%1", localeSuffix);
return addLocaleSuffix ? i18n("Paraphrase (%1)", localeSuffix) : i18n("Paraphrase");
}
return QString();
......
......@@ -70,7 +70,7 @@ public:
* Returns the name of the entryColumns column
* @param addLocaleSuffix controls if locale name should be added to column title
*/
static QString columnTitle(KEduVocDocument *document, int translation, int column, bool addLocaleSuffix = true);
static QString columnTitle(KEduVocDocument *document, int translation, int column, bool addLocaleSuffix);
/**
* Returns which translation this column matches. It starts from 0 and increases every
......
......@@ -114,7 +114,7 @@ void VocabularyColumnsDialog::createLanguagesLayout()
void VocabularyColumnsDialog::addLanguage(int i, QVBoxLayout *parent)
{
for (int c = 1; c < VocabularyModel::EntryColumnsMAX; c++) {
QStandardItem *item_data = new QStandardItem(VocabularyModel::columnTitle(m_doc, i, c, false));
QStandardItem *item_data = new QStandardItem(VocabularyModel::columnTitle(m_doc, i, c, /*addLocaleSuffix*/ false));
item_data->setData(QVariant(c - 1), VocabularyColumnsDialog::ColumnRole);
item_data->setData(QVariant(i), VocabularyColumnsDialog::LanguageRole);
item_data->setCheckable(true);
......
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