diff options
| author | Lasse Liehu <[email protected]> | 2015-04-10 02:53:05 +0300 |
|---|---|---|
| committer | Lasse Liehu <[email protected]> | 2015-04-23 17:40:33 +0300 |
| commit | 82bf562c34204d585df67594feab844cf9b599a1 (patch) | |
| tree | baa8f1cbdd6cc77a633147739f6d4f13e59f081c /src/kitemviews | |
| parent | d4475653db4dd57a0534adaa4159067431e56e6b (diff) | |
Enable translation scripting for date groups
This allows to work around limitations in Qt's date formatting.
Examples:
* Uppercasing the first character in a string because it's a title:
Day of the week and month names returned by QDateTime::toString
are usually lowercase.
* Correcting the noun case of a month name from "of [month]" to
"in [month]" in Finnish: "of [month]" is correct when talking
about a specific day, but wrong when talking about a specific month.
REVIEW: 123278
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 705b325b6..5f6fed0dc 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1943,7 +1943,9 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const case 1: newGroupValue = i18nc("@title:group Date", "Yesterday"); break; default: newGroupValue = modifiedTime.toString( - i18nc("@title:group The week day name: dddd", "dddd")); + i18nc("@title:group Date: The week day name: dddd", "dddd")); + newGroupValue = i18nc("Can be used to script translation of \"dddd\"" + "with context @title:group Date", "%1", newGroupValue); } break; case 1: @@ -1971,32 +1973,53 @@ QList<QPair<int, QVariant> > KFileItemModel::dateRoleGroups() const newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "MMMM is full month name in current locale, and yyyy is " "full year number", "'Yesterday' (MMMM, yyyy)")); + newGroupValue = i18nc("Can be used to script translation of " + "\"'Yesterday' (MMMM, yyyy)\" with context @title:group Date", + "%1", newGroupValue); } else if (daysDistance <= 7) { - newGroupValue = modifiedTime.toString(i18nc("@title:group " + newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "The week day name: dddd, MMMM is full month name " "in current locale, and yyyy is full year number", "dddd (MMMM, yyyy)")); + newGroupValue = i18nc("Can be used to script translation of " + "\"dddd (MMMM, yyyy)\" with context @title:group Date", + "%1", newGroupValue); } else if (daysDistance <= 7 * 2) { newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "MMMM is full month name in current locale, and yyyy is " "full year number", "'One Week Ago' (MMMM, yyyy)")); + newGroupValue = i18nc("Can be used to script translation of " + "\"'One Week Ago' (MMMM, yyyy)\" with context @title:group Date", + "%1", newGroupValue); } else if (daysDistance <= 7 * 3) { newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "MMMM is full month name in current locale, and yyyy is " "full year number", "'Two Weeks Ago' (MMMM, yyyy)")); + newGroupValue = i18nc("Can be used to script translation of " + "\"'Two Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", + "%1", newGroupValue); } else if (daysDistance <= 7 * 4) { newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "MMMM is full month name in current locale, and yyyy is " "full year number", "'Three Weeks Ago' (MMMM, yyyy)")); + newGroupValue = i18nc("Can be used to script translation of " + "\"'Three Weeks Ago' (MMMM, yyyy)\" with context @title:group Date", + "%1", newGroupValue); } else { newGroupValue = modifiedTime.toString(i18nc("@title:group Date: " "MMMM is full month name in current locale, and yyyy is " "full year number", "'Earlier on' MMMM, yyyy")); + newGroupValue = i18nc("Can be used to script translation of " + "\"'Earlier on' MMMM, yyyy\" with context @title:group Date", + "%1", newGroupValue); } } else { newGroupValue = modifiedTime.toString(i18nc("@title:group " "The month and year: MMMM is full month name in current locale, " "and yyyy is full year number", "MMMM, yyyy")); + newGroupValue = i18nc("Can be used to script translation of " + "\"MMMM, yyyy\" with context @title:group Date", + "%1", newGroupValue); } } |
