Merge pull request #18803 from Joehuu/fix-overlay-header-tab-item-localisable-string

Fix profile header tab items not localising
This commit is contained in:
Dean Herbert 2022-07-01 19:37:57 +09:00 committed by GitHub
commit 0cf58646f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,11 +3,11 @@
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -108,19 +108,7 @@ namespace osu.Game.Overlays
public OverlayHeaderTabItem(T value)
: base(value)
{
if (!(Value is Enum enumValue))
Text.Text = Value.ToString().ToLowerInvariant();
else
{
var localisableDescription = enumValue.GetLocalisableDescription();
string nonLocalisableDescription = enumValue.GetDescription();
// If localisable == non-localisable, then we must have a basic string, so .ToLowerInvariant() is used.
Text.Text = localisableDescription.Equals(nonLocalisableDescription)
? nonLocalisableDescription.ToLowerInvariant()
: localisableDescription;
}
Text.Text = value.GetLocalisableDescription().ToLower();
Text.Font = OsuFont.GetFont(size: 14);
Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation
Bar.Margin = new MarginPadding { Bottom = bar_height };