From b88403f005ed5edb13bc63e91c4cb12500325dc4 Mon Sep 17 00:00:00 2001 From: SmallMain Date: Thu, 31 Oct 2024 17:13:21 +0800 Subject: [PATCH] =?UTF-8?q?[common]=20=E5=A2=9E=E5=8A=A0=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extension/i18n/en.js | 62 +++++++++++++++++++++++++++++++++++++++- extension/i18n/zh.js | 62 +++++++++++++++++++++++++++++++++++++++- extension/main.js | 8 +++--- extension/package.json | 4 +-- extension/panel/index.js | 24 +++++++++------- 5 files changed, 142 insertions(+), 18 deletions(-) diff --git a/extension/i18n/en.js b/extension/i18n/en.js index 589e96a5..13679e40 100644 --- a/extension/i18n/en.js +++ b/extension/i18n/en.js @@ -1,4 +1,64 @@ module.exports = { - 'settingsmenuname': 'Enhance Kit Settings...', + 'primary_menu': 'Enhance Kit Manage...', + 'settings_menu': 'Enhance Kit Settings...', + 'install_menu': 'Install...', + 'info_menu': 'Print Infomation', + 'uninstall_menu': 'Uninstall', + 'last_menu': 'Install Latest Version', + 'other_menu': 'Install Other Version...', + 'doc_menu': 'Document', + 'website_menu': 'Official Website', + 'github_menu': 'Github', + 'info_title': 'Cocos Enhance Kit Information', + 'info_title2': 'Installed Enhance Kit Information', + 'engine_version_title': 'Current Engine Version:', + 'error_engine_version_not_support': 'The current engine version does not support install', + 'support_version_title': 'Supported install versions:', + 'not_install': 'Please install Enhance Kit first.', + 'version_not_2_0': 'The installed Enhance Kit version must be >= 2.0.0 to support the settings panel.', + 'error_use_global': 'The project\'s custom engine is using global configuration, so the installed Enhance Kit information cannot be read.', + 'uninstall': 'Not Installed', + 'install_success': 'Installation Successful', + 'install_failed': 'Installation Failed', + 'uninstall_success': 'Uninstallation Successful', + 'uninstall_failed': 'Uninstallation Failed, Please Retry', + 'not_backup': 'Uninstallation failed due to missing backup. Please reinstall the engine to uninstall.', + 'restart_tip': 'Installation successful. Please restart the editor to take effect.', + 'failed_tip': 'Installation failed. Please check the error and retry.', + 'restart_tip2': 'Uninstallation successful. Please restart the editor to take effect.', + 'failed_tip2': 'Uninstallation failed. Please check the error and retry.', + 'uninstalling': 'Uninstalling the currently installed Enhance Kit. Please do not operate...', + 'use_global_tip': 'The project\'s custom engine is using global configuration, so it cannot be automatically modified. Please manually restore the global configuration.', + 'skip': 'Does not exist, installation skipped', + 'thank': 'Thank you for supporting the Cocos Enhance Kit open-source project.', 'settings_title': 'Enhance Kit Settings', + 'unsupport_version_1': 'Enhance Kit version ', + 'unsupport_version_2': ' cannot be installed on this engine version', + 'check_version_prefix': 'Checking the Enhance Kit directory, version ', + 'install_version_prefix': 'Installing the Enhance Kit, version ', + 'dont_action': ', please do not operate...', + 'tip1': 'If there are issues with automatic downloading or extraction failures, please retry several times.', + 'tip2': 'If multiple retries fail, you can manually download the zip file from the following website and place it in the ', + 'tip3': ' directory for extraction.', + 'no_version': 'The local version of the Enhance Kit does not exist. Starting the download...', + 'downloading': 'Downloading...', + 'delete_dir_ing': 'Deleting old directory...', + 'unziping': 'Unzipping...', + 'unzip_failed': 'Unzipping failed. The zip file may be corrupted. The zip file has been deleted. Please try again.', + 'loading': 'Loading...', + 'thread_not_right_workers_dir': 'You have enabled the multi-threading feature of the Enhance Kit, but the correct workers directory and game.json field have not been detected. Please reinstall the Enhance Kit. For details, please refer to the documentation: https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9', + 'thread_need_delete_files': 'You have disabled the multi-threading feature of the community edition. You can manually delete related files to reduce the package size of the WeChat Mini Game. For more details, please refer to the documentation: https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9', + 'thread_title': 'Multi-threading Support', + 'thread_desc': 'This feature is only valid on the WeChat Mini Game platform.', + 'thread_desc2': 'Please note that the following settings are global settings, and any changes will affect all projects. All settings will be lost after reinstalling, upgrading, or uninstalling the Enhance Kit.', + 'thread_debug': 'Debug Mode', + 'thread_debug_desc': 'When enabled, detailed logs will be output for debugging, which may significantly reduce performance.', + 'thread_asset_pipeline': 'Multi-threaded Asset Pipeline', + 'thread_asset_pipeline_desc': 'When enabled, the asset pipeline will be executed in a separate thread, reducing stuttering caused by resource downloading, caching, and loading.', + 'thread_audio_system': 'Multi-threaded Audio System', + 'thread_audio_system_desc': 'When enabled, time-consuming audio operations will be executed in a separate thread, reducing stuttering caused by audio API calls.', + 'thread_audio_sync': 'Property Sync Interval (milliseconds)', + 'thread_audio_sync_desc': 'How often the properties of audio instances (playback progress, total duration, etc.) are synchronized from the worker thread to the main thread. Too frequent updates may impact performance.', + 'thread_scheduler': 'Thread Communication Scheduler', + 'thread_scheduler_desc': 'When enabled, multiple data communications will be bundled and sent together, which may reduce performance overhead caused by frequent communications.', }; diff --git a/extension/i18n/zh.js b/extension/i18n/zh.js index 97c8149d..9c316a6e 100644 --- a/extension/i18n/zh.js +++ b/extension/i18n/zh.js @@ -1,4 +1,64 @@ module.exports = { - 'settingsmenuname': '社区版设置...', + 'primary_menu': '社区版管理...', + 'settings_menu': '社区版设置...', + 'install_menu': '安装...', + 'info_menu': '查看信息', + 'uninstall_menu': '卸载', + 'last_menu': '安装最新版本', + 'other_menu': '安装其它版本...', + 'doc_menu': '文档', + 'website_menu': '官方网站', + 'github_menu': 'Github', + 'info_title': 'Cocos Enhance Kit 信息', + 'info_title2': '已安装社区版信息', + 'engine_version_title': '当前引擎版本:', + 'error_engine_version_not_support': '当前引擎版本不支持安装社区版', + 'support_version_title': '支持的社区版版本:', + 'not_install': '请先安装社区版。', + 'version_not_2_0': '安装的社区版版本需 >= 2.0.0 ,以支持设置面板功能。', + 'error_use_global': '项目自定义引擎正在使用全局配置,无法读取到已安装的社区版信息', + 'uninstall': '未安装', + 'install_success': '安装成功', + 'install_failed': '安装失败', + 'uninstall_success': '卸载成功', + 'uninstall_failed': '卸载失败,请重试', + 'not_backup': '备份丢失导致无法卸载,需要重装引擎以卸载', + 'restart_tip': '安装成功,请重启编辑器生效', + 'failed_tip': '安装失败,请检查错误并重试', + 'restart_tip2': '卸载成功,请重启编辑器生效', + 'failed_tip2': '卸载失败,请检查错误并重试', + 'uninstalling': '正在卸载当前安装的社区版,请勿操作...', + 'use_global_tip': '项目自定义引擎正在使用全局配置,无法自动修改,请手动还原全局配置', + 'skip': '不存在,已跳过安装', + 'thank': '感谢你对 Cocos Enhance Kit 开源项目的支持。', 'settings_title': '社区版设置', + 'unsupport_version_1': '社区版版本 ', + 'unsupport_version_2': ' 不能在此版本引擎上安装', + 'check_version_prefix': '正在检查社区版目录,版本 ', + 'install_version_prefix': '正在安装社区版,版本 ', + 'dont_action': ',请勿操作...', + 'tip1': '如果出现自动下载或者解压失败的问题,请再重试几次。', + 'tip2': '若多次重试失败,可在以下网址手动下载 zip 文件,并放在', + 'tip3': '目录解压。', + 'no_version': '本地不存在该版本社区版,开始下载...', + 'downloading': '正在下载中...', + 'delete_dir_ing': '正在删除旧目录...', + 'unziping': '正在解压...', + 'unzip_failed': '解压失败,可能是压缩包损坏,已将压缩包删除,请重新再试', + 'loading': '加载中...', + 'thread_not_right_workers_dir': '你启用了社区版的多线程特性,但未检测到正确的 workers 目录与 game.json 字段,请重新安装社区版,详情请查看文档:https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9', + 'thread_need_delete_files': '你禁用了社区版的多线程特性,可以手动删除相关文件以减少微信小游戏的包体大小,详情请查看文档:https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9', + 'thread_title': '多线程支持', + 'thread_desc': '该特性仅在微信小游戏平台下有效。', + 'thread_desc2': '请注意,以下为全局设置,改动会影响到所有项目,并且在重新安装、升级或卸载社区版后丢失所有设置。', + 'thread_debug': '调试模式', + 'thread_debug_desc': '启用后将会输出详细日志以便进行调试,这可能会大幅降低性能。', + 'thread_asset_pipeline': '多线程驱动资源管线', + 'thread_asset_pipeline_desc': '启用后将资源管线移至线程中执行,减少由资源下载、缓存与加载导致的卡顿。', + 'thread_audio_system': '多线程驱动音频系统', + 'thread_audio_system_desc': '启用后将音频耗时操作移至线程中执行,减少由音频 API 调用导致的卡顿。', + 'thread_audio_sync': '属性同步间隔(毫秒)', + 'thread_audio_sync_desc': '间隔多久从 Worker 线程将音频实例的属性(播放进度、总时长等)同步到主线程,太频繁可能会影响性能。', + 'thread_scheduler': '线程通信调度器', + 'thread_scheduler_desc': '启用后将多次数据通信打包发送,这可能会减少因通信次数带来的性能消耗。', }; diff --git a/extension/main.js b/extension/main.js index a14d0af7..3e1263f4 100644 --- a/extension/main.js +++ b/extension/main.js @@ -32,9 +32,9 @@ function getSettings() { const isUninstalled = minigameVersion === ""; const isSupported = !isUninstalled && Number(minigameVersion.split(".")[0]) >= 2; if (isUninstalled) { - return { code: -1, errMsg: "请先安装社区版。" }; + return { code: -1, errMsg: t('not_install') }; } else if (!isSupported) { - return { code: -2, errMsg: "安装的社区版版本需 >= 2.0.0 ,以支持设置面板功能。" }; + return { code: -2, errMsg: t('version_not_2_0') }; } else { const content = fs.readFileSync(engineWechatMinigameWorkerMainMacroPath, { encoding: "utf-8" }); @@ -111,10 +111,10 @@ function checkAndModifyWorkerFiles() { if (result.CC_WORKER_ASSET_PIPELINE || result.CC_WORKER_AUDIO_SYSTEM) { // 没有 Worker 目录与配置的话提醒用户重新安装 if (!(gameJson.workers && fs.existsSync(workerDir))) { - Editor.error("你启用了社区版的多线程特性,但未检测到正确的 workers 目录与 game.json 字段,请重新安装社区版,详情请查看文档:https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9"); + Editor.error(t('thread_not_right_workers_dir')); } } else { - Editor.warn("你禁用了社区版的多线程特性,可以手动删除相关文件以减少微信小游戏的包体大小,详情请查看文档:https://smallmain.github.io/cocos-enhance-kit/docs/user-guide/multithread/thread-intro#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9"); + Editor.warn(t('thread_need_delete_files')); } } } diff --git a/extension/package.json b/extension/package.json index 9d4e7449..c03ec4f5 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "min-height": 600 }, "main-menu": { - "i18n:MAIN_MENU.project.title/i18n:enhance-kit.settingsmenuname": { + "i18n:MAIN_MENU.project.title/i18n:enhance-kit.settings_menu": { "message": "enhance-kit:openSettings" } }, @@ -27,4 +27,4 @@ "resources/**/*" ] } -} \ No newline at end of file +} diff --git a/extension/panel/index.js b/extension/panel/index.js index 72463d9e..4e40cf44 100644 --- a/extension/panel/index.js +++ b/extension/panel/index.js @@ -1,3 +1,7 @@ +function t(str) { + return Editor.T('enhance-kit.' + str); +} + Editor.Panel.extend({ style: ` :host { margin: 5px; } @@ -10,29 +14,29 @@ Editor.Panel.extend({ template: `
-

加载中...

+

${t('loading')}