From f63fcf122710ff963099eabe2d5275956f189c1f Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 17 Oct 2023 12:03:11 +0800 Subject: [PATCH] update editor window localization --- .../AssetBundleBuilder/BuildMapContext.cs | 2 +- .../BuildSystem}/ErrorCode.cs | 0 .../BuildSystem}/ErrorCode.cs.meta | 0 .../VisualViewers/BuildPipelineViewerBase.cs | 2 +- .../BuildPipelineViewerBase.uxml | 2 +- .../AssetBundleCollectorConfig.cs | 4 +- .../AssetBundleCollectorSettingData.cs | 8 +-- .../AssetBundleCollectorWindow.cs | 64 +++++++++++++++---- .../AssetBundleCollectorWindow.uxml | 50 +++++++-------- .../Editor/Localization/LanguageKey.cs | 33 +++++++++- .../Localization/Locales/ChineseSimplified.cs | 34 +++++++++- .../Editor/Localization/Locales/English.cs | 63 ++++++++++++++++++ .../Editor/Localization/Localization.cs | 53 +++++++++++++-- .../Editor/UIElements/UIElementsLocalize.cs | 18 ++++++ 14 files changed, 279 insertions(+), 54 deletions(-) rename Assets/YooAsset/Editor/{ => AssetBundleBuilder/BuildSystem}/ErrorCode.cs (100%) rename Assets/YooAsset/Editor/{ => AssetBundleBuilder/BuildSystem}/ErrorCode.cs.meta (100%) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs index 1ab7207..784eb5e 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs @@ -80,7 +80,7 @@ namespace YooAsset.Editor { return result; } - throw new Exception($"Not found bundle : {bundleName}"); + throw new Exception($"Should never get here ! Not found bundle : {bundleName}"); } /// diff --git a/Assets/YooAsset/Editor/ErrorCode.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/ErrorCode.cs similarity index 100% rename from Assets/YooAsset/Editor/ErrorCode.cs rename to Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/ErrorCode.cs diff --git a/Assets/YooAsset/Editor/ErrorCode.cs.meta b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/ErrorCode.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/ErrorCode.cs.meta rename to Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/ErrorCode.cs.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs index 05053bf..0e2ab2a 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs @@ -137,7 +137,7 @@ namespace YooAsset.Editor // 首包文件拷贝参数 var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline); - _copyBuildinFileTagsField = Root.Q("CopyBuildinFileTags"); + _copyBuildinFileTagsField = Root.Q("CopyBuildinFileParam"); _copyBuildinFileTagsField.SetValueWithoutNotify(buildinFileCopyParams); _copyBuildinFileTagsField.RegisterValueChangedCallback(evt => { diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.uxml b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.uxml index 291424d..85599cf 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.uxml +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.uxml @@ -7,7 +7,7 @@ - + diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs index b993caa..2951fe3 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs @@ -174,7 +174,7 @@ namespace YooAsset.Editor AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName; AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages); AssetBundleCollectorSettingData.SaveFile(); - Debug.Log($"导入配置完毕!"); + Debug.Log($"Asset bundle collector config import complete!"); } /// @@ -245,7 +245,7 @@ namespace YooAsset.Editor // 生成配置文件 xmlDoc.Save(savePath); - Debug.Log($"导出配置完毕!"); + Debug.Log($"Asset bundle collector config export complete!"); } /// diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index 0480f1e..ca0d448 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -265,7 +265,7 @@ namespace YooAsset.Editor } else { - throw new Exception($"{nameof(IActiveRule)}类型无效:{ruleName}"); + throw new Exception($"{nameof(IActiveRule)} is invalid:{ruleName}"); } } public static IAddressRule GetAddressRuleInstance(string ruleName) @@ -282,7 +282,7 @@ namespace YooAsset.Editor } else { - throw new Exception($"{nameof(IAddressRule)}类型无效:{ruleName}"); + throw new Exception($"{nameof(IAddressRule)} is invalid:{ruleName}"); } } public static IPackRule GetPackRuleInstance(string ruleName) @@ -299,7 +299,7 @@ namespace YooAsset.Editor } else { - throw new Exception($"{nameof(IPackRule)}类型无效:{ruleName}"); + throw new Exception($"{nameof(IPackRule)} is invalid:{ruleName}"); } } public static IFilterRule GetFilterRuleInstance(string ruleName) @@ -316,7 +316,7 @@ namespace YooAsset.Editor } else { - throw new Exception($"{nameof(IFilterRule)}类型无效:{ruleName}"); + throw new Exception($"{nameof(IFilterRule)} is invalid:{ruleName}"); } } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index 88553a0..2baa64e 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -14,7 +14,8 @@ namespace YooAsset.Editor [MenuItem("YooAsset/AssetBundle Collector", false, 101)] public static void OpenWindow() { - AssetBundleCollectorWindow window = GetWindow("资源包收集工具", true, WindowsDefine.DockedWindowTypes); + string windowTitle = Localization.Language(ELanguageKey.ABC_WindowTitle); + AssetBundleCollectorWindow window = GetWindow(windowTitle, true, WindowsDefine.DockedWindowTypes); window.minSize = new Vector2(800, 600); } @@ -51,7 +52,7 @@ namespace YooAsset.Editor private ListView _groupListView; private TextField _groupNameTxt; private TextField _groupDescTxt; - private TextField _groupAssetTagsTxt; + private TextField _groupTagsTxt; private VisualElement _collectorContainer; private ScrollView _collectorScrollView; @@ -106,7 +107,7 @@ namespace YooAsset.Editor AssetBundleCollectorSettingData.ModifyShowPackageView(evt.newValue); RefreshWindow(); }); - _showEditorAliasToggle = root.Q("ShowEditorAlias"); + _showEditorAliasToggle = root.Q("ShowRuleAlias"); _showEditorAliasToggle.RegisterValueChangedCallback(evt => { AssetBundleCollectorSettingData.ModifyShowEditorAlias(evt.newValue); @@ -290,8 +291,8 @@ namespace YooAsset.Editor }); // 分组的资源标签 - _groupAssetTagsTxt = root.Q("GroupAssetTags"); - _groupAssetTagsTxt.RegisterValueChangedCallback(evt => + _groupTagsTxt = root.Q("GroupTags"); + _groupTagsTxt.RegisterValueChangedCallback(evt => { var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage; var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup; @@ -320,7 +321,7 @@ namespace YooAsset.Editor // 分组激活规则 var activeRuleContainer = root.Q("ActiveRuleContainer"); { - _activeRulePopupField = new PopupField("Active Rule", _activeRuleList, 0); + _activeRulePopupField = new PopupField("ABC_ActiveRule", _activeRuleList, 0); _activeRulePopupField.name = "ActiveRuleMaskField"; _activeRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft; _activeRulePopupField.formatListItemCallback = FormatListItemCallback; @@ -339,6 +340,40 @@ namespace YooAsset.Editor activeRuleContainer.Add(_activeRulePopupField); } + // 本地化设置 + { + UIElementsLocalize.Localize(_globalSettingsButton); + UIElementsLocalize.Localize(_packageSettingsButton); + UIElementsLocalize.Localize(_showPackageToogle); + UIElementsLocalize.Localize(_showEditorAliasToggle); + UIElementsLocalize.Localize(_uniqueBundleNameToogle); + UIElementsLocalize.Localize(_enableAddressableToogle); + UIElementsLocalize.Localize(_locationToLowerToogle); + UIElementsLocalize.Localize(_includeAssetGUIDToogle); + UIElementsLocalize.Localize(_ignoreDefaultTypeToogle); + UIElementsLocalize.Localize(_autoCollectShadersToogle); + } + { + UIElementsLocalize.Localize(fixBtn); + UIElementsLocalize.Localize(importBtn); + UIElementsLocalize.Localize(exportBtn); + UIElementsLocalize.Localize(_saveButton); + } + { + var packageTitle = root.Q