[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-framework] src/declarativeimports/calendar: [calendar] Use ui language for getting the month
From: Martin Klapetek <mklapetek () kde ! org>
Date: 2015-11-18 17:38:31
Message-ID: E1Zz6gh-0007XW-TG () scm ! kde ! org
[Download RAW message or body]
Git commit 6f3fed77d59227a9b3ec85d343ffb2443086f7fa by Martin Klapetek.
Committed on 18/11/2015 at 17:38.
Pushed by mklapetek into branch 'master'.
[calendar] Use ui language for getting the month name
Simple QDate::longMonthName(..) won't do the job as it
will return the month name using LC_DATE locale which is used
for date formatting etc. So for example, in en_US locale
and cs_CZ LC_DATE, it would return Czech month names while
it should return English ones. So here we force the first ui
language locale and take the month name from that.
BUG: 353715
REVIEW: 125705
M +12 -1 src/declarativeimports/calendar/calendar.cpp
http://commits.kde.org/plasma-framework/6f3fed77d59227a9b3ec85d343ffb2443086f7fa
diff --git a/src/declarativeimports/calendar/calendar.cpp b/src/declarativeimports/calendar/calendar.cpp
index 693c032..5515550 100644
--- a/src/declarativeimports/calendar/calendar.cpp
+++ b/src/declarativeimports/calendar/calendar.cpp
@@ -184,7 +184,18 @@ QString Calendar::dayName(int weekday) const
QString Calendar::monthName() const
{
- return QDate::longMonthName(m_displayedDate.month(), QDate::StandaloneFormat);
+ // Simple QDate::longMonthName won't do the job as it
+ // will return the month name using LC_DATE locale which is used
+ // for date formatting etc. So for example, in en_US locale
+ // and cs_CZ LC_DATE, it would return Czech month names while
+ // it should return English ones. So here we force the LANG
+ // locale and take the month name from that.
+ //
+ // See https://bugs.kde.org/show_bug.cgi?id=353715
+ const QString lang = QLocale().uiLanguages().first();
+ // If lang is empty, it will create just a system locale
+ QLocale langLocale(lang);
+ return langLocale.standaloneMonthName(m_displayedDate.month());
}
int Calendar::year() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic