全局中文化

This commit is contained in:
Cheng Zhou
2026-01-12 11:14:04 +08:00
parent 9021c7fe2b
commit 1338fa7e2b
103 changed files with 2443 additions and 1533 deletions
+5 -5
View File
@@ -28,7 +28,7 @@ async def get_current_user(
except ValidationError as exc:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials",
detail="无法验证登录凭据",
headers={"WWW-Authenticate": "Bearer"},
) from exc
@@ -36,7 +36,7 @@ async def get_current_user(
if not user or not user.is_active:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Inactive or missing user",
detail="账号不存在或已停用",
headers={"WWW-Authenticate": "Bearer"},
)
return user
@@ -50,7 +50,7 @@ def require_roles(roles: Iterable[str]) -> Callable:
if current_role not in roles_set:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Insufficient permissions",
detail="权限不足",
)
return current_user
@@ -81,7 +81,7 @@ def require_study_member():
if not membership or not membership.is_active:
raise AppException(
code="FORBIDDEN",
message="Not a member of this study",
message="不是该项目成员",
status_code=status.HTTP_403_FORBIDDEN,
)
return current_user
@@ -104,7 +104,7 @@ def require_study_roles(roles: Iterable[str]):
if not membership or not membership.is_active or membership.role_in_study not in roles_set:
raise AppException(
code="FORBIDDEN",
message="Insufficient study permissions",
message="项目权限不足",
status_code=status.HTTP_403_FORBIDDEN,
)
return current_user