// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using osu.Framework.Localisation; namespace osu.Framework.Extensions.LocalisationExtensions { public static class LocalisableStringExtensions { /// /// Returns a formatting the given to a string, along with an optional string. /// /// The value to format. /// The format string. public static LocalisableFormattableString ToLocalisableString(this IFormattable value, string? format = null) => new LocalisableFormattableString(value, format); /// /// Returns a with the specified underlying localisable string uppercased. /// /// The localisable string. /// A case transformable string with its localisable string uppercased. public static CaseTransformableString ToUpper(this LocalisableString str) => new CaseTransformableString(str, Casing.UpperCase); /// /// Returns a with the specified underlying string data uppercased. /// /// The string data. /// A case transformable string with its string data uppercased. public static CaseTransformableString ToUpper(this ILocalisableStringData data) => new LocalisableString(data).ToUpper(); /// /// Returns a with the specified underlying localisable string transformed to title case. /// /// The localisable string. /// A case transformable string with its localisable string transformed to title case. public static CaseTransformableString ToTitle(this LocalisableString str) => new CaseTransformableString(str, Casing.TitleCase); /// /// Returns a with the specified underlying string data transformed to title case. /// /// The string data. /// A case transformable string with its string data transformed to title case. public static CaseTransformableString ToTitle(this ILocalisableStringData data) => new LocalisableString(data).ToTitle(); /// /// Returns a with the specified underlying localisable string lowercased. /// /// The localisable string. /// A case transformable string with its localisable string lowercased. public static CaseTransformableString ToLower(this LocalisableString str) => new CaseTransformableString(str, Casing.LowerCase); /// /// Returns a with the specified underlying string data lowercased. /// /// The string data. /// A case transformable string with its string data lowercased. public static CaseTransformableString ToLower(this ILocalisableStringData data) => new LocalisableString(data).ToLower(); } }