From kde-commits Mon Dec 31 22:40:00 2007 From: Chusslove Illich Date: Mon, 31 Dec 2007 22:40:00 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma Message-Id: <1199140800.623349.30701.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119914081021555 SVN commit 755278 by ilic: i18n fixes; 12/24-hr switch is not world-wide applicable, let the formats be localizable to give translators at least some chance. M +32 -8 applets/digital-clock/clock.cpp M +7 -2 dataengines/time/timeengine.cpp --- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.cpp #755277:755278 @@ -280,17 +280,35 @@ if (m_showDate || m_showTimezone) { QString dateString; if (m_showDate) { - dateString = m_date.toString("d MMM"); + QString day = m_date.toString("d"); + QString month = m_date.toString("MMM"); + if (m_showYear) { + QString year = m_date.toString("yyyy"); + dateString = i18nc("@label Short date: " + "%1 day in the month, %2 short month name, %3 year", + "%1 %2 %3", day, month, year); + } + else { + dateString = i18nc("@label Short date: " + "%1 day in the month, %2 short month name", + "%1 %2", day, month); + } if (m_showDay) { QString weekday = QDate::shortDayName(m_date.dayOfWeek()); - dateString = weekday + ", " + dateString; + dateString = i18nc("@label Day of the week with date: " + "%1 short day name, %2 short date", + "%1, %2", weekday, dateString); } - if (m_showYear) { - dateString = dateString + m_date.toString(" yyyy"); + if (m_showTimezone) { + QString timezone = m_prettyTimezone; + timezone.replace("_", " "); + dateString = i18nc("@label Date with timezone: " + "%1 day of the week with date, %2 timezone", + "%1 %2", dateString, timezone); } } - if (m_showTimezone) { - dateString = dateString + " " + m_prettyTimezone; + else if (m_showTimezone) { + dateString = m_prettyTimezone; dateString.replace("_", " "); } @@ -318,10 +336,16 @@ (contentsRect.height())); } QString timeString; + // FIXME: 12/24-hr distinction makes no sense in many languages. + // Instead, possibly do this: use KLocale's formatTime() by default, + // with a checkbox "Custom time format" which would allow editing + // the KLocale time format string. if (m_twentyFour) { - timeString = m_time.toString("hh:mm"); + // i18n: See http://doc.trolltech.com/4.3/qtime.html#toString + // for possible format expressions. + timeString = m_time.toString(i18nc("@item 24-hr clock format", "hh:mm")); } else { - timeString = m_time.toString("h:mm AP"); + timeString = m_time.toString(i18nc("@item 12-hr clock format", "h:mm AP")); } m_plainClockFont.setBold(m_plainClockFontBold); --- trunk/KDE/kdebase/workspace/plasma/dataengines/time/timeengine.cpp #755277:755278 @@ -36,6 +36,10 @@ { Q_UNUSED(args) setMinimumUpdateInterval(333); + + // To have translated timezone names + // (effectively a noop if the catalog is already present). + KGlobal::locale()->insertCatalog("timezones4"); } TimeEngine::~TimeEngine() @@ -73,8 +77,9 @@ timezone = tz; } - setData(tz, I18N_NOOP("Timezone"), timezone); - QStringList tzParts = timezone.split("/"); + QString trTimezone = i18n(timezone.toUtf8()); + setData(tz, I18N_NOOP("Timezone"), trTimezone); + QStringList tzParts = trTimezone.split("/"); setData(tz, I18N_NOOP("Timezone Continent"), tzParts.takeFirst()); setData(tz, I18N_NOOP("Timezone City"), tzParts.takeFirst());