diff --git a/CHANGELOG.md b/CHANGELOG.md index f9a8c76f..d659ce12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [#273] Preview system now calls `Refresh` to avoid double computation +- [#266] NDMF language defaults to being based on the system language. + ### Removed - [#277] The `ReactiveQuery` API has been removed to reduce the scope and complexity of this upcoming release diff --git a/Editor/UI/Localization/LanguagePrefs.cs b/Editor/UI/Localization/LanguagePrefs.cs index 7344e198..a115cfbb 100644 --- a/Editor/UI/Localization/LanguagePrefs.cs +++ b/Editor/UI/Localization/LanguagePrefs.cs @@ -34,7 +34,7 @@ public static class LanguagePrefs private static void Init() { // Exiting playmode destroys the dynamic font assets we create, so we need to recreate and reapply them. - Language = EditorPrefs.GetString(EditorPrefKey, "en-us").ToLowerInvariant(); + Language = EditorPrefs.GetString(EditorPrefKey, GetSystemLanguage()).ToLowerInvariant(); EditorApplication.playModeStateChanged += evt => { foreach (var fontCallback in _fontUpdateCallbacks.Values) @@ -44,6 +44,26 @@ private static void Init() }; } + private static string GetSystemLanguage() + { + switch (Application.systemLanguage) + { + case SystemLanguage.Japanese: + return "ja-jp"; + case SystemLanguage.ChineseSimplified: + return "zh-hans"; + case SystemLanguage.ChineseTraditional: + return "zh-hant"; + case SystemLanguage.Korean: + return "ko-kr"; + case SystemLanguage.Chinese: + // fall through - this case is ambiguous and culturally sensitive, so we'll treat this case as an + // unknown language. + default: + return "en-us"; + } + } + /// /// The currently selected language ID, e.g. "en-us". /// diff --git a/Editor/UI/Localization/zh-Hans.po b/Editor/UI/Localization/zh-Hans.po new file mode 100644 index 00000000..b972c1bd --- /dev/null +++ b/Editor/UI/Localization/zh-Hans.po @@ -0,0 +1,6 @@ +msgid "" +msgstr "" +"Language: zh-Hans\n" + +#: This file is kept just so the zh-Hans (chinese simplified) language is registered, so that we can safely default to +#: it. However, we do not yet have any community translations for this language. \ No newline at end of file diff --git a/Editor/UI/Localization/zh-Hans.po.meta b/Editor/UI/Localization/zh-Hans.po.meta new file mode 100644 index 00000000..c147cb3d --- /dev/null +++ b/Editor/UI/Localization/zh-Hans.po.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6916b2591b094f87a5d0fff8ae0b2186 +timeCreated: 1718674074 \ No newline at end of file