diff --git a/model/dumps.go b/model/dumps.go index a50462ad..ded92473 100644 --- a/model/dumps.go +++ b/model/dumps.go @@ -25,7 +25,7 @@ type DatabaseDumpJSON struct { func (dump *DatabaseDump) ToJSON() DatabaseDumpJSON { json := DatabaseDumpJSON{ Date: dump.Date.Format(time.RFC3339), - Filesize: util.FormatFilesize2(dump.Filesize), + Filesize: util.FormatFilesize(dump.Filesize), Name: dump.Name, TorrentLink: template.URL(dump.TorrentLink), } diff --git a/model/torrent.go b/model/torrent.go index 361991e3..0cd5ddd9 100644 --- a/model/torrent.go +++ b/model/torrent.go @@ -124,7 +124,7 @@ type CommentJSON struct { type FileJSON struct { Path string `json:"path"` - Filesize string `json:"filesize"` + Filesize int64 `json:"filesize"` } type TorrentJSON struct { @@ -133,7 +133,7 @@ type TorrentJSON struct { Status int `json:"status"` Hash string `json:"hash"` Date string `json:"date"` - Filesize string `json:"filesize"` + Filesize int64 `json:"filesize"` Description template.HTML `json:"description"` Comments []CommentJSON `json:"comments"` SubCategory string `json:"sub_category"` @@ -176,7 +176,7 @@ func (t *Torrent) ToJSON() TorrentJSON { for _, f := range t.FileList { fileListJSON = append(fileListJSON, FileJSON{ Path: filepath.Join(f.Path()...), - Filesize: util.FormatFilesize2(f.Filesize), + Filesize: f.Filesize, }) } @@ -205,7 +205,7 @@ func (t *Torrent) ToJSON() TorrentJSON { Status: t.Status, Hash: t.Hash, Date: t.Date.Format(time.RFC3339), - Filesize: util.FormatFilesize2(t.Filesize), + Filesize: t.Filesize, Description: util.MarkdownToHTML(t.Description), Comments: commentsJSON, SubCategory: strconv.Itoa(t.SubCategory), diff --git a/router/template_functions.go b/router/template_functions.go index d6c0d88f..e0e2478e 100644 --- a/router/template_functions.go +++ b/router/template_functions.go @@ -2,7 +2,6 @@ package router import ( "html/template" - //"log" "math" "net/url" "strconv" @@ -10,6 +9,7 @@ import ( "github.com/NyaaPantsu/nyaa/config" "github.com/NyaaPantsu/nyaa/service/user/permission" + "github.com/NyaaPantsu/nyaa/util" "github.com/NyaaPantsu/nyaa/util/languages" ) @@ -120,7 +120,6 @@ var FuncMap = template.FuncMap{ if endValue > int(maxPages) { endValue = int(maxPages) } - //log.Println(nav.TotalItem) for i := startValue; i <= endValue; i++ { pageNum := strconv.Itoa(i) url, _ := Router.Get(nav.Route).URL("page", pageNum) @@ -208,11 +207,11 @@ var FuncMap = template.FuncMap{ } return e }, - "fileSize": func(filesize string, T languages.TemplateTfunc) template.HTML { - if (filesize == "Unknown") { - return T("unknown") - } - return template.HTML(filesize) + "fileSize": func(filesize int64, T languages.TemplateTfunc) template.HTML { + if (filesize == 0) { + return T("unknown") + } + return template.HTML(util.FormatFilesize(filesize)) }, "makeCaptchaData": func(captchaID string, T languages.TemplateTfunc) captchaData { return captchaData{captchaID, T} diff --git a/translations/de-de.all.json b/translations/de-de.all.json index c272b21d..11e2b370 100644 --- a/translations/de-de.all.json +++ b/translations/de-de.all.json @@ -183,6 +183,10 @@ "id": "fap", "translation": "Fap" }, + { + "id": "fun", + "translation": "Fun" + }, { "id": "advanced_search", "translation": "Erweiterte Suche" @@ -249,7 +253,7 @@ }, { "id": "future_not_looking_good", - "translation": "Die Zukunft für nyaa sieht schlecht aus. (Die Seite ist tot)" + "translation": "Die Zukunft für nyaa sieht schlecht aus. („Er ist tot, Jim.“)" }, { "id": "recovery_effort", @@ -283,6 +287,14 @@ "id": "answer_how_are_we_recovering", "translation": "Die obengenannten Datenbanken werden im Moment auf nyaa.pantsu.cat und sukebei.pantsu.cat bereitgestellt. Es gibt eine Suchfunktion und (fast) vollständige Funktionalität von nyaa sollte bald wiederhergestellt sein." }, + { + "id": "how_do_i_link_my_old_account", + "translation": "Wie verbinde ich meine alten Uploads mit meinem neuen Account?" + }, + { + "id": "answer_how_do_i_link_my_old_account", + "translation": "Gehe zu #nyaapantsu-help@Rizon und bitte einen Moderator deine alten Torrents zu migrieren, während du deinen alten und neuen Benutzernamen erwähnst." + }, { "id": "are_the_trackers_working", "translation": "Funktionieren die Torrents noch?" @@ -309,11 +321,7 @@ }, { "id": "answer_which_trackers_do_you_recommend", - "translation": "Wir haben jetzt unseren eigenen Tracker! Füge ihn vor dem Hochladen deines Torrents hinzu:" - }, - { - "id": "other_trackers", - "translation": "Allerdings solltest du diese auch hinzufügen. Nur für den Fall, dass etwas schief läuft:" + "translation": "Wir haben jetzt unseren eigenen Tracker!(doko.moe) Jedoch solltest du der Zuverlässigkeit wegen alle Tracker aus dieser Liste hinzufügen." }, { "id": "how_can_i_help", @@ -451,6 +459,42 @@ "id": "software_games", "translation": "Software - Spiele" }, + { + "id": "art", + "translation": "Art" + }, + { + "id": "art_anime", + "translation": "2D - Anime" + }, + { + "id": "art_doujinshi", + "translation": "2D - Doujinshi" + }, + { + "id": "art_games", + "translation": "2D - Spiele" + }, + { + "id": "art_manga", + "translation": "2D - Manga" + }, + { + "id": "art_pictures", + "translation": "2D - Bilder" + }, + { + "id": "real_life", + "translation": "3D" + }, + { + "id": "real_life_photobooks_and_pictures", + "translation": "3D - Fotokollektionen / Fotos" + }, + { + "id": "real_life_videos", + "translation": "3D - Videos" + }, { "id": "torrent_description", "translation": "Torrent Beschreibung" @@ -547,6 +591,10 @@ "id": "moderator", "translation": "Moderator" }, + { + "id": "api_token", + "translation": "API Token" + }, { "id": "save_changes", "translation": "Änderungen speichern" @@ -635,6 +683,18 @@ "id": "delete", "translation": "Löschen" }, + { + "id": "website_link", + "translation": "Webseiten Link" + }, + { + "id": "files", + "translation": "Dateien" + }, + { + "id": "filename", + "translation": "Dateiname" + }, { "id": "uploaded_by", "translation": "Hochgeladen von" @@ -686,5 +746,41 @@ { "id": "cancel", "translation": "Abbrechen" + }, + { + "id": "please_include_our_tracker", + "translation": "Bitte füge udp://tracker.doko.moe:6969 deinen Trackern hinzu." + }, + { + "id": "unknown", + "translation": "Unbekannt" + }, + { + "id": "last_scraped", + "translation": "Letzter Scrape: " + }, + { + "id": "server_status_link", + "translation": "Der Server-Status kann hier eingesehen werden" + }, + { + "id": "no_database_dumps_available", + "translation": "Im Moment sind keine Datenbank-Dumps verfügbar." + }, + { + "id": "clear_notifications", + "translation": "Benachrichtigungen leeren" + }, + { + "id": "notifications_cleared", + "translation": "Benachrichtigungen geleert!" + }, + { + "id": "my_notifications", + "translation": "Meine Benachrichtigungen" + }, + { + "id": "new_torrent_uploaded", + "translation": "Neuer Torrent: \"%s\" von %s" } ] diff --git a/util/format.go b/util/format.go index 1d440230..fd6c7180 100644 --- a/util/format.go +++ b/util/format.go @@ -25,10 +25,3 @@ func FormatFilesize(bytes int64) string { } return fmt.Sprintf("%.1f %s", value, unit) } - -func FormatFilesize2(bytes int64) string { - if bytes == 0 { // this is what gorm returns for NULL - return "Unknown" - } - return FormatFilesize(bytes) -}