Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jokester committed Nov 5, 2024
1 parent ebb17cc commit c3cf40a
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 90 deletions.
8 changes: 5 additions & 3 deletions app/core/rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ def init_system_roles(cls: Type[Document]):
system_code=role["system_code"],
intro=role.get("intro", ""),
).save()
logger.info(f"初始化{cls._class_name}表完成")
logger.info(f"Populated {cls._class_name} with default roles")
else:
logger.info(f"已存在{cls._class_name}表,跳过初始化")
logger.info(f"{cls._class_name} already populated")

@classmethod
def system_roles(cls: Type[Document], without_creator=False):
Expand All @@ -214,9 +214,11 @@ def by_id(cls: Type[Document], id):
return role

def to_api(self: Document):
name = gettext(self.name)
logger.debug('RoleMixin.to_api: name="%s" %s', self.name, name)
return {
"id": str(self.id),
"name": self.name,
"name": gettext(self.name),
"level": self.level,
"system": self.system,
"system_code": self.system_code,
Expand Down
10 changes: 10 additions & 0 deletions app/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ class ProjectRole(RoleMixin, Document):
},
]

@classmethod
def unused_provide_babel_names(cls):
gettext("创建人")
gettext("管理员")
gettext("监理")
gettext("校对")
gettext("翻译")
gettext("嵌字")
gettext("见习翻译")


class ProjectSet(Document):
"""项目集"""
Expand Down
93 changes: 50 additions & 43 deletions app/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-11-06 02:31+0900\n"
"POT-Creation-Date: 2024-11-06 03:16+0900\n"
"PO-Revision-Date: 2017-04-14 15:38+0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_US\n"
Expand All @@ -32,7 +32,7 @@ msgstr "Only the applicant can remove the application"

#: app/apis/application.py:183 app/apis/file.py:254 app/apis/invitation.py:236
#: app/apis/project_set.py:102 app/apis/target.py:31 app/apis/term.py:151
#: app/apis/term.py:311 app/core/rbac.py:483
#: app/apis/term.py:311 app/core/rbac.py:485
msgid "删除成功"
msgstr "Removed"

Expand Down Expand Up @@ -530,61 +530,61 @@ msgstr "Can only modify characters with a lower role level than your own."
msgid "修改用户备注"
msgstr "Edit User Note"

#: app/core/rbac.py:284 app/core/rbac.py:322
#: app/core/rbac.py:286 app/core/rbac.py:324
msgid "角色等级不能大于等于自己的角色等级"
msgstr ""
"Character level cannot be greater than or equal to your own character "
"level."

#: app/core/rbac.py:286 app/core/rbac.py:324
#: app/core/rbac.py:288 app/core/rbac.py:326
msgid "角色权限不能多于自己的角色权限"
msgstr "Role permissions cannot exceed your own role permissions."

#: app/core/rbac.py:317
#: app/core/rbac.py:319
msgid "不能修改系统角色"
msgstr "Cannot modify system role."

#: app/core/rbac.py:339
#: app/core/rbac.py:341
msgid "不能删除系统角色"
msgstr "Cannot delete system role."

#: app/core/rbac.py:388 app/core/rbac.py:389
#: app/core/rbac.py:390 app/core/rbac.py:391
msgid "此项目/团队不允许申请加入"
msgstr "This project/team does not allow requests to join."

#: app/core/rbac.py:464
#: app/core/rbac.py:466
msgid "用户不存在于团队"
msgstr "User does not exist in the team."

#: app/core/rbac.py:474
#: app/core/rbac.py:476
msgid "退出成功"
msgstr "Logout successful."

#: app/core/rbac.py:478
#: app/core/rbac.py:480
msgid "您没有删除用户权限"
msgstr "You do not have permission to delete users."

#: app/core/rbac.py:481
#: app/core/rbac.py:483
msgid "只能删除角色等级比您低的用户"
msgstr "You can only delete users with a role level lower than yours."

#: app/core/rbac.py:501
#: app/core/rbac.py:503
msgid "您不能修改自己的角色"
msgstr "You cannot modify your role."

#: app/core/rbac.py:504
#: app/core/rbac.py:506
msgid "您没有修改用户角色权限"
msgstr "You do not have permission to modify user roles."

#: app/core/rbac.py:508
#: app/core/rbac.py:510
msgid "只能为比您角色等级低的用户设置角色"
msgstr "Can only assign roles to users with a lower role level than yours."

#: app/core/rbac.py:511
#: app/core/rbac.py:513
msgid "只能为用户设置比您角色等级低的角色"
msgstr "You can only assign roles to users that are lower than your role level."

#: app/core/rbac.py:539
#: app/core/rbac.py:541
msgid "默认角色不能设置为创建者"
msgstr "The default role cannot be set as the creator."

Expand Down Expand Up @@ -1124,27 +1124,55 @@ msgstr "Modify target language."
msgid "删除目标语言"
msgstr "Delete target language."

#: app/models/project.py:425
#: app/models/project.py:281
msgid "创建人"
msgstr ""

#: app/models/project.py:282
msgid "管理员"
msgstr "Admin"

#: app/models/project.py:283
msgid "监理"
msgstr "Supervisor"

#: app/models/project.py:284
msgid "校对"
msgstr "Proofreader"

#: app/models/project.py:285
msgid "翻译"
msgstr "Translator"

#: app/models/project.py:286
msgid "嵌字"
msgstr "Inpainter"

#: app/models/project.py:287
msgid "见习翻译"
msgstr "Trainee Translator"

#: app/models/project.py:435
msgid "必须是Language对象"
msgstr "Must be a Language object."

#: app/models/project.py:560
#: app/models/project.py:570
msgid "只允许项目所属团队成员申请加入"
msgstr "Only members of the project team are allowed to apply to join."

#: app/models/project.py:627
#: app/models/project.py:637
msgid "暂不支持的文件格式"
msgstr "File format not supported"

#: app/models/project.py:948
#: app/models/project.py:958
msgid "框内"
msgstr "In the box."

#: app/models/project.py:950
#: app/models/project.py:960
msgid "框外"
msgstr "Out of the box"

#: app/models/project.py:953
#: app/models/project.py:963
msgid "可使用 LabelPlus Photoshop 脚本导入 psd 中"
msgstr "You can use the LabelPlus Photoshop script to import into PSD."

Expand Down Expand Up @@ -1407,27 +1435,6 @@ msgstr "No valid parameters."
#~ msgid "此邮箱已存在,您可以直接登录或尝试其他邮箱"
#~ msgstr ""

#~ msgid "创建人"
#~ msgstr "Creator"

#~ msgid "管理员"
#~ msgstr "Administrator"

#~ msgid "监理"
#~ msgstr "Supervisor"

#~ msgid "校对"
#~ msgstr "Proofreader"

#~ msgid "翻译"
#~ msgstr "Translator"

#~ msgid "嵌字"
#~ msgstr "Inpainter"

#~ msgid "见习翻译"
#~ msgstr "Trainee Translator"

#~ msgid "资深成员"
#~ msgstr "Senior Member"

Expand Down
Loading

0 comments on commit c3cf40a

Please sign in to comment.