aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-02-07 15:43:53 +0800
committerGitHub <noreply@github.com>2022-02-07 15:43:53 +0800
commitc2a3e38194c7bb4ca1ea62f033e633e597e09be4 (patch)
tree714d5f49a22041d845ba8693fb976d88ff862be1 /services
parentf393bc82cbf83ab890a55ecdb7f41583e583ddad (diff)
downloadgitea-c2a3e38194c7bb4ca1ea62f033e633e597e09be4.tar.gz
gitea-c2a3e38194c7bb4ca1ea62f033e633e597e09be4.zip
Fix the missing i18n key for update checker (#18646)
Diffstat (limited to 'services')
-rw-r--r--services/cron/tasks.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/cron/tasks.go b/services/cron/tasks.go
index 07da2fe8d6..070fb6e9e1 100644
--- a/services/cron/tasks.go
+++ b/services/cron/tasks.go
@@ -17,6 +17,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/translation"
)
var (
@@ -121,6 +122,12 @@ func GetTask(name string) *Task {
// RegisterTask allows a task to be registered with the cron service
func RegisterTask(name string, config Config, fun func(context.Context, *user_model.User, Config) error) error {
log.Debug("Registering task: %s", name)
+
+ i18nKey := "admin.dashboard." + name
+ if _, ok := translation.TryTr("en-US", i18nKey); !ok {
+ return fmt.Errorf("translation is missing for task %q, please add translation for %q", name, i18nKey)
+ }
+
_, err := setting.GetCronSettings(name, config)
if err != nil {
log.Error("Unable to register cron task with name: %s Error: %v", name, err)