From deee8e82b2668607b30a05187e557dd4875fe997 Mon Sep 17 00:00:00 2001 From: nikurasu Date: Mon, 4 Mar 2024 18:54:18 +0100 Subject: [PATCH] feat(translation): fully translated to german --- src/app/controller/attendies_controller.go | 31 +++++++++++++ src/app/static/styles/style.css | 3 +- src/app/util/attendiesList.go | 6 +-- src/app/views/index.html | 4 +- src/app/views/table.html | 52 ++++++++++++++++++---- src/config/localization.go | 4 +- src/localization/active.de.json | 39 +++++++++++++++- src/localization/active.en.json | 4 +- src/localization/translate.de.json | 39 ---------------- 9 files changed, 123 insertions(+), 59 deletions(-) delete mode 100644 src/localization/translate.de.json diff --git a/src/app/controller/attendies_controller.go b/src/app/controller/attendies_controller.go index 69a5098..6f33d8b 100644 --- a/src/app/controller/attendies_controller.go +++ b/src/app/controller/attendies_controller.go @@ -61,15 +61,46 @@ func GetAttendiesByEventPublicTable(c *fiber.Ctx) error { MessageID: "Name", PluralCount: 1, }), + "Guest": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "Guest", + PluralCount: 1, + }), + "Spotter": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "Spotter", + PluralCount: 1, + }), + "Suiter": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "Suiter", + PluralCount: 1, + }), + "Photographer": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "Photographer", + PluralCount: 1, + }), + "SpecialAnimal": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "SpecialAnimal", + PluralCount: 1, + }), + "Registered": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "Registered", + }), + "SuiterWaitinglist": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "SuiterWaitinglist", + }), + "WaitinglistDesc": localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "WaitinglistDesc", + }), } sort.Sort(entities.ByRegistrationTime(attendies)) roleSuiter, _ := service.GetRoleByName("Suiter") roleSpotter, _ := service.GetRoleByName("Spotter") + roleSpecialAnimal, _ := service.GetRoleByName("SpecialAnimal") suiterWaitingList := util.CreateSuiterWaitingList( &attendies, event.SuiterPerSpotter, &roleSuiter, &roleSpotter, + &roleSpecialAnimal, ) fmt.Printf("len(attendies): %v\n", len(attendies)) return c.Render("app/views/index", fiber.Map{ diff --git a/src/app/static/styles/style.css b/src/app/static/styles/style.css index 8db6b2b..9e90461 100644 --- a/src/app/static/styles/style.css +++ b/src/app/static/styles/style.css @@ -7,9 +7,10 @@ body { main { min-width: 60vw; + max-width: 65vw; } -h1 { +.textWhite { color: #ffffff; } diff --git a/src/app/util/attendiesList.go b/src/app/util/attendiesList.go index 4dbbcdc..248feb9 100644 --- a/src/app/util/attendiesList.go +++ b/src/app/util/attendiesList.go @@ -6,17 +6,17 @@ import ( "ulmer-furs.de/pretix-proxy/v2/entities" ) -func CreateSuiterWaitingList(attendiesList *entities.AttendiesList, suiterPerSpotter *int, suiter, spotter *entities.Role) entities.AttendiesList { +func CreateSuiterWaitingList(attendiesList *entities.AttendiesList, suiterPerSpotter *int, suiter, spotter, specialAnimal *entities.Role) entities.AttendiesList { spotterCount := attendiesList.CountByRole(*spotter) suiterCount := spotterCount * *suiterPerSpotter var suiterCounter int var suiterWatinglist entities.AttendiesList var i int for i < len(*attendiesList) { - if (*attendiesList)[i].Role == *suiter { + if (*attendiesList)[i].Role == *suiter || (*attendiesList)[i].Role == *specialAnimal { suiterCounter++ } - if suiterCounter > suiterCount && (*attendiesList)[i].Role == *suiter { + if suiterCounter > suiterCount && ((*attendiesList)[i].Role == *suiter || (*attendiesList)[i].Role == *specialAnimal) { suiterWatinglist = append(suiterWatinglist, (*attendiesList)[i]) *attendiesList = append((*attendiesList)[:i], (*attendiesList)[i+1:]...) } else { diff --git a/src/app/views/index.html b/src/app/views/index.html index f916198..4f244d3 100644 --- a/src/app/views/index.html +++ b/src/app/views/index.html @@ -8,10 +8,8 @@
-

{{.Title}}

+

{{.Title}}

{{template "table" .}} -

Test:

-

{{.Locals.HelloWorld}}

\ No newline at end of file diff --git a/src/app/views/table.html b/src/app/views/table.html index 1c12fc7..91e8b4b 100644 --- a/src/app/views/table.html +++ b/src/app/views/table.html @@ -1,20 +1,56 @@ {{define "table"}} -

{{ index . "Event Name" }} {{ .Locals.Attendie }}

-

+

{{ index . "Event Name" }} {{ .Locals.Attendie }}

+

{{ .Locals.Registered }}

- + - - {{range .Attendies}} + {{range $suiter := .Attendies }} - - - + + {{ if eq $suiter.Role.Name "Suiter" }} + + {{ else if eq $suiter.Role.Name "SpecialAnimal" }} + + {{ else if eq $suiter.Role.Name "Spotter" }} + + {{ else if eq $suiter.Role.Name "Photograph" }} + + {{ else if eq $suiter.Role.Name "Guest" }} + + {{ end }} + + {{end}} + +
{{ .Locals.Name }}{{ .Locals.Name }} {{ .Locals.Role }}Time
{{.Nickname}}{{.Role.Name}}{{.RegistrationTime}}{{ $suiter.Nickname }}{{ $.Locals.Suiter }}{{ $.Locals.SpecialAnimal }}{{ $.Locals.Spotter }}{{ $.Locals.Photographer }}{{ $.Locals.Guest }}
+

{{ .Locals.SuiterWaitinglist }}

+

{{ .Locals.WaitinglistDesc}}

+ + + + + + + + + {{range $suiter := .SuiterWaitingList }} + + + {{ if eq $suiter.Role.Name "Suiter" }} + + {{ else if eq $suiter.Role.Name "SpecialAnimal" }} + + {{ else if eq $suiter.Role.Name "Spotter" }} + + {{ else if eq $suiter.Role.Name "Photograph" }} + + {{ else if eq $suiter.Role.Name "Guest" }} + + {{ end }} {{end}} diff --git a/src/config/localization.go b/src/config/localization.go index 0fa60c5..09817f8 100644 --- a/src/config/localization.go +++ b/src/config/localization.go @@ -44,11 +44,11 @@ var defaultMessages = []i18n.Message{ Other: "Registered", }, { - ID: "SuiterWatinglist", + ID: "SuiterWaitinglist", Other: "Suiter Watinglist", }, { - ID: "WatinglistDesc", + ID: "WaitinglistDesc", Other: "We set a ratio of Suiters per Spotter for each event in order to keep the count of suiters manageble for them. If you are listed here we sadly don't have enough spotters yet.", }, { diff --git a/src/localization/active.de.json b/src/localization/active.de.json index 244d7e8..721579f 100644 --- a/src/localization/active.de.json +++ b/src/localization/active.de.json @@ -4,6 +4,11 @@ "one": "Teilnehmer*in", "other": "Teilnehmende" }, + "Guest": { + "hash": "sha1-7b7f214bbd4af36f25668b0ddade965422d342fd", + "one": "Gast", + "other": "Gäste" + }, "HelloWorld": { "hash": "sha1-6225ffc638ce81e53cdf7868fe0c7435594f11e4", "other": "Hallo neuere Welt" @@ -13,9 +18,41 @@ "one": "Name", "other": "Namen" }, + "Photographer": { + "hash": "sha1-dc41992cfe878fe6744f94c3a3fc5843d9f1bc11", + "one": "Pfotograph*in", + "other": "Pfotographen" + }, + "Registered": { + "hash": "sha1-a844fcf834e7d026e7936e042c0ce2777b7fb4d9", + "other": "Angemeldet" + }, "Role": { "hash": "sha1-47dcc27d6e87ece8baebe7e3877a261a5467093d", "one": "Rolle", "other": "Rollen" + }, + "SpecialAnimal": { + "hash": "sha1-7f937e9e4906c8f52977132faa76b81f3a331e45", + "one": "#SpezialTier", + "other": "#SpezialTiere" + }, + "Spotter": { + "hash": "sha1-6f53dff03ced62b694851ffe37aab682b4b2b227", + "one": "Spotter", + "other": "Spotter" + }, + "Suiter": { + "hash": "sha1-eb6248e60da77b4df76de9b35efe44178ee34ead", + "one": "Suiter", + "other": "Suiter" + }, + "SuiterWaitinglist": { + "hash": "sha1-a5d3dc94fc4f3f0604f0cc5e077c0c9eb43340d4", + "other": "Suiter Warteliste" + }, + "WaitinglistDesc": { + "hash": "sha1-aadc433a212fca8d927e9134520f5a10aa7e4263", + "other": "Wir setzen für jedes Event ein Verhältnis von Suitern pro Spotter fest, damit die Spotter auch noch alle versorgen können. Falls du hier gelistet bist, haben sich leider noch nicht genügend Spotter angemeldet." } -} \ No newline at end of file +} diff --git a/src/localization/active.en.json b/src/localization/active.en.json index 27e8163..5f1188a 100644 --- a/src/localization/active.en.json +++ b/src/localization/active.en.json @@ -33,6 +33,6 @@ "one": "Suiter", "other": "Suiters" }, - "SuiterWatinglist": "Suiter Watinglist", - "WatinglistDesc": "We set a ratio of Suiters per Spotter for each event in order to keep the count of suiters manageble for them. If you are listed here we sadly don't have enough spotters yet." + "SuiterWaitinglist": "Suiter Watinglist", + "WaitinglistDesc": "We set a ratio of Suiters per Spotter for each event in order to keep the count of suiters manageble for them. If you are listed here we sadly don't have enough spotters yet." } diff --git a/src/localization/translate.de.json b/src/localization/translate.de.json deleted file mode 100644 index b87fe29..0000000 --- a/src/localization/translate.de.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "Guest": { - "hash": "sha1-7b7f214bbd4af36f25668b0ddade965422d342fd", - "one": "Guest", - "other": "Guets" - }, - "Photographer": { - "hash": "sha1-dc41992cfe878fe6744f94c3a3fc5843d9f1bc11", - "one": "Photographer", - "other": "Photographers" - }, - "Registered": { - "hash": "sha1-a844fcf834e7d026e7936e042c0ce2777b7fb4d9", - "other": "Registered" - }, - "SpecialAnimal": { - "hash": "sha1-7f937e9e4906c8f52977132faa76b81f3a331e45", - "one": "#SpecialAnimal", - "other": "#SpecialAnimals" - }, - "Spotter": { - "hash": "sha1-6f53dff03ced62b694851ffe37aab682b4b2b227", - "one": "Spotter", - "other": "Spotters" - }, - "Suiter": { - "hash": "sha1-eb6248e60da77b4df76de9b35efe44178ee34ead", - "one": "Suiter", - "other": "Suiters" - }, - "SuiterWatinglist": { - "hash": "sha1-a5d3dc94fc4f3f0604f0cc5e077c0c9eb43340d4", - "other": "Suiter Watinglist" - }, - "WatinglistDesc": { - "hash": "sha1-aadc433a212fca8d927e9134520f5a10aa7e4263", - "other": "We set a ratio of Suiters per Spotter for each event in order to keep the count of suiters manageble for them. If you are listed here we sadly don't have enough spotters yet." - } -}
{{ .Locals.Name }}{{ .Locals.Role }}
{{ $suiter.Nickname }}{{ $.Locals.Suiter }}{{ $.Locals.SpecialAnimal }}{{ $.Locals.Spotter }}{{ $.Locals.Photographer }}{{ $.Locals.Guest }}