更新翻译

This commit is contained in:
jingrow 2025-10-26 00:44:37 +08:00
parent 862309650e
commit 3abe83fa11
3 changed files with 37 additions and 58 deletions

View File

@ -816,6 +816,8 @@
"Failed to uninstall app": "卸载应用失败",
"Uninstall App": "卸载应用",
"Are you sure you want to uninstall": "您确定要卸载",
"Are you sure you want to uninstall '{0}'? This action cannot be undone.": "您确定要卸载 '{0}' 吗?此操作无法撤销。",
"App '{0}' uninstalled successfully": "应用 '{0}' 卸载成功",
"This action cannot be undone.": "此操作无法撤销。",
"Not installed": "未安装",

View File

@ -188,7 +188,7 @@ const showAppDetail = async (app: any) => {
const uninstallApp = async (app: any) => {
dialog.warning({
title: t('Uninstall App'),
content: t(`Are you sure you want to uninstall '${app.name}'? This action cannot be undone.`),
content: t('Are you sure you want to uninstall \'{0}\'? This action cannot be undone.').replace('{0}', app.name),
positiveText: t('Uninstall'),
negativeText: t('Cancel'),
onPositiveClick: async () => {
@ -200,7 +200,7 @@ const uninstallApp = async (app: any) => {
})
if (response.data.success) {
message.success(t(`App '${app.name}' uninstalled successfully`))
message.success(t('App \'{0}\' uninstalled successfully').replace('{0}', app.name))
await loadInstalledApps()
} else {
message.error(response.data.error || t('Failed to uninstall app'))

View File

@ -75,19 +75,14 @@ async def get_local_apps(request: Request):
root = current.parents[4]
apps_dir = root / "apps"
# 获取已安装的App列表 - 从Local Installed Apps PageType读取
from jingrow import get_pg
# 获取已安装的App列表 - 通过get_single API获取
from jingrow.utils.jingrow_api import get_single_pagetype
result = get_single_pagetype("Local Installed Apps")
installed_names = set()
try:
# 使用正确的single PageType获取方式
local_installed_apps = get_pg("Local Installed Apps", "Local Installed Apps")
if local_installed_apps and hasattr(local_installed_apps, 'local_installed_apps') and local_installed_apps.local_installed_apps:
installed_names = {app.app_name for app in local_installed_apps.local_installed_apps}
except Exception:
# 如果PageType不存在使用文件系统扫描作为备选
from jingrow.utils.app_installer import get_installed_apps as get_installed_apps_list
installed_apps = get_installed_apps_list()
installed_names = {app['name'] for app in installed_apps}
if result.get('success'):
config = result.get('config', {})
local_installed_apps = config.get('local_installed_apps', [])
installed_names = {app.get('app_name', '') for app in local_installed_apps}
# 系统默认App列表需要排除
system_apps = {
@ -175,19 +170,15 @@ async def install_local_app(request: Request, app_name: str):
if not app_dir.exists():
raise HTTPException(status_code=404, detail=f"App '{app_name}' not found")
# 检查是否已经安装 - 从Local Installed Apps PageType检查
from jingrow import get_pg
local_installed_apps = None
try:
# 使用正确的single PageType获取方式
local_installed_apps = get_pg("Local Installed Apps", "Local Installed Apps")
if local_installed_apps and hasattr(local_installed_apps, 'local_installed_apps') and local_installed_apps.local_installed_apps:
for app in local_installed_apps.local_installed_apps:
if app.app_name == app_name:
raise HTTPException(status_code=400, detail=f"App '{app_name}' is already installed")
except Exception:
# 如果PageType不存在跳过检查
pass
# 检查是否已经安装 - 通过get_single API检查
from jingrow.utils.jingrow_api import get_single_pagetype
result = get_single_pagetype("Local Installed Apps")
if result.get('success'):
config = result.get('config', {})
local_installed_apps = config.get('local_installed_apps', [])
for app in local_installed_apps:
if app.get('app_name', '') == app_name:
raise HTTPException(status_code=400, detail=f"App '{app_name}' is already installed")
# 将App信息添加到Local Installed Apps PageType
try:
@ -227,17 +218,14 @@ async def install_local_app(request: Request, app_name: str):
@router.get("/jingrow/installed-apps")
async def get_installed_apps(request: Request):
"""获取已安装的应用列表 - 从Local Installed Apps PageType读"""
"""获取已安装的应用列表 - 通过get_single API获"""
try:
# 从Local Installed Apps PageType获取数据
from jingrow import get_pg
# 通过get_single API获取Local Installed Apps数据
from jingrow.utils.jingrow_api import get_single_pagetype
# 获取Local Installed Apps的single实例
try:
# 使用正确的single PageType获取方式
local_installed_apps = get_pg("Local Installed Apps", "Local Installed Apps")
except Exception as e:
# 如果PageType不存在或为空返回空列表
result = get_single_pagetype("Local Installed Apps")
if not result.get('success'):
return {
'success': True,
'data': {
@ -246,15 +234,17 @@ async def get_installed_apps(request: Request):
}
}
config = result.get('config', {})
local_installed_apps = config.get('local_installed_apps', [])
apps = []
if local_installed_apps and hasattr(local_installed_apps, 'local_installed_apps') and local_installed_apps.local_installed_apps:
for app in local_installed_apps.local_installed_apps:
apps.append({
'name': app.app_name,
'version': app.app_version,
'git_branch': app.git_branch,
'type': 'installed'
})
for app in local_installed_apps:
apps.append({
'name': app.get('app_name', ''),
'version': app.get('app_version', '1.0.0'),
'git_branch': app.get('git_branch', 'main'),
'type': 'installed'
})
return {
'success': True,
@ -266,20 +256,7 @@ async def get_installed_apps(request: Request):
except Exception as e:
log_error(f"获取已安装应用列表失败: {str(e)}")
# 如果PageType相关操作失败回退到文件系统扫描
try:
from jingrow.utils.app_installer import get_installed_apps as get_installed_apps_list
installed_apps = get_installed_apps_list()
apps = [{'name': app['name'], 'version': '1.0.0', 'git_branch': 'main', 'type': 'installed'} for app in installed_apps]
return {
'success': True,
'data': {
'apps': apps,
'total': len(apps)
}
}
except Exception as e2:
raise HTTPException(status_code=500, detail=str(e2))
raise HTTPException(status_code=500, detail=str(e))
@router.post("/jingrow/uninstall/{app_name}")