mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:47:46 +08:00
Merge branch 'master' into fix-mismatching-localisation-xmldoc
This commit is contained in:
commit
e604a99053
@ -164,8 +164,8 @@ namespace osu.Desktop
|
||||
// user activity
|
||||
if (activity.Value != null)
|
||||
{
|
||||
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||
presence.Details = truncate(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
|
||||
presence.State = clampLength(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||
presence.Details = clampLength(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
|
||||
|
||||
if (getBeatmapID(activity.Value) is int beatmapId && beatmapId > 0)
|
||||
{
|
||||
@ -271,8 +271,15 @@ namespace osu.Desktop
|
||||
|
||||
private static readonly int ellipsis_length = Encoding.UTF8.GetByteCount(new[] { '…' });
|
||||
|
||||
private static string truncate(string str)
|
||||
private static string clampLength(string str)
|
||||
{
|
||||
// For whatever reason, discord decides that strings shorter than 2 characters cannot possibly be valid input, because... reasons?
|
||||
// And yes, that is two *characters*, or *codepoints*, not *bytes* as further down below (as determined by empirical testing).
|
||||
// That seems very questionable, and isn't even documented anywhere. So to *make it* accept such valid input,
|
||||
// just tack on enough of U+200B ZERO WIDTH SPACEs at the end.
|
||||
if (str.Length < 2)
|
||||
return str.PadRight(2, '\u200B');
|
||||
|
||||
if (Encoding.UTF8.GetByteCount(str) <= 128)
|
||||
return str;
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Are you sure you want to delete all scores? This cannot be undone!"
|
||||
/// </summary>
|
||||
public static LocalisableString Scores => new TranslatableString(getKey(@"collections"), @"Are you sure you want to delete all scores? This cannot be undone!");
|
||||
public static LocalisableString Scores => new TranslatableString(getKey(@"scores"), @"Are you sure you want to delete all scores? This cannot be undone!");
|
||||
|
||||
/// <summary>
|
||||
/// "Are you sure you want to delete all mod presets?"
|
||||
|
Loading…
Reference in New Issue
Block a user