Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(i18n): Make activity by time labels translated by locale
Browse files Browse the repository at this point in the history
  • Loading branch information
agilob authored and zetok committed May 11, 2016
1 parent 3e22593 commit f2aada8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/widget/friendlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,28 +254,30 @@ void FriendListWidget::setMode(Mode mode)
currentDate = currentDate.addMonths(-1);
}

QLocale *ql = new QLocale(Settings::getInstance().getTranslation());

CategoryWidget* categoryLast1Month = new CategoryWidget(this);
categoryLast1Month->setName(QDate::longMonthName(currentDate.month()));
categoryLast1Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast1Month);

currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast2Month = new CategoryWidget(this);
categoryLast2Month->setName(QDate::longMonthName(currentDate.month()));
categoryLast2Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast2Month);

currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast3Month = new CategoryWidget(this);
categoryLast3Month->setName(QDate::longMonthName(currentDate.month()));
categoryLast3Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast3Month);

currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast4Month = new CategoryWidget(this);
categoryLast4Month->setName(QDate::longMonthName(currentDate.month()));
categoryLast4Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast4Month);

currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast5Month = new CategoryWidget(this);
categoryLast5Month->setName(QDate::longMonthName(currentDate.month()));
categoryLast5Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast5Month);

CategoryWidget* categoryOlder = new CategoryWidget(this);
Expand All @@ -286,6 +288,9 @@ void FriendListWidget::setMode(Mode mode)
categoryNever->setName(tr("Unknown", "Category for sorting friends by activity"));
activityLayout->addWidget(categoryNever);

delete ql;
ql = 0;

QList<Friend*> friendList = FriendList::getAllFriends();
for (Friend* contact : friendList)
{
Expand Down

0 comments on commit f2aada8

Please sign in to comment.