Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed plurals of time played #6937

Merged
merged 6 commits into from
Nov 3, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 41 additions & 2 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,26 +384,65 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
const qint64 minutes_played = (elapsed_seconds % 3600) / 60;
const qint64 seconds_played = (elapsed_seconds % 3600) % 60;

// For anyone who was wondering why there need to be so many cases:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*needs
:^)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol no

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For anyone who was wondering why so many cases are needed:"? Kappa

// 1. Using variables won't work for future localization due to varying sentence structure in different languages.
// 2. The provided Qt functionality only works if localization is already enabled
// 3. The provided Qt functionality only works for single variables

if (hours_played <= 0)
{
if (minutes_played <= 0)
{
if (seconds_played == 1)
{
return tr("%0 second").arg(seconds_played);
}
return tr("%0 seconds").arg(seconds_played);
}

if (seconds_played <= 0)
{
if (minutes_played == 1)
{
return tr("%0 minute").arg(minutes_played);
}
return tr("%0 minutes").arg(minutes_played);
}

if (minutes_played == 1 && seconds_played == 1)
{
return tr("%0 minute and %1 second").arg(minutes_played).arg(seconds_played);
}
if (minutes_played == 1)
{
return tr("%0 minute and %1 seconds").arg(minutes_played).arg(seconds_played);
}
if (seconds_played == 1)
{
return tr("%0 minutes and %1 second").arg(minutes_played).arg(seconds_played);
}
return tr("%0 minutes and %1 seconds").arg(minutes_played).arg(seconds_played);
}

if (minutes_played <= 0)
{
if (hours_played == 1)
{
return tr("%0 hour").arg(hours_played);
}
return tr("%0 hours").arg(hours_played);
}

if (hours_played == 1 && minutes_played == 1)
{
return tr("%0 hour and %1 minute").arg(hours_played).arg(minutes_played);
}
if (hours_played == 1)
{
return tr("%0 hour and %1 minutes").arg(hours_played).arg(minutes_played);
}
if (minutes_played == 1)
{
return tr("%0 hours and %1 minute").arg(hours_played).arg(minutes_played);
}
return tr("%0 hours and %1 minutes").arg(hours_played).arg(minutes_played);
}

Expand Down