mirror of
https://github.com/ppy/osu
synced 2025-01-21 13:23:13 +00:00
Use ToQuantity for words with number prefixes
This commit is contained in:
parent
05aa80b184
commit
2241e1af9d
@ -4,6 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -189,14 +190,9 @@ namespace osu.Game.Overlays
|
||||
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint);
|
||||
if (ResultAmounts == null) return;
|
||||
|
||||
resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " +
|
||||
pluralize("Song", ResultAmounts.Songs) + ", " +
|
||||
pluralize("Tag", ResultAmounts.Tags);
|
||||
}
|
||||
|
||||
private string pluralize(string prefix, int value)
|
||||
{
|
||||
return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s");
|
||||
resultCountsText.Text = "Artist".ToQuantity(ResultAmounts.Artists) + ", " +
|
||||
"Song".ToQuantity(ResultAmounts.Songs) + ", " +
|
||||
"Tag".ToQuantity(ResultAmounts.Tags);
|
||||
}
|
||||
|
||||
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.Header;
|
||||
using osu.Game.Users;
|
||||
using Humanizer;
|
||||
|
||||
namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
@ -401,7 +402,7 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
infoTextLeft.NewLine();
|
||||
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;
|
||||
if (!string.IsNullOrEmpty(websiteWithoutProtcol))
|
||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
}
|
||||
}, 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 =>
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using System.Linq;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Input.Bindings;
|
||||
using Humanizer;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -263,14 +264,14 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = $"{retries:n0}",
|
||||
Text = "time".ToQuantity(retries),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = $" time{(retries == 1 ? "" : "s")} in this session",
|
||||
Text = " in this session",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
Font = OsuFont.GetFont(size: 18),
|
||||
|
Loading…
Reference in New Issue
Block a user