From 9eafbada5390e01c284257ca541b13210b390a9b Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 22 Dec 2022 17:29:41 +0800 Subject: [PATCH] chore: reorganize locale of actions --- models/unit/unit.go | 4 +- options/locale/locale_en-US.ini | 64 +++++++++++++-------------- routers/web/admin/runners.go | 6 +-- routers/web/repo/actions/actions.go | 2 +- routers/web/shared/actions/runners.go | 6 +-- templates/admin/navbar.tmpl | 2 +- templates/repo/actions/openclose.tmpl | 4 +- templates/repo/header.tmpl | 2 +- templates/repo/settings/options.tmpl | 2 +- templates/runners/edit.tmpl | 26 +++++------ templates/runners/list.tmpl | 18 ++++---- 11 files changed, 68 insertions(+), 68 deletions(-) diff --git a/models/unit/unit.go b/models/unit/unit.go index 72ef0cc398..5a09576b7c 100644 --- a/models/unit/unit.go +++ b/models/unit/unit.go @@ -294,9 +294,9 @@ var ( UnitActions = Unit{ TypeActions, - "repo.actions", + "actions.actions", "/actions", - "repo.actions.desc", + "actions.description", 7, perm.AccessModeOwner, } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 64463ef80e..60684e7066 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1220,12 +1220,6 @@ projects.open = Open projects.close = Close projects.board.assigned_to = Assigned to -actions = Actions -actions.desc = Manage actions -actions.opened_by = opened %[1]s by %[2]s -actions.open_tab = %d Open -actions.closed_tab = %d Closed - issues.desc = Organize bug reports, tasks and milestones. issues.filter_assignees = Filter Assignee issues.filter_milestones = Filter Milestone @@ -3014,32 +3008,6 @@ notices.desc = Description notices.op = Op. notices.delete_success = The system notices have been deleted. -runners = Runners -runners.runner_manage_panel = Runners Management -runners.new = Create new Runner -runners.new_notice = Show runner installation documentation -runners.status = Status -runners.id = ID -runners.owner_type = Type -runners.description = Description -runners.labels = Labels -runners.latest_online = Last Online Time -runners.agent_labels = Agent Labels -runners.custom_labels = Custom Labels -runners.custom_labels_helper = Custom labels are labels that are not automatically added by the agent. They are added by the administrator. Use comma separated. -runners.runner_title = Runner -runners.task_list = Recent jobs on this runner -runners.edit_runner = Edit Runner -runners.update_runner = Update Changes -runners.update_runner_success = Runner updated successfully -runners.update_runner_failed = Failed to update runner -runners.delete_runner = Delete this runner -runners.delete_runner_success = Runner deleted successfully -runners.delete_runner_failed = Failed to delete runner -runners.delete_runner_header = Confirm to delete this runner -runners.delete_runner_notice = If job is running on this runner, it will be terminated and mark as failed. It may break building workflow. -runners.delete_runner_confirm = Delete this runner - [action] create_repo = created repository %s rename_repo = renamed repository from %[1]s to %[3]s @@ -3266,3 +3234,35 @@ deletion = Remove secret deletion.description = Removing a secret will revoke its access to repositories. Continue? deletion.success = The secret has been removed. deletion.failed = Failed to remove secret. + +[actions] +actions = Actions +description = Manage actions +open_tab = %d Open +closed_tab = %d Closed + +runners = Runners +runners.runner_manage_panel = Runners Management +runners.new = Create new Runner +runners.new_notice = Show runner installation documentation +runners.status = Status +runners.id = ID +runners.owner_type = Type +runners.description = Description +runners.labels = Labels +runners.latest_online = Last Online Time +runners.agent_labels = Agent Labels +runners.custom_labels = Custom Labels +runners.custom_labels_helper = Custom labels are labels that are not automatically added by the agent. They are added by the administrator. Use comma separated. +runners.runner_title = Runner +runners.task_list = Recent jobs on this runner +runners.edit_runner = Edit Runner +runners.update_runner = Update Changes +runners.update_runner_success = Runner updated successfully +runners.update_runner_failed = Failed to update runner +runners.delete_runner = Delete this runner +runners.delete_runner_success = Runner deleted successfully +runners.delete_runner_failed = Failed to delete runner +runners.delete_runner_header = Confirm to delete this runner +runners.delete_runner_notice = If job is running on this runner, it will be terminated and mark as failed. It may break building workflow. +runners.delete_runner_confirm = Delete this runner diff --git a/routers/web/admin/runners.go b/routers/web/admin/runners.go index 84fa092d4c..a70b53fdcb 100644 --- a/routers/web/admin/runners.go +++ b/routers/web/admin/runners.go @@ -21,7 +21,7 @@ const ( // Runners show all the runners func Runners(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("admin.runners") + ctx.Data["Title"] = ctx.Tr("actions.runners") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminRunners"] = true @@ -44,7 +44,7 @@ func Runners(ctx *context.Context) { // EditRunner show editing runner page func EditRunner(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("admin.runners.edit_runner") + ctx.Data["Title"] = ctx.Tr("actions.runners.edit_runner") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminRunners"] = true @@ -58,7 +58,7 @@ func EditRunner(ctx *context.Context) { // EditRunnerPost response for editing runner func EditRunnerPost(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("admin.runners.edit") + ctx.Data["Title"] = ctx.Tr("actions.runners.edit") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminRunners"] = true actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"), 0, 0, diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 34ddaad99b..a2b5199066 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -44,7 +44,7 @@ func MustEnableActions(ctx *context.Context) { } func List(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("repo.actions") + ctx.Data["Title"] = ctx.Tr("actions.actions") ctx.Data["PageIsActions"] = true var workflows git.Entries diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go index d578667c48..7cf1db5d76 100644 --- a/routers/web/shared/actions/runners.go +++ b/routers/web/shared/actions/runners.go @@ -136,14 +136,14 @@ func RunnerDetailsEditPost(ctx *context.Context, runnerID, ownerID, repoID int64 err = actions_model.UpdateRunner(ctx, runner, "description", "custom_labels") if err != nil { log.Warn("RunnerDetailsEditPost.UpdateRunner failed: %v, url: %s", err, ctx.Req.URL) - ctx.Flash.Warning(ctx.Tr("admin.runners.update_runner_failed")) + ctx.Flash.Warning(ctx.Tr("actions.runners.update_runner_failed")) ctx.Redirect(redirectTo) return } log.Debug("RunnerDetailsEditPost success: %s", ctx.Req.URL) - ctx.Flash.Success(ctx.Tr("admin.runners.update_runner_success")) + ctx.Flash.Success(ctx.Tr("actions.runners.update_runner_success")) ctx.Redirect(redirectTo) } @@ -155,7 +155,7 @@ func RunnerResetRegistrationToken(ctx *context.Context, ownerID, repoID int64, r return } - ctx.Flash.Success(ctx.Tr("admin.runners.reset_registration_token_success")) + ctx.Flash.Success(ctx.Tr("actions.runners.reset_registration_token_success")) ctx.Redirect(redirectTo) } diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl index 4f4e9e55b4..b31930431a 100644 --- a/templates/admin/navbar.tmpl +++ b/templates/admin/navbar.tmpl @@ -35,7 +35,7 @@ {{end}} {{if .EnableActions}} - {{.locale.Tr "admin.runners"}} + {{.locale.Tr "actions.runners"}} {{end}} diff --git a/templates/repo/actions/openclose.tmpl b/templates/repo/actions/openclose.tmpl index b172f2bc64..eabec6cf83 100644 --- a/templates/repo/actions/openclose.tmpl +++ b/templates/repo/actions/openclose.tmpl @@ -1,10 +1,10 @@ diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index b635f71a15..42d8f35897 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -185,7 +185,7 @@ {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} - {{svg "octicon-play"}} {{.locale.Tr "repo.actions"}} + {{svg "octicon-play"}} {{.locale.Tr "actions.actions"}} {{if .Repository.NumOpenRuns}} {{CountFmt .Repository.NumOpenRuns}} {{end}} diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index c36f59a94f..1f8928db1f 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -436,7 +436,7 @@ {{if .EnableActions}} {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}}
- + {{if .UnitTypeActions.UnitGlobalDisabled}}
{{else}} diff --git a/templates/runners/edit.tmpl b/templates/runners/edit.tmpl index 51321fd8f8..88bf642f9a 100644 --- a/templates/runners/edit.tmpl +++ b/templates/runners/edit.tmpl @@ -1,7 +1,7 @@
{{template "base/alert" .}}

- {{.locale.Tr "admin.runners.runner_title"}} #{{.Runner.ID}} {{.Runner.Name}} + {{.locale.Tr "actions.runners.runner_title"}} #{{.Runner.ID}} {{.Runner.Name}}

@@ -9,15 +9,15 @@ {{.CsrfTokenHtml}}
- + {{.Runner.StatusName}}
- + {{TimeSinceUnix .Runner.LastOnline $.locale}}
- + {{range .Runner.AgentLabels}} {{.}} @@ -25,7 +25,7 @@
- + {{.Runner.OwnType}}
@@ -33,27 +33,27 @@
- +
- + -

{{.locale.Tr "admin.runners.custom_labels_helper"}}

+

{{.locale.Tr "actions.runners.custom_labels_helper"}}

- + + {{.locale.Tr "actions.runners.delete_runner"}}

- {{.locale.Tr "admin.runners.task_list"}} + {{.locale.Tr "actions.runners.task_list"}}

@@ -91,7 +91,7 @@
- + - - - + + +
{{.locale.Tr "admin.runners.status"}}{{.locale.Tr "actions.runners.status"}} - {{.locale.Tr "admin.runners.id"}} + {{.locale.Tr "actions.runners.id"}} {{.locale.Tr "admin.runners.owner_type"}}{{.locale.Tr "admin.runners.labels"}}{{.locale.Tr "admin.runners.latest_online"}}{{.locale.Tr "actions.runners.owner_type"}}{{.locale.Tr "actions.runners.labels"}}{{.locale.Tr "actions.runners.latest_online"}}