[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: [Differential] [Request, 35 lines] D4023: kformat: Make it possible to properly translate relative d
From: "mpyne (Michael Pyne)" <noreply () phabricator ! kde ! org>
Date: 2017-01-08 17:09:31
Message-ID: differential-rev-PHID-DREV-hwijzkzqaog6rufbm6xi-req () phabricator ! kde ! org
[Download RAW message or body]
mpyne created this revision.
mpyne added reviewers: Frameworks, kde-i18n-doc, aspotashev.
mpyne set the repository for this revision to R244 KCoreAddons.
Restricted Application added a project: Frameworks.
REVISION SUMMARY
KFormat::formatRelativeDate \
<https://api.kde.org/frameworks/kcoreaddons/html/classKFormat.html#a6adf12070942eb8e6c9efd862edb8b65> \
allows one to obtain a human-readable date like "Last Wednesday" or "Next Thursday" \
for dates within a week of the current date.
The returned string cannot be properly translated in all languages since it's \
generated using a placeholder of the form "Next %1" -- the word Next (or Last) may \
itself need to be modified to be correct which can't be done with the current \
translation system.
The fix is just to return "Next $dayName" directly, based on the day name as \
appropriate, and allow the translators to translate the entire phrase.
The auto tests are adjusted as well. They were actually incorrect before this \
change, since the API documentation for `formatRelativeDate` makes clear that the \
date format is only applied if the date is *not* within a week of the current date.
See also Bug 335106 <https://bugs.kde.org/show_bug.cgi?id=335106>.
TEST PLAN
Change builds and installs properly, and all kcoreaddons tests continue to pass \
(with the `kformattest` autotest revised per this change).
REPOSITORY
R244 KCoreAddons
REVISION DETAIL
https://phabricator.kde.org/D4023
AFFECTED FILES
autotests/kformattest.cpp
src/lib/util/kformatprivate.cpp
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: mpyne, #frameworks, kde-i18n-doc, aspotashev
[Attachment #3 (text/html)]
<table><tr><td style="">mpyne created this revision.<br />mpyne added reviewers: \
Frameworks, kde-i18n-doc, aspotashev.<br />mpyne set the repository for this revision \
to R244 KCoreAddons.<br />Restricted Application added a project: Frameworks. </td><a \
style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; \
color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; \
background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; \
border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4023" \
rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION \
SUMMARY</strong><div><p><a \
href="https://api.kde.org/frameworks/kcoreaddons/html/classKFormat.html#a6adf12070942eb8e6c9efd862edb8b65" \
class="remarkup-link" target="_blank" \
rel="noreferrer">KFormat::formatRelativeDate</a> allows one to obtain a \
human-readable date like "Last Wednesday" or "Next Thursday" for \
dates within a week of the current date.</p>
<p>The returned string cannot be properly translated in all languages since it's \
generated using a placeholder of the form "Next %1" -- the word Next (or \
Last) may itself need to be modified to be correct which can't be done with the \
current translation system.</p>
<p>The fix is just to return "Next $dayName" directly, based on the day \
name as appropriate, and allow the translators to translate the entire phrase.</p>
<p>The auto tests are adjusted as well. They were actually incorrect before this \
change, since the API documentation for <tt style="background: #ebebeb; font-size: \
13px;">formatRelativeDate</tt> makes clear that the date format is only applied if \
the date is *not* within a week of the current date.</p>
<p>See also <a href="https://bugs.kde.org/show_bug.cgi?id=335106" \
class="remarkup-link" target="_blank" rel="noreferrer">Bug \
335106</a>.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Change builds \
and installs properly, and all kcoreaddons tests continue to pass (with the <tt \
style="background: #ebebeb; font-size: 13px;">kformattest</tt> autotest revised per \
this change).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R244 \
KCoreAddons</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D4023" \
rel="noreferrer">https://phabricator.kde.org/D4023</a></div></div><br \
/><div><strong>AFFECTED FILES</strong><div><div>autotests/kformattest.cpp<br /> \
src/lib/util/kformatprivate.cpp</div></div></div><br /><div><strong>EMAIL \
PREFERENCES</strong><div><a \
href="https://phabricator.kde.org/settings/panel/emailpreferences/" \
rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br \
/><div><strong>To: </strong>mpyne, Frameworks, kde-i18n-doc, aspotashev<br /></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic