diff --git a/main/manager-web/package.json b/main/manager-web/package.json
index 55e275d9..75471a5e 100644
--- a/main/manager-web/package.json
+++ b/main/manager-web/package.json
@@ -18,6 +18,7 @@
"opus-recorder": "^8.0.5",
"vue": "^2.6.14",
"vue-axios": "^3.5.2",
+ "vue-i18n": "^8.28.2",
"vue-router": "^3.6.5",
"vuex": "^3.6.2",
"xiaozhi": "file:"
diff --git a/main/manager-web/src/App.vue b/main/manager-web/src/App.vue
index 74ad2af8..180f8f0d 100644
--- a/main/manager-web/src/App.vue
+++ b/main/manager-web/src/App.vue
@@ -50,6 +50,7 @@ import CacheViewer from '@/components/CacheViewer.vue';
import { logCacheStatus } from '@/utils/cacheViewer';
export default {
+ name: 'App',
components: {
CacheViewer
},
@@ -78,7 +79,7 @@ export default {
// 在控制台输出提示信息
console.info(
- '%c[小智服务] CDN缓存检查工具已加载',
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.cdnEnabled'),
'color: #409EFF; font-weight: bold;'
);
console.info(
@@ -89,7 +90,7 @@ export default {
this.checkServiceWorkerStatus();
} else {
console.info(
- '%c[小智服务] CDN模式已禁用,使用本地打包资源',
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.cdnDisabled'),
'color: #67C23A; font-weight: bold;'
);
}
@@ -119,7 +120,7 @@ export default {
const registrations = await navigator.serviceWorker.getRegistrations();
if (registrations.length > 0) {
console.info(
- '%c[小智服务] Service Worker已注册',
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.serviceWorkerRegistered'),
'color: #67C23A; font-weight: bold;'
);
@@ -128,46 +129,46 @@ export default {
const hasCaches = await logCacheStatus();
if (!hasCaches) {
console.info(
- '%c[小智服务] 还未检测到缓存,请刷新页面或等待缓存建立',
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.noCacheDetected'),
+ 'color: #E6A23C; font-weight: bold;'
+ );
+
+ // 开发环境下提供额外提示
+ if (process.env.NODE_ENV === 'development') {
+ console.info(
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.swDevEnvWarning'),
'color: #E6A23C; font-weight: bold;'
);
-
- // 开发环境下提供额外提示
- if (process.env.NODE_ENV === 'development') {
- console.info(
- '%c[小智服务] 在开发环境中,Service Worker可能无法正常初始化缓存',
- 'color: #E6A23C; font-weight: bold;'
- );
- console.info('请尝试以下方法检查Service Worker是否生效:');
- console.info('1. 在开发者工具的Application/Application标签页中查看Service Worker状态');
- console.info('2. 在开发者工具的Application/Cache/Cache Storage中查看缓存内容');
- console.info('3. 使用生产构建(npm run build)并通过HTTP服务器访问以测试完整功能');
- }
+ console.info(this.$t('cache.swCheckMethods'));
+ console.info('1. ' + this.$t('cache.swCheckMethod1'));
+ console.info('2. ' + this.$t('cache.swCheckMethod2'));
+ console.info('3. ' + this.$t('cache.swCheckMethod3'));
+ }
}
}, 2000);
} else {
console.info(
- '%c[小智服务] Service Worker未注册,CDN资源可能无法缓存',
- 'color: #F56C6C; font-weight: bold;'
- );
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.serviceWorkerNotRegistered'),
+ 'color: #F56C6C; font-weight: bold;'
+ );
- if (process.env.NODE_ENV === 'development') {
- console.info(
- '%c[小智服务] 在开发环境中,这是正常现象',
- 'color: #E6A23C; font-weight: bold;'
- );
- console.info('Service Worker通常只在生产环境中生效');
- console.info('要测试Service Worker功能:');
- console.info('1. 运行npm run build构建生产版本');
- console.info('2. 通过HTTP服务器访问构建后的页面');
- }
+ if (process.env.NODE_ENV === 'development') {
+ console.info(
+ '%c[' + this.$t('system.name') + '] ' + this.$t('cache.swDevEnvNormal'),
+ 'color: #E6A23C; font-weight: bold;'
+ );
+ console.info(this.$t('cache.swProdOnly'));
+ console.info(this.$t('cache.swTestingTitle'));
+ console.info('1. ' + this.$t('cache.swTestingStep1'));
+ console.info('2. ' + this.$t('cache.swTestingStep2'));
+ }
}
} catch (error) {
console.error('检查Service Worker状态失败:', error);
}
} else {
- console.warn('当前浏览器不支持Service Worker,CDN资源缓存功能不可用');
- }
+ console.warn(this.$t('cache.swNotSupported'));
+ }
}
}
};
diff --git a/main/manager-web/src/components/AddDeviceDialog.vue b/main/manager-web/src/components/AddDeviceDialog.vue
index b273a8dc..29b9cf30 100644
--- a/main/manager-web/src/components/AddDeviceDialog.vue
+++ b/main/manager-web/src/components/AddDeviceDialog.vue
@@ -6,24 +6,24 @@
style="width: 40px;height: 40px;border-radius: 50%;background: #5778ff;display: flex;align-items: center;justify-content: center;">
- 添加设备
+ {{ $t('device.dialogTitle') }}