Use existing web localisation for most hardcoded strings

This commit is contained in:
Joseph Madamba
2022-01-27 20:53:48 -08:00
parent fb5fcdd083
commit 5e5c8e78a6
70 changed files with 224 additions and 147 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments.Buttons
{
@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Comments.Buttons
{
public ButtonContent()
{
Text = "load replies";
Text = CommentsStrings.LoadReplies;
}
}
}

View File

@ -9,6 +9,7 @@ using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using osuTK;
using osu.Framework.Allocation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments.Buttons
{
@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Comments.Buttons
{
AlwaysPresent = true,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = "show more"
Text = CommonStrings.ButtonsShowMore
}
};

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = @"Cancel"
Text = CommonStrings.ButtonsCancel
}
}
};

View File

@ -16,6 +16,7 @@ using osu.Framework.Threading;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Overlays.Comments
@ -328,7 +329,7 @@ namespace osu.Game.Overlays.Comments
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 50 },
Text = @"No comments yet."
Text = CommentsStrings.Empty
}
});
}

View File

@ -12,7 +12,9 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
@ -91,7 +93,7 @@ namespace osu.Game.Overlays.Comments
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = @"Show deleted"
Text = CommonStrings.ButtonsShowDeleted
}
},
});
@ -126,9 +128,13 @@ namespace osu.Game.Overlays.Comments
public enum CommentsSortCriteria
{
[System.ComponentModel.Description(@"Recent")]
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.New))]
New,
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Old))]
Old,
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Top))]
Top
}
}

View File

@ -2,7 +2,10 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
@ -18,7 +21,8 @@ namespace osu.Game.Overlays.Comments
private void onCurrentChanged(ValueChangedEvent<int> count)
{
Text = $@"Show More ({count.NewValue})".ToUpper();
Text = new TranslatableString(@"_", "{0} ({1})",
CommonStrings.ButtonsShowMore.ToUpper(), count.NewValue);
}
}
}

View File

@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Comments
{
Alpha = Comment.IsDeleted ? 1 : 0,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Text = "deleted"
Text = CommentsStrings.Deleted
}
}
},

View File

@ -9,6 +9,7 @@ using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
@ -39,7 +40,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 20, italics: true),
Colour = colourProvider.Light1,
Text = @"Comments"
Text = CommentsStrings.Title
},
new CircularContainer
{