perf: modify task log i18n

pull/13275/head
wangruidong 2024-05-22 18:18:56 +08:00 committed by w940853815
parent b179770dbf
commit 33b688b021
5 changed files with 1868 additions and 1317 deletions

View File

@ -98,9 +98,11 @@ class ChangeSecretManager(AccountBasePlaybookManager):
accounts = self.get_accounts(account) accounts = self.get_accounts(account)
if not accounts: if not accounts:
print('没有发现待处理的账号: %s 用户ID: %s 类型: %s' % ( print(
asset.name, self.account_ids, self.secret_type _("No pending accounts found: {name} User ID: {account_ids} Type: {secret_type}").format(
)) name=asset.name,
account_ids=self.account_ids,
secret_type=self.secret_type))
return [] return []
records = [] records = []

View File

@ -320,19 +320,19 @@ class BasePlaybookManager:
shutil.rmtree(self.runtime_dir, ignore_errors=True) shutil.rmtree(self.runtime_dir, ignore_errors=True)
def run(self, *args, **kwargs): def run(self, *args, **kwargs):
print(">>> 任务准备阶段\n") print(_(">>> Task preparation phase"), end="\n")
runners = self.get_runners() runners = self.get_runners()
if len(runners) > 1: if len(runners) > 1:
print("### 分次执行任务, 总共 {}\n".format(len(runners))) print(_(">>> Executing tasks in batches, total {runner_count}").format(runner_count=len(runners)))
elif len(runners) == 1: elif len(runners) == 1:
print(">>> 开始执行任务\n") print(_(">>> Start executing tasks"))
else: else:
print("### 没有需要执行的任务\n") print(_(">>> No tasks need to be executed"), end="\n")
self.execution.date_start = timezone.now() self.execution.date_start = timezone.now()
for i, runner in enumerate(runners, start=1): for i, runner in enumerate(runners, start=1):
if len(runners) > 1: if len(runners) > 1:
print(">>> 开始执行第 {} 批任务".format(i)) print(_(">>> Begin executing batch {index} of tasks").format(index=i))
ssh_tunnel = SSHTunnelManager() ssh_tunnel = SSHTunnelManager()
ssh_tunnel.local_gateway_prepare(runner) ssh_tunnel.local_gateway_prepare(runner)
try: try:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff