17 行
602 B
C#
17 行
602 B
C#
using System.Globalization;
|
|
|
|
namespace UndoTree;
|
|
|
|
internal static class UndoTreeNames
|
|
{
|
|
const string TypePrefix = "Type_";
|
|
const string MemberPrefix = "Member_";
|
|
|
|
public static string OfType(Type type, CultureInfo? culture = null) => Find(TypePrefix + type.Name, culture) ?? type.Name;
|
|
|
|
public static string OfMember(string member, CultureInfo? culture = null) => Find(MemberPrefix + member, culture) ?? member;
|
|
|
|
static string? Find(string key, CultureInfo? culture)
|
|
=> Texts.ResourceManager.GetString(key, culture ?? Texts.Culture) is { Length: > 0 } text ? text : null;
|
|
}
|