mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Merge pull request #4357 from Joehuu/toquantity-1
Use ToQuantity instead for words with number prefixes
This commit is contained in:
@ -4,6 +4,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -190,14 +191,9 @@ namespace osu.Game.Overlays
|
|||||||
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint);
|
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint);
|
||||||
if (ResultAmounts == null) return;
|
if (ResultAmounts == null) return;
|
||||||
|
|
||||||
resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " +
|
resultCountsText.Text = "Artist".ToQuantity(ResultAmounts.Artists) + ", " +
|
||||||
pluralize("Song", ResultAmounts.Songs) + ", " +
|
"Song".ToQuantity(ResultAmounts.Songs) + ", " +
|
||||||
pluralize("Tag", ResultAmounts.Tags);
|
"Tag".ToQuantity(ResultAmounts.Tags);
|
||||||
}
|
|
||||||
|
|
||||||
private string pluralize(string prefix, int value)
|
|
||||||
{
|
|
||||||
return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void recreatePanels(PanelDisplayStyle displayStyle)
|
private void recreatePanels(PanelDisplayStyle displayStyle)
|
||||||
|
@ -19,6 +19,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Overlays.Profile.Components;
|
using osu.Game.Overlays.Profile.Components;
|
||||||
using osu.Game.Overlays.Profile.Header;
|
using osu.Game.Overlays.Profile.Header;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using Humanizer;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
@ -401,7 +402,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
infoTextLeft.NewLine();
|
infoTextLeft.NewLine();
|
||||||
infoTextLeft.AddText("Contributed ", lightText);
|
infoTextLeft.AddText("Contributed ", lightText);
|
||||||
infoTextLeft.AddLink($@"{user.PostCount} forum posts", url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic);
|
infoTextLeft.AddLink("forum post".ToQuantity(user.PostCount), url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic);
|
||||||
|
|
||||||
string websiteWithoutProtcol = user.Website;
|
string websiteWithoutProtcol = user.Website;
|
||||||
if (!string.IsNullOrEmpty(websiteWithoutProtcol))
|
if (!string.IsNullOrEmpty(websiteWithoutProtcol))
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
ParticipantCount.BindValueChanged(count => summary.Text = $"{count.NewValue:#,0}{" participant".Pluralize(count.NewValue == 1)}", true);
|
ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true);
|
||||||
|
|
||||||
/*Participants.BindValueChanged(e =>
|
/*Participants.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using Humanizer;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -263,14 +264,14 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = $"{retries:n0}",
|
Text = "time".ToQuantity(retries),
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = $" time{(retries == 1 ? "" : "s")} in this session",
|
Text = " in this session",
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||||
Font = OsuFont.GetFont(size: 18),
|
Font = OsuFont.GetFont(size: 18),
|
||||||
|
Reference in New Issue
Block a user