mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-26 04:03:48 +00:00
fix(build): actually enforce masked prefixes verification in lint-locale-usage
This commit is contained in:
parent
560eb35a85
commit
f2bb2016e1
3 changed files with 52 additions and 4 deletions
|
@ -13,6 +13,18 @@ gpg.error.failed_retrieval_gpg_keys
|
|||
gpg.error.generate_hash
|
||||
gpg.error.no_committer_account
|
||||
|
||||
# models/actions/runner.go
|
||||
actions.runners.status.
|
||||
|
||||
# models/actions/status.go, templates/repo/actions/status.tmpl
|
||||
actions.status.
|
||||
|
||||
# models/git/commit_status.go
|
||||
repo.commitstatus.
|
||||
|
||||
# models/issues/comment.go
|
||||
repo.issues.role.
|
||||
|
||||
# models/system/notice.go: func (n *Notice) TrStr() string
|
||||
admin.notices.type_1
|
||||
admin.notices.type_2
|
||||
|
@ -20,7 +32,20 @@ admin.notices.type_2
|
|||
# modules/setting/ui.go
|
||||
themes.names.
|
||||
|
||||
# modules/translation/translation.go
|
||||
munits.data.
|
||||
|
||||
# modules/web/middleware/binding.go
|
||||
form.
|
||||
|
||||
# routers/web/admin/admin.go
|
||||
admin.dashboard.
|
||||
|
||||
# routers/web/repo/activity.go
|
||||
repo.activity.period.
|
||||
|
||||
# routers/web/repo/helper.go: "repo.tree_path_not_found_"+refType
|
||||
repo.
|
||||
repo.tree_path_not_found_branch
|
||||
repo.tree_path_not_found_commit
|
||||
repo.tree_path_not_found_tag
|
||||
|
@ -28,6 +53,9 @@ repo.tree_path_not_found_tag
|
|||
# services/context/context.go
|
||||
relativetime.
|
||||
|
||||
# services/cron/setting.go, templates/admin/cron.tmpl
|
||||
admin.dashboard.
|
||||
|
||||
# templates/mail/issue/default.tmpl: $.locale.Tr
|
||||
mail.issue.in_tree_path
|
||||
|
||||
|
@ -37,9 +65,12 @@ repo.permissions.
|
|||
# templates/package/metadata/arch.tmpl: $.locale.Tr
|
||||
packages.details.license
|
||||
|
||||
# templates/repo/editor/commit_form.tmpl: ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CanCommitToBranch.WontSignReason)
|
||||
# templates/repo/editor/commit_form.tmpl
|
||||
repo.signing.wont_sign.
|
||||
|
||||
# templates/repo/issue/filter_list.tmpl, tests/integration/repo_test.go
|
||||
repo.issues.filter_sort.
|
||||
|
||||
# templates/repo/issue/view_content.tmpl: indirection via $closeTranslationKey
|
||||
repo.issues.close
|
||||
repo.pulls.close
|
||||
|
@ -51,10 +82,21 @@ repo.issues.ref_pull_from
|
|||
repo.issues.ref_reopening_from
|
||||
|
||||
# templates/repo/issue/view_content/comments.tmpl: ctx.Locale.Tr (printf "projects.type-%d.display_name" .OldProject.Type)
|
||||
projects.
|
||||
projects.type-1.display_name
|
||||
projects.type-2.display_name
|
||||
projects.type-3.display_name
|
||||
|
||||
# templates/repo/settings/webhook/link_menu.tmpl, templates/webhook/new.tmpl: repo.settings.web_hook_name_
|
||||
# tests/integration/repo_archive_text_test.go
|
||||
repo.settings.
|
||||
|
||||
# templates/shared/search/combo_multi.tmpl
|
||||
search.
|
||||
|
||||
# templates/user/dashboard/issues.tmpl
|
||||
repo.issues.filter_sort.
|
||||
|
||||
# modules/migration/messenger.go: invocations of Messenger
|
||||
# services/migrations/migrate.go: messenger(...)
|
||||
# *: repo.migrate.*.description (unknown where they come from)
|
||||
|
|
|
@ -43,7 +43,11 @@ func (handler Handler) handleGoTrArgument(fset *token.FileSet, n ast.Expr) {
|
|||
arg, err := strconv.Unquote(argLit.Value)
|
||||
if err == nil {
|
||||
// found interesting strings
|
||||
handler.OnMsgidPrefix(fset, argLit.ValuePos, arg)
|
||||
prep, trunc := PrepareMsgidPrefix(arg)
|
||||
if trunc {
|
||||
handler.OnWarning(fset, argLit.ValuePos, fmt.Sprintf("needed to truncate message id prefix: %s", arg))
|
||||
}
|
||||
handler.OnMsgidPrefix(fset, argLit.ValuePos, prep)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,8 +273,10 @@ func main() {
|
|||
|
||||
handler := Handler{
|
||||
OnMsgidPrefix: func(fset *token.FileSet, pos token.Pos, msgidPrefix string) {
|
||||
// TODO: perhaps we should check if we have any strings with such a prefix, but that's slow...
|
||||
allowedMaskedPrefixes.Insert(DecodeKeyForStm(msgidPrefix))
|
||||
if !allowedMaskedPrefixes.Matches(DecodeKeyForStm(msgidPrefix)) {
|
||||
gotAnyMsgidError = true
|
||||
fmt.Printf("%s:\tmissing msgid prefix: %s\n", fset.Position(pos).String(), msgidPrefix)
|
||||
}
|
||||
},
|
||||
OnMsgid: func(fset *token.FileSet, pos token.Pos, msgid string) {
|
||||
if !msgids.Contains(msgid) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue