41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace AibisDream.Framework
|
|
{
|
|
/// <summary>
|
|
/// 项目支持的本地化语言类别。多个 Locale 可以共享同一套排版资源。
|
|
/// </summary>
|
|
public enum LocaleKind
|
|
{
|
|
Cn,
|
|
En,
|
|
Ja,
|
|
Ru,
|
|
Es,
|
|
PtBr
|
|
}
|
|
|
|
public enum TypographyProfileKind
|
|
{
|
|
ZhHans,
|
|
Japanese,
|
|
Latin,
|
|
Russian
|
|
}
|
|
|
|
public static class TypographyLocaleMapping
|
|
{
|
|
public static TypographyProfileKind GetProfileKind(LocaleKind localeKind) => localeKind switch
|
|
{
|
|
LocaleKind.Cn => TypographyProfileKind.ZhHans,
|
|
LocaleKind.Ja => TypographyProfileKind.Japanese,
|
|
LocaleKind.Ru => TypographyProfileKind.Russian,
|
|
LocaleKind.En or LocaleKind.Es or LocaleKind.PtBr => TypographyProfileKind.Latin,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(localeKind), localeKind, null)
|
|
};
|
|
|
|
public static string GetProfileKey(LocaleKind localeKind) =>
|
|
$"Typography/Profile/{GetProfileKind(localeKind)}";
|
|
}
|
|
}
|