0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 15:23:14 -05:00

Localize error messages

This commit is contained in:
erik 2024-03-25 16:30:02 +01:00
parent 828e7a76f6
commit ca7d1c6f78
4 changed files with 11 additions and 3 deletions

View file

@ -15,6 +15,7 @@ func init() {
db.RegisterModel(new(FederatedRepo))
}
// ToDo: Validate before returning
func FindFederatedRepoByRepoID(ctx context.Context, repoId int64) ([]*FederatedRepo, error) {
maxFederatedRepos := 10
sess := db.GetEngine(ctx).Where("repo_id=?", repoId)
@ -23,6 +24,7 @@ func FindFederatedRepoByRepoID(ctx context.Context, repoId int64) ([]*FederatedR
return federatedRepoList, sess.Find(&federatedRepoList)
}
// ToDo: Name this ...repos
func UpdateFederatedRepo(ctx context.Context, localRepoId int64, federatedRepoList []*FederatedRepo) error {
for _, federatedRepo := range federatedRepoList {
if res, err := validation.IsValid(*federatedRepo); !res {

View file

@ -1064,6 +1064,7 @@ form.reach_limit_of_creation_1=Du hast bereits dein Limit von %d Repository erre
form.reach_limit_of_creation_n=Du hast bereits dein Limit von %d Repositories erreicht.
form.name_reserved=Der Repository-Name "%s" ist reserviert.
form.name_pattern_not_allowed=Das Muster "%s" ist in Repository-Namen nicht erlaubt.
form.string_too_long=Der angegebene String ist länger als %d Zeichen.
need_auth=Authentifizierung
migrate_options=Migrationsoptionen
@ -1993,6 +1994,7 @@ settings.githooks=Git-Hooks
settings.basic_settings=Grundeinstellungen
settings.federation_settings=Föderationseinstellungen
settings.federation_labelname_repo=URLs der föderierten Repositories. Getrennt mittels ";", keine Leerzeichen.
settings.federation_not_enabled=Föderierung ist auf deiner Instanz nicht aktiviert.
settings.mirror_settings=Mirror-Einstellungen
settings.mirror_settings.docs=Richte Dein Repository so ein, dass es automatisch Commits, Tags und Branches mit einem anderen Repository synchronisieren kann.
settings.mirror_settings.docs.disabled_pull_mirror.instructions=Richte Dein Projekt so ein, dass es automatisch Commits, Tags und Branches in ein anderes Repository pusht. Pull-Mirrors wurden von Deinem Website-Administrator deaktiviert.

View file

@ -1096,6 +1096,8 @@ form.reach_limit_of_creation_1 = The owner has already reached the limit of %d r
form.reach_limit_of_creation_n = The owner has already reached the limit of %d repositories.
form.name_reserved = The repository name "%s" is reserved.
form.name_pattern_not_allowed = The pattern "%s" is not allowed in a repository name.
form.string_too_long=The given string is longer than %d characters.
need_auth = Authorization
migrate_options = Migration Options
@ -2044,6 +2046,7 @@ settings.githooks = Git Hooks
settings.basic_settings = Basic Settings
settings.federation_settings=Federation Settings
settings.federation_labelname_repo=URLs of Federated Repositories. Separated by ";", no whitespace.
settings.federation_not_enabled=Federation is not enabled on your instance.
settings.mirror_settings = Mirror Settings
settings.mirror_settings.docs = Set up your repository to automatically synchronize commits, tags and branches with another repository.
settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push commits, tags and branches to another repository. Pull mirrors have been disabled by your site administrator.

View file

@ -189,16 +189,17 @@ func SettingsPost(ctx *context.Context) {
case "federation":
if !setting.Federation.Enabled {
ctx.NotFound("", nil)
ctx.Flash.Info("Federation Not enabled")
ctx.Flash.Info(ctx.Tr("repo.settings.federation_not_enabled"))
return
}
federationRepos := form.FederationRepos
errs := validation.ValidateMaxLen(federationRepos, 2048, "federationRepos")
maxFederatedRepoStrLength := 2048
errs := validation.ValidateMaxLen(federationRepos, maxFederatedRepoStrLength, "federationRepos")
if len(errs) > 0 {
ctx.Data["ERR_FederationRepos"] = true
ctx.Flash.Error("The given string was larger than 2048 bytes")
ctx.Flash.Error(ctx.Tr("repo.form.string_too_long", maxFederatedRepoStrLength))
ctx.Redirect(repo.Link() + "/settings")
return
}