Import Cryville.Culture in favor of ScriptUtils.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae9dab8f520fadc4194032f523ca87c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,5 @@
|
||||
using Cryville.Common.Culture;
|
||||
using Cryville.Common.Logging;
|
||||
using Cryville.Culture;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,13 +8,15 @@ namespace Cryville.Common.Font {
|
||||
public abstract class FontMatcher {
|
||||
protected FontManager Manager { get; private set; }
|
||||
public FontMatcher(FontManager manager) { Manager = manager; }
|
||||
public abstract IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false);
|
||||
public abstract IEnumerable<Typeface> MatchLanguage(LanguageId lang, bool distinctFamily = false);
|
||||
}
|
||||
public class FallbackListFontMatcher : FontMatcher {
|
||||
readonly LanguageMatching _matcher;
|
||||
static readonly string UltimateFallbackScript = "zyyy";
|
||||
public Dictionary<string, List<string>> MapScriptToTypefaces = new Dictionary<string, List<string>>();
|
||||
public static Dictionary<string, List<string>> GetDefaultWindowsFallbackMap() {
|
||||
var map = new Dictionary<string, List<string>>();
|
||||
ScriptUtils.FillKeysWithScripts(map, () => new List<string>());
|
||||
var map = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
|
||||
FillKeysWithScripts(map, () => new List<string>());
|
||||
// Reference: https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc
|
||||
map["zyyy"].Insert(0, "SimSun"); // Custom
|
||||
map["zyyy"].Insert(0, "SimHei"); // Custom
|
||||
@@ -158,8 +161,8 @@ namespace Cryville.Common.Font {
|
||||
return map;
|
||||
}
|
||||
public static Dictionary<string, List<string>> GetDefaultAndroidFallbackMap() {
|
||||
var map = new Dictionary<string, List<string>>();
|
||||
ScriptUtils.FillKeysWithScripts(map, () => new List<string>());
|
||||
var map = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
|
||||
FillKeysWithScripts(map, () => new List<string>());
|
||||
map["zyyy"].Insert(0, "Noto Sans CJK TC"); // TODO Modify default fallback
|
||||
map["zyyy"].Insert(0, "Noto Sans CJK JP");
|
||||
map["zyyy"].Insert(0, "Noto Sans CJK SC");
|
||||
@@ -275,9 +278,9 @@ namespace Cryville.Common.Font {
|
||||
map["sund"].Insert(0, "Noto Sans Sundanese");
|
||||
map["sylo"].Insert(0, "Noto Sans Syloti Nagri");
|
||||
map["zsym"].Insert(0, "Noto Sans Symbols");
|
||||
map["syrn"].Insert(0, "Noto Sans Syriac Eastern");
|
||||
map["syre"].Insert(0, "Noto Sans Syriac Estrangela");
|
||||
map["syrj"].Insert(0, "Noto Sans Syriac Western");
|
||||
map["syrc"].Add("Noto Sans Syriac Eastern");
|
||||
map["syrc"].Add("Noto Sans Syriac Western");
|
||||
map["syrc"].Add("Noto Sans Syriac Estrangela");
|
||||
map["tglg"].Insert(0, "Noto Sans Tagalog");
|
||||
map["tagb"].Insert(0, "Noto Sans Tagbanwa");
|
||||
map["tale"].Insert(0, "Noto Sans Tai Le");
|
||||
@@ -296,33 +299,45 @@ namespace Cryville.Common.Font {
|
||||
map["yiii"].Insert(0, "Noto Sans Yi");
|
||||
return map;
|
||||
}
|
||||
public FallbackListFontMatcher(FontManager manager) : base(manager) { }
|
||||
public override IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false) {
|
||||
if (string.IsNullOrEmpty(script)) script = ScriptUtils.UltimateFallbackScript;
|
||||
List<string> candidates;
|
||||
IEnumerable<string> candidateScripts = new string[] { script };
|
||||
while (candidateScripts != null) {
|
||||
foreach (var candidateScript in candidateScripts) {
|
||||
if (MapScriptToTypefaces.TryGetValue(candidateScript, out candidates)) {
|
||||
foreach (var candidate in candidates) {
|
||||
IReadOnlyCollection<Typeface> typefaces1;
|
||||
if (Manager.MapFullNameToTypeface.TryGetValue(candidate, out typefaces1)) {
|
||||
foreach (var typeface in typefaces1) {
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
if (distinctFamily) continue;
|
||||
IReadOnlyCollection<Typeface> typefaces2;
|
||||
if (Manager.MapNameToTypefaces.TryGetValue(candidate, out typefaces2)) {
|
||||
foreach (var typeface in typefaces2) {
|
||||
if (typefaces1.Contains(typeface)) continue;
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
}
|
||||
static void FillKeysWithScripts<T>(IDictionary<string, T> map, Func<T> value) {
|
||||
foreach (var s in IdValidity.Enumerate("script")) map.Add(s, value());
|
||||
}
|
||||
|
||||
public FallbackListFontMatcher(LanguageMatching matcher, FontManager manager) : base(manager) {
|
||||
_matcher = matcher;
|
||||
}
|
||||
public override IEnumerable<Typeface> MatchLanguage(LanguageId lang, bool distinctFamily = false) {
|
||||
var supported = MapScriptToTypefaces.Keys.Select(i => new LanguageId(i)).ToList();
|
||||
while (_matcher.Match(lang, supported, out var match, out var distance)) {
|
||||
if (distance > 40) break;
|
||||
Logger.Log("main", 0, "UI", "Matching fonts for language {0}, distance = {1}", match, distance);
|
||||
var candidates = MapScriptToTypefaces[match.Script.ToLowerInvariant()];
|
||||
foreach (var typeface in EnumerateTypefaces(candidates, distinctFamily)) {
|
||||
yield return typeface;
|
||||
}
|
||||
supported.Remove(match);
|
||||
}
|
||||
Logger.Log("main", 0, "UI", "Matching fallback fonts");
|
||||
foreach (var typeface in EnumerateTypefaces(MapScriptToTypefaces[UltimateFallbackScript], distinctFamily)) {
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
IEnumerable<Typeface> EnumerateTypefaces(List<string> candidates, bool distinctFamily) {
|
||||
foreach (var candidate in candidates) {
|
||||
IReadOnlyCollection<Typeface> typefaces1;
|
||||
if (Manager.MapFullNameToTypeface.TryGetValue(candidate, out typefaces1)) {
|
||||
foreach (var typeface in typefaces1) {
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
if (distinctFamily) continue;
|
||||
IReadOnlyCollection<Typeface> typefaces2;
|
||||
if (Manager.MapNameToTypefaces.TryGetValue(candidate, out typefaces2)) {
|
||||
foreach (var typeface in typefaces2) {
|
||||
if (typefaces1.Contains(typeface)) continue;
|
||||
yield return typeface;
|
||||
}
|
||||
}
|
||||
candidateScripts = ScriptUtils.EnumerateFallbackScripts(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Cryville.Common.Font;
|
||||
using Cryville.Culture;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -23,7 +25,7 @@ namespace Cryville.Common.Unity.UI {
|
||||
if (FontMatcher == null) return;
|
||||
_text = GetComponent<TextMeshProUGUI>();
|
||||
if (_font == null) {
|
||||
foreach (var typeface in FontMatcher.MatchScript(null, true)) {
|
||||
foreach (var typeface in FontMatcher.MatchLanguage(new LanguageId(CultureInfo.CurrentCulture.Name), true)) {
|
||||
try {
|
||||
var ifont = CreateFontAsset(typeface.File.FullName, typeface.IndexInFile);
|
||||
if (m_shader) ifont.material.shader = m_shader;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Cryville.Common.Logging;
|
||||
using Cryville.Common.Unity;
|
||||
using Cryville.Common.Unity.UI;
|
||||
using Cryville.Crtr.UI;
|
||||
using Cryville.Culture;
|
||||
using Cryville.Input;
|
||||
using Cryville.Input.Unity;
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
@@ -18,6 +19,9 @@ using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = Cryville.Common.Logging.Logger;
|
||||
using unity = UnityEngine;
|
||||
@@ -61,7 +65,7 @@ namespace Cryville.Crtr {
|
||||
Logger.Log("main", 1, "Game", "Culture: {0}, UI = {1}, System = {2}, Unity = {3}", CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture, CultureInfo.InstalledUICulture, Application.systemLanguage);
|
||||
|
||||
if (_bcflag) Logger.Log("main", 2, "Game", "Reset all settings");
|
||||
|
||||
|
||||
GameDataPath = Settings.Default.GameDataPath;
|
||||
UnityDataPath = Application.dataPath;
|
||||
|
||||
@@ -153,7 +157,13 @@ namespace Cryville.Crtr {
|
||||
Settings.Default.Save();
|
||||
|
||||
Logger.Log("main", 1, "UI", "Initializing font manager");
|
||||
TMPAutoFont.FontMatcher = new FallbackListFontMatcher(PlatformConfig.FontManager) {
|
||||
foreach (var res in Resources.LoadAll<TextAsset>("cldr/common/validity")) {
|
||||
IdValidity.Load(LoadXmlDocument(res));
|
||||
}
|
||||
var metadata = new SupplementalMetadata(LoadXmlDocument("cldr/common/supplemental/supplementalMetadata"));
|
||||
var subtags = new LikelySubtags(LoadXmlDocument("cldr/common/supplemental/likelySubtags"), metadata);
|
||||
var matcher = new LanguageMatching(LoadXmlDocument("cldr/common/supplemental/languageInfo"), subtags);
|
||||
TMPAutoFont.FontMatcher = new FallbackListFontMatcher(matcher, PlatformConfig.FontManager) {
|
||||
MapScriptToTypefaces = PlatformConfig.ScriptFontMap
|
||||
};
|
||||
TMPAutoFont.DefaultShader = Resources.Load<Shader>(PlatformConfig.TextShader);
|
||||
@@ -161,6 +171,21 @@ namespace Cryville.Crtr {
|
||||
Logger.Log("main", 1, "Game", "Initialized");
|
||||
}
|
||||
|
||||
static readonly Encoding _encoding = new UTF8Encoding(false, true);
|
||||
static readonly XmlReaderSettings _xmlSettings = new XmlReaderSettings {
|
||||
DtdProcessing = DtdProcessing.Ignore,
|
||||
};
|
||||
static XDocument LoadXmlDocument(string path) {
|
||||
return LoadXmlDocument(Resources.Load<TextAsset>(path));
|
||||
}
|
||||
static XDocument LoadXmlDocument(TextAsset asset) {
|
||||
using (var stream = new MemoryStream(_encoding.GetBytes(asset.text))) {
|
||||
using (var reader = XmlReader.Create(stream, _xmlSettings)) {
|
||||
return XDocument.Load(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool _shutdown;
|
||||
public static void Shutdown() {
|
||||
if (_shutdown) return;
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Cryville.Crtr {
|
||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
public static readonly string FileProtocolPrefix = "file:///";
|
||||
public static readonly FontManager FontManager = new FontManagerWindows();
|
||||
public static readonly Dictionary<string, List<string>> ScriptFontMap = FallbackListFontMatcher.GetDefaultWindowsFallbackMap();
|
||||
public static Dictionary<string, List<string>> ScriptFontMap => FallbackListFontMatcher.GetDefaultWindowsFallbackMap();
|
||||
public static readonly string TextShader = "TextMesh Pro/Shaders/TMP_SDF SSD";
|
||||
#elif UNITY_ANDROID
|
||||
public static readonly string FileProtocolPrefix = "file://";
|
||||
public static readonly FontManager FontManager = new FontManagerAndroid();
|
||||
public static readonly Dictionary<string, List<string>> ScriptFontMap = FallbackListFontMatcher.GetDefaultAndroidFallbackMap();
|
||||
public static Dictionary<string, List<string>> ScriptFontMap => FallbackListFontMatcher.GetDefaultAndroidFallbackMap();
|
||||
public static readonly string TextShader = "TextMesh Pro/Shaders/TMP_SDF-Mobile SSD";
|
||||
#else
|
||||
#error Unknown platform.
|
||||
|
||||
BIN
Assets/Plugins/Cryville.Culture.dll
Normal file
BIN
Assets/Plugins/Cryville.Culture.dll
Normal file
Binary file not shown.
33
Assets/Plugins/Cryville.Culture.dll.meta
Normal file
33
Assets/Plugins/Cryville.Culture.dll.meta
Normal file
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2cda6ad68093a64c829d05d1f538fc6
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
271
Assets/Plugins/Cryville.Culture.xml
Normal file
271
Assets/Plugins/Cryville.Culture.xml
Normal file
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Cryville.Culture</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Cryville.Culture.IdValidity">
|
||||
<summary>
|
||||
提供一系列基于 ID 有效性数据检查 ID 有效性的方法。
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
该类解析 CLDR 中 <see href="https://github.com/unicode-org/cldr/tree/main/common/validity"><c>common/validity</c></see> 目录中的 XML 文档。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.IdValidity.Load(System.Xml.Linq.XDocument)">
|
||||
<summary>
|
||||
从一个 XML 文档中加载有效性数据。
|
||||
</summary>
|
||||
<param name="xml">要加载的 XML 文档。</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="xml" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
<exception cref="T:System.InvalidOperationException">文档中的一个 ID 列表已被加载。</exception>
|
||||
<remarks>
|
||||
<para>
|
||||
该方法解析 CLDR 中 <see href="https://github.com/unicode-org/cldr/tree/main/common/validity"><c>common/validity</c></see> 目录中的 XML 文档。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.IdValidity.Check(System.String,System.String)">
|
||||
<summary>
|
||||
获取一个 ID 的 ID 状态。
|
||||
</summary>
|
||||
<param name="id">要检查的 ID。</param>
|
||||
<param name="type">ID 的类型。</param>
|
||||
<returns>
|
||||
ID 的 ID 状态。如果没找到 ID 则返回 <see langword="null" />。
|
||||
</returns>
|
||||
<exception cref="T:System.InvalidOperationException">没有找到或没有加载给定类型的 ID 列表。</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.IdValidity.Check(System.String,System.String,System.String)">
|
||||
<summary>
|
||||
确定一个 ID 是否处于给定的状态。
|
||||
</summary>
|
||||
<param name="id">要检查的 ID。</param>
|
||||
<param name="type">ID 的类型。</param>
|
||||
<param name="status">要检查的状态。</param>
|
||||
<returns>给定的 ID 是否处于给定的状态。</returns>
|
||||
<exception cref="T:System.InvalidOperationException">没有找到或没有加载给定类型和给定状态的 ID 列表。</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.IdValidity.Enumerate(System.String)">
|
||||
<summary>
|
||||
获取给定类型的所有 ID 的列表。
|
||||
</summary>
|
||||
<param name="type">ID 的类型。</param>
|
||||
<returns>给定类型的所有 ID 的列表。</returns>
|
||||
<exception cref="T:System.InvalidOperationException">没有找到或没有加载给定类型的 ID 列表。</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.IdValidity.Enumerate(System.String,System.String)">
|
||||
<summary>
|
||||
获取给定类型和给定状态的所有 ID 的列表。
|
||||
</summary>
|
||||
<param name="type">ID 的类型。</param>
|
||||
<param name="status">ID 的状态。</param>
|
||||
<returns>给定类型和给定状态的所有 ID 的列表。</returns>
|
||||
<exception cref="T:System.InvalidOperationException">没有找到或没有加载给定类型和给定状态的 ID 列表。</exception>
|
||||
</member>
|
||||
<member name="T:Cryville.Culture.LanguageId">
|
||||
<summary>
|
||||
表示一个 <see href="https://unicode.org/reports/tr35/#Unicode_language_identifier">Unicode 语言标识符</see>。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.Language">
|
||||
<summary>
|
||||
语言子标签。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.Script">
|
||||
<summary>
|
||||
文字子标签。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.Region">
|
||||
<summary>
|
||||
区域子标签。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.Variant">
|
||||
<summary>
|
||||
变体子标签。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.#ctor(System.String)">
|
||||
<summary>
|
||||
创建一个 <see cref="T:Cryville.Culture.LanguageId" /> 结构体的实例。
|
||||
</summary>
|
||||
<param name="str">标识符的字符串表示。</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="str" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
<exception cref="T:System.FormatException">输入的字符串格式不正确。</exception>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.IsGrandfathered">
|
||||
<summary>
|
||||
当前 Unicode 语言标识符是否表示一个<see href="https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1">保留标签</see>(grandfathered tag)。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.IsValid">
|
||||
<summary>
|
||||
当前 Unicode 语言标识符是否有效。
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
该属性通过调用 <see cref="M:Cryville.Culture.IdValidity.Check(System.String,System.String)" /> 来确定其所有子标签是否有效。获取该属性前,先调用 <see cref="M:Cryville.Culture.IdValidity.Load(System.Xml.Linq.XDocument)" /> 加载有效性数据。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="P:Cryville.Culture.LanguageId.SyntaxCanonicalized">
|
||||
<summary>
|
||||
获取当前 Unicode 语言标识符的一个标准语法版本。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.Clone(System.Boolean)">
|
||||
<summary>
|
||||
获取当前 Unicode 语言标识符的一个副本。
|
||||
</summary>
|
||||
<param name="excludeVariant">是否排除变体子标签。</param>
|
||||
<returns>当前 Unicode 语言标识符的一个副本。</returns>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.Equals(Cryville.Culture.LanguageId)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.Equals(System.Object)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.GetHashCode">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.op_Equality(Cryville.Culture.LanguageId,Cryville.Culture.LanguageId)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.op_Inequality(Cryville.Culture.LanguageId,Cryville.Culture.LanguageId)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageId.ToString">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="T:Cryville.Culture.LanguageMatching">
|
||||
<summary>
|
||||
提供基于语言匹配数据为请求的语言匹配一个应用支持的语言的方法。
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
该类解析 CLDR 中的 <see href="https://github.com/unicode-org/cldr/tree/main/common/supplemental/languageInfo.xml"><c>common/supplemental/languageInfo.xml</c></see>。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageMatching.#ctor(System.Xml.Linq.XDocument,Cryville.Culture.LikelySubtags)">
|
||||
<summary>
|
||||
创建一个 <see cref="T:Cryville.Culture.LanguageMatching" /> 类的实例。
|
||||
</summary>
|
||||
<param name="xml">
|
||||
要加载的 <c>languageInfo</c> XML 文档。
|
||||
</param>
|
||||
<param name="subtags">子标签倾向数据。</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="xml" /> 或 <paramref name="subtags" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
<exception cref="T:System.FormatException">
|
||||
给定的 <c>languageInfo</c> XML 文档无效。
|
||||
</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageMatching.GetDistance(Cryville.Culture.LanguageId,Cryville.Culture.LanguageId)">
|
||||
<summary>
|
||||
计算两个语言之间的距离。
|
||||
</summary>
|
||||
<param name="start">起点语言。</param>
|
||||
<param name="end">终点语言。</param>
|
||||
<returns>
|
||||
从 <paramref name="start" /> 语言到 <paramref name="end" /> 语言的距离。
|
||||
</returns>
|
||||
<exception cref="T:System.InvalidOperationException">无法计算距离。</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LanguageMatching.Match(Cryville.Culture.LanguageId,System.Collections.Generic.IEnumerable{Cryville.Culture.LanguageId},Cryville.Culture.LanguageId@,System.Int32@)">
|
||||
<summary>
|
||||
从支持的语言列表中为请求的语言匹配一个语言。
|
||||
</summary>
|
||||
<param name="desired">请求的语言。</param>
|
||||
<param name="supported">支持的语言列表。</param>
|
||||
<param name="match">
|
||||
匹配的语言。如果没有匹配则为 <see cref="T:Cryville.Culture.LanguageId" /> 的默认值。
|
||||
</param>
|
||||
<param name="distance">
|
||||
从 <paramref name="desired" /> 到 <paramref name="match" /> 的距离。如果没有匹配则为 <see cref="F:System.Int32.MaxValue" />。
|
||||
</param>
|
||||
<returns>匹配是否成功。</returns>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="supported" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
</member>
|
||||
<member name="T:Cryville.Culture.LikelySubtags">
|
||||
<summary>
|
||||
提供基于子标签倾向数据最大化和最小化 Unicode 语言标识符的方法。
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
该类解析 CLDR 中的 <see href="https://github.com/unicode-org/cldr/tree/main/common/supplemental/likelySubtags.xml"><c>common/supplemental/likelySubtags.xml</c></see>。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LikelySubtags.#ctor(System.Xml.Linq.XDocument,Cryville.Culture.SupplementalMetadata)">
|
||||
<summary>
|
||||
创建一个 <see cref="T:Cryville.Culture.LikelySubtags" /> 类的实例。
|
||||
</summary>
|
||||
<param name="xml">
|
||||
要加载的 <c>likelySubtags</c> XML 文档。
|
||||
</param>
|
||||
<param name="metadata">别名数据。</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="xml" /> 或 <paramref name="metadata" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LikelySubtags.AddLikelySubtags(Cryville.Culture.LanguageId)">
|
||||
<summary>
|
||||
最大化一个 Unicode 语言标识符。
|
||||
</summary>
|
||||
<param name="source">要最大化的 Unicode 语言标识符。</param>
|
||||
<returns>最大化的 Unicode 语言标识符。</returns>
|
||||
<exception cref="T:System.Collections.Generic.KeyNotFoundException">没有找到匹配的子标签倾向。</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.LikelySubtags.RemoveLikelySubtags(Cryville.Culture.LanguageId,System.Boolean)">
|
||||
<summary>
|
||||
最小化一个 Unicode 语言标识符。
|
||||
</summary>
|
||||
<param name="source">要最小化的 Unicode 语言标识符。</param>
|
||||
<param name="favoringScript">是否倾向保留文字子标签而不是区域子标签。</param>
|
||||
<returns>最小化的 Unicode 语言标识符。</returns>
|
||||
<exception cref="T:System.Collections.Generic.KeyNotFoundException">没有找到匹配的子标签倾向。</exception>
|
||||
</member>
|
||||
<member name="T:Cryville.Culture.SupplementalMetadata">
|
||||
<summary>
|
||||
提供基于别名数据将一个别名 ID 转换为其标准形式的方法。
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
该类解析 CLDR 中的 <see href="https://github.com/unicode-org/cldr/tree/main/common/supplemental/supplementalMetadata.xml"><c>common/supplemental/supplementalMetadata.xml</c></see>。
|
||||
</para>
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.SupplementalMetadata.#ctor(System.Xml.Linq.XDocument)">
|
||||
<summary>
|
||||
创建一个 <see cref="T:Cryville.Culture.SupplementalMetadata" /> 类的实例。
|
||||
</summary>
|
||||
<param name="xml">
|
||||
要加载的 <c>supplementalMetadata</c> XML 文档。
|
||||
</param>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="xml" /> 为 <see langword="null" />。
|
||||
</exception>
|
||||
</member>
|
||||
<member name="M:Cryville.Culture.SupplementalMetadata.Canonicalize(Cryville.Culture.LanguageId)">
|
||||
<summary>
|
||||
将一个 Unicode 语言标识符内的所有别名子标签转换为其标准形式。
|
||||
</summary>
|
||||
<param name="source">要转换的 Unicode 语言标识符。</param>
|
||||
<returns>标准化的 Unicode 语言标识符。</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
7
Assets/Plugins/Cryville.Culture.xml.meta
Normal file
7
Assets/Plugins/Cryville.Culture.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b01406cf6ffd3974584b1ce899bed4fe
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 520554ce9a8205b4b91e0ff2b8011673
|
||||
guid: 627064909a347544b96a3c6fddb75b4b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
8
Assets/Resources/cldr/common.meta
Normal file
8
Assets/Resources/cldr/common.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a06c91500a9ca724a93d4aad3625076e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Resources/cldr/common/supplemental.meta
Normal file
8
Assets/Resources/cldr/common/supplemental.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d9945fc6ef34534ab8f000757423c5a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
451
Assets/Resources/cldr/common/supplemental/languageInfo.xml
Normal file
451
Assets/Resources/cldr/common/supplemental/languageInfo.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28e89533a55dcd2479f1925504591c0f
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9494
Assets/Resources/cldr/common/supplemental/likelySubtags.xml
Normal file
9494
Assets/Resources/cldr/common/supplemental/likelySubtags.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca15a9e813e6772498e98f548d5cae88
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1848
Assets/Resources/cldr/common/supplemental/supplementalMetadata.xml
Normal file
1848
Assets/Resources/cldr/common/supplemental/supplementalMetadata.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b574366c532ee74e8f3948783f9824b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Resources/cldr/common/validity.meta
Normal file
8
Assets/Resources/cldr/common/validity.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fad920a5b0edf4040afbba7d36f14c66
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/Resources/cldr/common/validity/currency.xml
Normal file
73
Assets/Resources/cldr/common/validity/currency.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE supplementalData SYSTEM '../../common/dtd/ldmlSupplemental.dtd'>
|
||||
<!--
|
||||
Copyright © 1991-2023 Unicode, Inc.
|
||||
For terms of use, see http://www.unicode.org/copyright.html
|
||||
SPDX-License-Identifier: Unicode-DFS-2016
|
||||
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
|
||||
GENERATED DATA — do not manually update!
|
||||
Generated by tool: GenerateValidityXml
|
||||
Tool documented on: http://cldr.unicode.org/development/updating-codes/update-validity-xml
|
||||
-->
|
||||
<supplementalData>
|
||||
<version number="$Revision$"/>
|
||||
<idValidity>
|
||||
<id type='currency' idStatus='regular'> <!-- 154 items -->
|
||||
AED AFN ALL AMD ANG AOA ARS AUD AWG AZN
|
||||
BAM BBD BDT BGN BHD BIF BMD BND BOB BRL BSD BTN BWP BYN BZD
|
||||
CAD CDF CHF CLP CNY COP CRC CUC CUP CVE CZK
|
||||
DJF DKK DOP DZD
|
||||
EGP ERN ETB EUR
|
||||
FJD FKP
|
||||
GBP GEL GHS GIP GMD GNF GTQ GYD
|
||||
HKD HNL HTG HUF
|
||||
IDR ILS INR IQD IRR ISK
|
||||
JMD JOD JPY
|
||||
KES KGS KHR KMF KPW KRW KWD KYD KZT
|
||||
LAK LBP LKR LRD LSL LYD
|
||||
MAD MDL MGA MKD MMK MNT MOP MRU MUR MVR MWK MXN MYR MZN
|
||||
NAD NGN NIO NOK NPR NZD
|
||||
OMR
|
||||
PAB PEN PGK PHP PKR PLN PYG
|
||||
QAR
|
||||
RON RSD RUB RWF
|
||||
SAR SBD SCR SDG SEK SGD SHP SLE SOS SRD SSP STN SYP SZL
|
||||
THB TJS TMT TND TOP TRY TTD TWD TZS
|
||||
UAH UGX USD UYU UZS
|
||||
VES VND VUV
|
||||
WST
|
||||
XAF XCD XOF XPF
|
||||
YER
|
||||
ZAR ZMW
|
||||
</id>
|
||||
<!-- Deprecated values are those that are not legal tender in some country after 2023.
|
||||
More detailed usage information needed for some implementations is in supplemental data. -->
|
||||
<id type='currency' idStatus='deprecated'> <!-- 150 items -->
|
||||
ADP AFA ALK AOK AON AOR ARA ARL~M ARP ATS AZM
|
||||
BAD BAN BEC BEF BEL BGL~M BGO BOL BOP BOV BRB~C BRE BRN BRR BRZ BUK BYB BYR
|
||||
CHE CHW CLE~F CNH CNX COU CSD CSK CYP
|
||||
DDM DEM
|
||||
ECS ECV EEK ESA~B ESP
|
||||
FIM FRF
|
||||
GEK GHC GNS GQE GRD GWE GWP
|
||||
HRD HRK
|
||||
IEP ILP ILR ISJ ITL
|
||||
KRH KRO
|
||||
LTL LTT LUC LUF LUL LVL LVR
|
||||
MAF MCF MDC MGF MKN MLF MRO MTL MTP MVP MXP MXV MZE MZM
|
||||
NIC NLG
|
||||
PEI PES PLZ PTE
|
||||
RHD ROL RUR
|
||||
SDD SDP SIT SKK SLL SRG STD SUR SVC
|
||||
TJR TMM TPE TRL
|
||||
UAK UGS USN USS UYI UYP UYW
|
||||
VEB VED VEF VNN
|
||||
XAG XAU XBA~D XDR XEU XFO XFU XPD XPT XRE XSU XTS XUA
|
||||
YDD YUD YUM~N YUR
|
||||
ZAL ZMK ZRN ZRZ ZWD ZWL ZWR
|
||||
</id>
|
||||
<id type='currency' idStatus='unknown'> <!-- 1 item -->
|
||||
XXX
|
||||
</id>
|
||||
</idValidity>
|
||||
</supplementalData>
|
||||
7
Assets/Resources/cldr/common/validity/currency.xml.meta
Normal file
7
Assets/Resources/cldr/common/validity/currency.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a294e0a8e25da0f41b99488499e64ce5
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
664
Assets/Resources/cldr/common/validity/language.xml
Normal file
664
Assets/Resources/cldr/common/validity/language.xml
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Resources/cldr/common/validity/language.xml.meta
Normal file
7
Assets/Resources/cldr/common/validity/language.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c2d9503edd6718449f832993cd5c215
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Assets/Resources/cldr/common/validity/region.xml
Normal file
79
Assets/Resources/cldr/common/validity/region.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE supplementalData SYSTEM '../../common/dtd/ldmlSupplemental.dtd'>
|
||||
<!--
|
||||
Copyright © 1991-2023 Unicode, Inc.
|
||||
For terms of use, see http://www.unicode.org/copyright.html
|
||||
SPDX-License-Identifier: Unicode-DFS-2016
|
||||
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
|
||||
GENERATED DATA — do not manually update!
|
||||
Generated by tool: GenerateValidityXml
|
||||
Tool documented on: http://cldr.unicode.org/development/updating-codes/update-validity-xml
|
||||
-->
|
||||
<supplementalData>
|
||||
<version number="$Revision$"/>
|
||||
<idValidity>
|
||||
<id type='region' idStatus='regular'> <!-- 257 items -->
|
||||
AC~G AI AL~M AO AQ~U AW~X AZ
|
||||
BA~B BD~J BL~O BQ~T BV~W BY~Z
|
||||
CA CC~D CF~I CK~R CU~Z
|
||||
DE DG DJ~K DM DO DZ
|
||||
EA EC EE EG~H ER~T
|
||||
FI~K FM FO FR
|
||||
GA~B GD~I GL~N GP~U GW GY
|
||||
HK HM~N HR HT~U
|
||||
IC~E IL~O IQ~T
|
||||
JE JM JO~P
|
||||
KE KG~I KM~N KP KR KW KY~Z
|
||||
LA~C LI LK LR~V LY
|
||||
MA MC~H MK~Z
|
||||
NA NC NE~G NI NL NO~P NR NU NZ
|
||||
OM
|
||||
PA PE~H PK~N PR~T PW PY
|
||||
QA
|
||||
RE RO RS RU RW
|
||||
SA~E SG~O SR~T SV SX~Z
|
||||
TA TC~D TF~H TJ~O TR TT TV~W TZ
|
||||
UA UG UM US UY~Z
|
||||
VA VC VE VG VI VN VU
|
||||
WF WS
|
||||
XK
|
||||
YE YT
|
||||
ZA ZM ZW
|
||||
</id>
|
||||
<id type='region' idStatus='special'> <!-- 2 items -->
|
||||
XA~B
|
||||
</id>
|
||||
<id type='region' idStatus='macroregion'> <!-- 35 items -->
|
||||
001~3 005 009 011 013~5 017~9 021 029 030 034~5 039 053~4 057 061
|
||||
142~3 145 150~1 154~5
|
||||
202
|
||||
419
|
||||
EU EZ
|
||||
QO
|
||||
UN
|
||||
</id>
|
||||
<id type='region' idStatus='deprecated'> <!-- 12 items -->
|
||||
AN
|
||||
BU
|
||||
CS
|
||||
DD
|
||||
FX
|
||||
NT
|
||||
QU
|
||||
SU
|
||||
TP
|
||||
YD YU
|
||||
ZR
|
||||
</id>
|
||||
<id type='region' idStatus='reserved'> <!-- 13 items -->
|
||||
AA
|
||||
QM~N QP~T QV~Z
|
||||
</id>
|
||||
<id type='region' idStatus='private_use'> <!-- 23 items -->
|
||||
XC~J XL~Z
|
||||
</id>
|
||||
<id type='region' idStatus='unknown'> <!-- 1 item -->
|
||||
ZZ
|
||||
</id>
|
||||
</idValidity>
|
||||
</supplementalData>
|
||||
7
Assets/Resources/cldr/common/validity/region.xml.meta
Normal file
7
Assets/Resources/cldr/common/validity/region.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1506f1ea2ae5f6a4d8b5cd4923bad76e
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/Resources/cldr/common/validity/script.xml
Normal file
58
Assets/Resources/cldr/common/validity/script.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE supplementalData SYSTEM '../../common/dtd/ldmlSupplemental.dtd'>
|
||||
<!--
|
||||
Copyright © 1991-2022 Unicode, Inc.
|
||||
For terms of use, see http://www.unicode.org/copyright.html
|
||||
SPDX-License-Identifier: Unicode-DFS-2016
|
||||
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
|
||||
GENERATED DATA — do not manually update!
|
||||
Generated by tool: GenerateValidityXml
|
||||
Tool documented on: http://cldr.unicode.org/development/updating-codes/update-validity-xml
|
||||
-->
|
||||
<supplementalData>
|
||||
<version number="$Revision$"/>
|
||||
<idValidity>
|
||||
<id type='script' idStatus='regular'> <!-- 167 items -->
|
||||
Adlm Aghb Ahom Arab Armi Armn Avst
|
||||
Bali Bamu Bass Batk Beng Bhks Bopo Brah~i Bugi Buhd
|
||||
Cakm Cans Cari Cham Cher Chrs Copt Cpmn Cprt Cyrl
|
||||
Deva Diak Dogr Dsrt Dupl
|
||||
Egyp Elba Elym Ethi
|
||||
Geor Glag Gong Gonm Goth Gran Grek Gujr Guru
|
||||
Hanb Hang Hani Hano Hans~t Hatr Hebr Hira Hluw Hmng Hmnp Hrkt Hung
|
||||
Ital
|
||||
Jamo Java Jpan
|
||||
Kali Kana Kawi Khar Khmr Khoj Kits Knda Kore Kthi
|
||||
Lana Laoo Latn Lepc Limb Lina~b Lisu Lyci Lydi
|
||||
Mahj Maka Mand Mani Marc Medf Mend Merc Mero Mlym Modi Mong Mroo Mtei Mult Mymr
|
||||
Nagm Nand Narb Nbat Newa Nkoo Nshu
|
||||
Ogam Olck Orkh Orya Osge Osma Ougr
|
||||
Palm Pauc Perm Phag Phli Phlp Phnx Plrd Prti
|
||||
Rjng Rohg Runr
|
||||
Samr Sarb Saur Sgnw Shaw Shrd Sidd Sind Sinh Sogd Sogo Sora Soyo Sund Sylo Syrc
|
||||
Tagb Takr Tale Talu Taml Tang Tavt Telu Tfng Tglg Thaa Thai Tibt Tirh Tnsa Toto
|
||||
Ugar
|
||||
Vaii Vith
|
||||
Wara Wcho
|
||||
Xpeo Xsux
|
||||
Yezi Yiii Zanb
|
||||
</id>
|
||||
<id type='script' idStatus='special'> <!-- 9 items -->
|
||||
Aran
|
||||
Qaag
|
||||
Zinh Zmth Zsye Zsym Zxxx Zyyy
|
||||
</id>
|
||||
<id type='script' idStatus='deprecated'> <!-- 1 item -->
|
||||
Qaai
|
||||
</id>
|
||||
<id type='script' idStatus='reserved'> <!-- 14 items -->
|
||||
Qaaa~f Qaah Qaaj~p
|
||||
</id>
|
||||
<id type='script' idStatus='private_use'> <!-- 34 items -->
|
||||
Qaaq~z Qaba~x
|
||||
</id>
|
||||
<id type='script' idStatus='unknown'> <!-- 1 item -->
|
||||
Zzzz
|
||||
</id>
|
||||
</idValidity>
|
||||
</supplementalData>
|
||||
7
Assets/Resources/cldr/common/validity/script.xml.meta
Normal file
7
Assets/Resources/cldr/common/validity/script.xml.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac3294783975d1541807d312b8e99cba
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
268
Assets/Resources/cldr/common/validity/subdivision.xml
Normal file
268
Assets/Resources/cldr/common/validity/subdivision.xml
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba6482cecb2178b4aa803ff753309657
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user