Commit 2ce7b6c4 authored by Łukasz Wojniłowicz's avatar Łukasz Wojniłowicz
Browse files

Add length columns to CatalogModelColumns

Summary:
This patch adds two columns to Translation Units toolview:
1) Source length,
2) Target length.
The columns display length of text in source and target columns
respectively.

The columns are useful in case of:
1) lots of translation units,
2) great variability in length between translation units.

The approach then is as follows:
1) sort translation units by source length column,
2) translate consecutively from the shortest to the longest source
string.

Advantage is in enabling translator to deliver more translated
translation units at given time compared to conventional approach:
1) sort translation units by entry column,
2) translate consecutively encountering mixed length source string.

The time to fully translate a file with translation units remains
unchanged.

Reviewers: ltoscano, sdepiets, aacid

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D26477
parent 717a8d5d
......@@ -131,6 +131,10 @@ QVariant CatalogTreeModel::headerData(int section, Qt::Orientation /*orientation
return i18nc("@title:column", "Files");
case CatalogModelColumns::TranslationStatus:
return i18nc("@title:column", "Translation Status");
case CatalogModelColumns::SourceLength:
return i18nc("@title:column Length of the original text", "Source length");
case CatalogModelColumns::TargetLength:
return i18nc("@title:column Length of the text in target language", "Target length");
default:
return {};
}
......@@ -237,6 +241,10 @@ QVariant CatalogTreeModel::data(const QModelIndex& index, int role) const
return m_catalog->context(index.row());
case CatalogModelColumns::Files:
return m_catalog->sourceFiles(index.row()).join('|');
case CatalogModelColumns::SourceLength:
return QString::number(m_catalog->msgidWithPlurals(index.row(), true).length());
case CatalogModelColumns::TargetLength:
return QString::number(m_catalog->msgstrWithPlurals(index.row(), true).length());
default:
return {};
}
......
......@@ -52,13 +52,15 @@ public:
Context,
Files,
TranslationStatus,
SourceLength,
TargetLength,
IsEmpty,
State,
IsModified,
IsPlural,
ColumnCount,
};
static const int DisplayedColumnCount = static_cast<int>(CatalogModelColumns::TranslationStatus) + 1;
static const int DisplayedColumnCount = static_cast<int>(CatalogModelColumns::TargetLength) + 1;
// Possible values in column "Translation Status".
enum class TranslationStatus {
......
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