diff --git a/router/faqHandler.go b/router/faqHandler.go index 11b8f399..af77167e 100644 --- a/router/faqHandler.go +++ b/router/faqHandler.go @@ -3,12 +3,15 @@ package router import ( "net/http" + "github.com/ewhal/nyaa/util/languages" "github.com/gorilla/mux" ) func FaqHandler(w http.ResponseWriter, r *http.Request) { searchForm := NewSearchForm() searchForm.HideAdvancedSearch = true + + languages.SetTranslationFromRequest(faqTemplate, r, "en-us") err := faqTemplate.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)}) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/router/homeHandler.go b/router/homeHandler.go index ab0aa54b..0cdcb13a 100644 --- a/router/homeHandler.go +++ b/router/homeHandler.go @@ -3,6 +3,7 @@ package router import ( "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/service/torrent" + "github.com/ewhal/nyaa/util/languages" "github.com/ewhal/nyaa/util/log" "github.com/gorilla/mux" "html" @@ -35,6 +36,8 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) { } navigationTorrents := Navigation{nbTorrents, maxPerPage, pagenum, "search_page"} + + languages.SetTranslationFromRequest(homeTemplate, r, "en-us") htv := HomeTemplateVariables{b, NewSearchForm(), navigationTorrents, GetUser(r), r.URL, mux.CurrentRoute(r)} err := homeTemplate.ExecuteTemplate(w, "index.html", htv) diff --git a/router/notFoundHandler.go b/router/notFoundHandler.go index b13eaf52..f7a9827a 100644 --- a/router/notFoundHandler.go +++ b/router/notFoundHandler.go @@ -4,6 +4,7 @@ import ( "html/template" "net/http" + "github.com/ewhal/nyaa/util/languages" "github.com/gorilla/mux" ) @@ -19,6 +20,8 @@ func NotFoundHandler(w http.ResponseWriter, r *http.Request) { searchForm := NewSearchForm() searchForm.HideAdvancedSearch = true + + languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us") err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)}) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/router/searchHandler.go b/router/searchHandler.go index 49ebfadf..957a8b76 100644 --- a/router/searchHandler.go +++ b/router/searchHandler.go @@ -3,6 +3,7 @@ package router import ( "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/util/search" + "github.com/ewhal/nyaa/util/languages" "github.com/gorilla/mux" "html" "net/http" @@ -39,6 +40,7 @@ func SearchHandler(w http.ResponseWriter, r *http.Request) { } htv := HomeTemplateVariables{b, searchForm, navigationTorrents, GetUser(r), r.URL, mux.CurrentRoute(r)} + languages.SetTranslationFromRequest(searchTemplate, r, "en-us") err := searchTemplate.ExecuteTemplate(w, "index.html", htv) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/router/uploadHandler.go b/router/uploadHandler.go index 2aeed5cf..1e66139f 100644 --- a/router/uploadHandler.go +++ b/router/uploadHandler.go @@ -10,6 +10,7 @@ import ( "github.com/ewhal/nyaa/db" "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/service/captcha" + "github.com/ewhal/nyaa/util/languages" "github.com/gorilla/mux" ) @@ -46,6 +47,7 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) { } else if r.Method == "GET" { uploadForm.CaptchaID = captcha.GetID() htv := UploadTemplateVariables{uploadForm, NewSearchForm(), Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)} + languages.SetTranslationFromRequest(uploadTemplate, r, "en-us") err = uploadTemplate.ExecuteTemplate(w, "index.html", htv) } else { w.WriteHeader(http.StatusMethodNotAllowed) diff --git a/router/viewTorrentHandler.go b/router/viewTorrentHandler.go index d9239722..67399e82 100644 --- a/router/viewTorrentHandler.go +++ b/router/viewTorrentHandler.go @@ -9,6 +9,7 @@ import ( "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/service/captcha" "github.com/ewhal/nyaa/service/torrent" + "github.com/ewhal/nyaa/util/languages" "github.com/ewhal/nyaa/util/log" "github.com/gorilla/mux" ) @@ -25,6 +26,7 @@ func ViewHandler(w http.ResponseWriter, r *http.Request) { b := torrent.ToJson() htv := ViewTemplateVariables{b, captcha.Captcha{CaptchaID: captcha.GetID()}, NewSearchForm(), Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)} + languages.SetTranslationFromRequest(viewTemplate, r, "en-us") err = viewTemplate.ExecuteTemplate(w, "index.html", htv) if err != nil { log.Errorf("ViewHandler(): %s", err) diff --git a/service/user/locale/en-us.all.json b/service/user/locale/en-us.all.json index df97f877..1848b60c 100644 --- a/service/user/locale/en-us.all.json +++ b/service/user/locale/en-us.all.json @@ -102,5 +102,393 @@ { "id":"signup_verification_email", "translation": "Now, you are one step left before being part of our community! Check your emails (inbox or spam folder) and click the link provided for activating your account!" + }, + { + "id":"settings", + "translation": "Account Settings" + }, + { + "id":"torrents", + "translation": "Torrents" + }, + { + "id":"follow", + "translation": "Follow" + }, + { + "id":"profile_page", + "translation": "%s Profile Page" + }, + { + "id":"see_more_torrents_from", + "translation": "See more torrents from %s " + }, + { + "id":"category", + "translation": "Category" + }, + { + "id": "name", + "translation": "Name" + }, + { + "id": "date", + "translation": "Date" + }, + { + "id": "size", + "translation": "Size" + }, + { + "id": "links", + "translation": "Links" + }, + { + "id": "home", + "translation": "Home" + }, + { + "id": "error_404", + "translation": "Error 404" + }, + { + "id": "toggle_navigation", + "translation": "Toggle navigation" + }, + { + "id": "upload", + "translation": "Upload" + }, + { + "id": "faq", + "translation": "FAQ" + }, + { + "id": "fap", + "translation": "Fap" + }, + { + "id": "advanced_search", + "translation": "Advanced Search" + }, + { + "id": "nothing_here", + "translation": "Nothing Here." + }, + { + "id": "404_not_found", + "translation": "404 Not Found" + }, + { + "id": "profile", + "translation": "Profile" + }, + { + "id": "sign_out", + "translation": "Sign-out" + }, + { + "id": "member", + "translation": "Member" + }, + { + "id": "sign_in", + "translation": "Sign in" + }, + { + "id": "sign_up", + "translation": "Sign Up" + }, + { + "id": "no_results_found", + "translation": "No Results found" + }, + { + "id": "notice_keep_seeding", + "translation": "NOTICE: KEEP SEEDING AND ENABLE DHT YOU RETARD" + }, + { + "id": "official_nyaapocalipse_faq", + "translation": "Official Nyaapocalypse FAQ" + }, + { + "id": "links_replacement_mirror", + "translation": "Links for the replacement/mirror" + }, + { + "id": "what_happened", + "translation": "What happened?" + }, + { + "id": "nyaa_se_went_offline", + "translation": "nyaa.se and associated domains (such as nyaatorrents.info) went offline on May 01, 2017." + }, + { + "id": "its_not_a_ddos", + "translation": "They were deactivated, so it's not a DDoS attack like usual." + }, + { + "id": "future_not_looking_good", + "translation": "Future prospects for nyaa are not looking good. (It's dead)" + }, + { + "id": "recovery_effort", + "translation": "There is a recovery effort taking place." + }, + { + "id": "is_everything_lost", + "translation": "Is everything lost?" + }, + { + "id": "in_short_no", + "translation": "In short, No." + }, + { + "id": "are_some_things_lost", + "translation": "Are some things lost?" + }, + { + "id": "answer_is_nyaa_db_lost", + "translation": "We have a database of the torrents on nyaa up to April 5 May 1. That means almost nothing is lost." + }, + { + "id": "answer_is_sukebei_db_lost", + "translation": "Sukebei, however might be in worse shape. Currently we only have sukebei databases up to 2016, but a newer database might be available for use." + }, + { + "id": "how_are_we_recovering", + "translation": "How are we recovering?" + }, + { + "id": "answer_how_are_we_recovering", + "translation": "The aforementioned databases are being hosted at nyaa.pantsu.cat and sukebei.pantsu.cat. There is a search function, and (almost) full nyaa functionality should be coming soon. Seeder/leecher statistics are possible via scraping and might be restored sometime in the future, since other feature take priority right now." + }, + { + "id": "are_the_trackers_working", + "translation": "Are the torrents still working?" + }, + { + "id": "answer_are_the_trackers_working", + "translation": "Even if the trackers are down, seeders are still connected to the decentralized DHT network. As long as the file is listed on the DHT network, business should carry on as usual." + }, + { + "id": "how_do_i_download_the_torrents", + "translation": "How do I download the torrents?" + }, + { + "id": "answer_how_do_i_download_the_torrents", + "translation": "Just use the magnet link. The magnet link will be used by your BitTorrent client to look up the file on the DHT network and it should download just fine." + }, + { + "id": "magnet_link_should_look_like", + "translation": "The magnet link should look like this:" + }, + { + "id": "which_trackers_do_you_recommend", + "translation": "Which trackers do you recommend using?" + }, + { + "id": "answer_which_trackers_do_you_recommend", + "translation": "If your torrent upload is denied because of trackers you'll need to add some of these:" + }, + { + "id": "how_can_i_help", + "translation": "How can I help?" + }, + { + "id": "answer_how_can_i_help", + "translation": "If you have website development expertise, you can join the #nyaapantsu IRC channel on irc.rizon.net. If you have any current databases, especially for sukebei, UPLOAD THEM." + }, + { + "id": "your_design_sucks_found_a_bug", + "translation": "Your design sucks / I found a bug" + }, + { + "id": "why_written_in_go", + "translation": "Why is your shit written in Go?" + }, + { + "id": "authors_favorite_language", + "translation": "It's the author's favorite programming language." + }, + { + "id": "nyaa_pantsu_dont_host_files", + "translation": "nyaa.pantsu.cat and sukebei.pantsu.cat do not host any files." + }, + { + "id": "upload_magnet", + "translation": "Upload magnet" + }, + { + "id": "torrent_file", + "translation": "Torrent file" + }, + { + "id": "uploading_torrent_prefills_fields", + "translation": "Uploading a torrent file allows pre-filling some fields, this is recommended." + }, + { + "id": "magnet_link", + "translation": "Magnet Link" + }, + { + "id": "all_categories", + "translation": "All categories" + }, + { + "id": "anime", + "translation": "Anime" + }, + { + "id": "anime_amv", + "translation": "Anime - Anime Music Video" + }, + { + "id": "anime_english_translated", + "translation": "Anime - English-translated" + }, + { + "id": "anime_non_english_translated", + "translation": "Anime - Non-English-translated" + }, + { + "id": "anime_raw", + "translation": "Anime - Raw" + }, + { + "id": "audio", + "translation": "Audio" + }, + { + "id": "audio_lossless", + "translation": "Audio - Lossless" + }, + { + "id": "audio_lossy", + "translation": "Audio - Lossy" + }, + { + "id": "literature", + "translation": "Literature" + }, + { + "id": "literature_english_translated", + "translation": "Literature - English-translated" + }, + { + "id": "literature_raw", + "translation": "Literature - Raw" + }, + { + "id": "literature_non_english_translated", + "translation": "Literature - Non-English-translated" + }, + { + "id": "live_action", + "translation": "Live Action" + }, + { + "id": "live_action_english_translated", + "translation": "Live Action - English-translated" + }, + { + "id": "live_action_idol_pv", + "translation": "Live Action - Idol/Promotional Video" + }, + { + "id": "live_action_non_english_translated", + "translation": "Live Action - Non-English-translated" + }, + { + "id": "live_action_raw", + "translation": "Live Action - Raw" + }, + { + "id": "pictures", + "translation": "Pictures" + }, + { + "id": "pictures_graphics", + "translation": "Pictures - Graphics" + }, + { + "id": "pictures_photos", + "translation": "Pictures - Photos" + }, + { + "id": "software", + "translation": "Software" + }, + { + "id": "software_applications", + "translation": "Software - Applications" + }, + { + "id": "software_games", + "translation": "Software - Games" + }, + { + "id": "torrent_description", + "translation": "Torrent Description" + }, + { + "id": "limited_html_set_is_allowed_use", + "translation": "A limited set of HTML is allowed in the description, make sure to use" + }, + { + "id": "show_all", + "translation": "Show all" + }, + { + "id": "filter_remakes", + "translation": "Filter Remakes" + }, + { + "id": "trusted", + "translation": "Trusted" + }, + { + "id": "id", + "translation": "ID" + }, + { + "id": "downloads", + "translation": "Downloads" + }, + { + "id": "descending", + "translation": "Descending" + }, + { + "id": "ascending", + "translation": "Ascending" + }, + { + "id": "search", + "translation": "Search" + }, + { + "id": "hash", + "translation": "Hash" + }, + { + "id": "description", + "translation": "Description" + }, + { + "id": "comments", + "translation": "Comments" + }, + { + "id": "submit_a_comment_as_username", + "translation": "Submit a comment as %s" + }, + { + "id": "submit_a_comment_as_anonymous", + "translation": "Submit a comment as Anonymous" + }, + { + "id": "submit", + "translation": "Submit" } ] diff --git a/templates/404.html b/templates/404.html index 46d98420..91570a38 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,7 +1,7 @@ -{{define "title"}}404 Not Found{{end}} +{{define "title"}}{{T "404_not_found"}}{{end}} {{define "content"}}
-

404 Not Found

+

{{T "404_not_found"}}


diff --git a/templates/FAQ.html b/templates/FAQ.html index 060cd167..b939130b 100644 --- a/templates/FAQ.html +++ b/templates/FAQ.html @@ -1,50 +1,44 @@ -{{define "title"}}FAQ{{end}} +{{define "title"}}{{T "faq"}}{{end}} {{define "content"}}
-

NOTICE: KEEP SEEDING AND ENABLE DHT YOU RETARD

+

{{T "notice_keep_seeding"}}

-

Official Nyaapocalypse FAQ

+

{{T "official_nyaapocalipse_faq"}}


-

Links for the replacement/mirror

+

{{T "links_replacement_mirror"}}

Nyaa - nyaa.pantsu.cat
Sukebei - sukebei.pantsu.cat -

What happened?

+

{{T "what_happened"}}

-

Is everything lost?

-

In short, No.

+

{{T "is_everything_lost"}}

+

{{T "in_short_no"}}

-

Are some things lost?

-

We have a database of the torrents on nyaa up to April 5 May 1. That means almost nothing is lost.

-

Sukebei, however might be in worse shape. Currently we only have sukebei databases up to 2016, - but a newer database might be available for use.

+

{{T "are_some_things_lost"}}

+

{{T "answer_is_nyaa_db_lost"}}

+

{{T "answer_is_sukebei_db_lost"}}

-

How are we recovering?

-

The aforementioned databases are being hosted at nyaa.pantsu.cat and sukebei.pantsu.cat. - There is a search function, and (almost) full nyaa functionality should be coming soon. - Seeder/leecher statistics are possible via scraping and might be restored sometime in the future, - since other feature take priority right now.

+

{{T "how_are_we_recovering"}}

+

{{T "answer_how_are_we_recovering"}}

-

Are the torrents still working?

-

Even if the trackers are down, seeders are still connected to the decentralized DHT network. - As long as the file is listed on the DHT network, business should carry on as usual.

+

{{T "are_the_trackers_working"}}

+

{{T "answer_are_the_trackers_working"}}

-

How do I download the torrents?

-

Just use the magnet link. The magnet link will be used by your BitTorrent client to look up the file on the - DHT network and it should download just fine.

-

The magnet link should look like this: +

{{T "how_do_i_download_the_torrents"}}

+

{{T "answer_how_do_i_download_the_torrents"}}

+

{{T "magnet_link_should_look_like"}} magnet:?xt=urn:btih:[hash]&dn=[name]&tr=[tracker]&tr=[...]

-

Which trackers do you recommend using?

-

If your torrent upload is denied because of trackers you'll need to add some of these:

+

{{T "which_trackers_do_you_recommend"}}

+

{{T "answer_which_trackers_do_you_recommend"}}

udp://tracker.coppersurfer.tk:6969
 udp://zer0day.to:1337/announce
 udp://tracker.leechers-paradise.org:6969
@@ -55,21 +49,20 @@ udp://eddie4.nl:6969/announce
 http://mgtracker.org:6969/announce
 http://tracker.baka-sub.cf/announce
-

How can I help?

-

If you have website development expertise, you can join the #nyaapantsu IRC channel on irc.rizon.net. - If you have any current databases, especially for sukebei, UPLOAD THEM.

+

{{T "how_can_i_help"}}

+

{{T "answer_how_can_i_help"}}

-

Your design sucks / I found a bug

+

{{T "your_design_sucks_found_a_bug"}}

https://github.com/ewhal/nyaa/issues.

-

Why is your shit written in Go?

-

It's the author's favorite programming language.

+

{{T "why_written_in_go"}}

+

{{T "authors_favorite_language"}}


funny meme
-

nyaa.pantsu.cat and sukebei.pantsu.cat do not host any files.

+

{{T "nyaa_pantsu_dont_host_files"}}

{{end}} diff --git a/templates/_badgemenu.html b/templates/_badgemenu.html index 6baafbc4..a0b62a0c 100644 --- a/templates/_badgemenu.html +++ b/templates/_badgemenu.html @@ -5,15 +5,15 @@ {{if gt .Id 0}} {{ .Username }} {{ else }} {{end}} diff --git a/templates/_search.html b/templates/_search.html index 70ff7e04..bdc9f222 100644 --- a/templates/_search.html +++ b/templates/_search.html @@ -1,48 +1,48 @@ {{define "search_common"}} {{end}} {{define "search_advanced"}} + - + {{end}} diff --git a/templates/home.html b/templates/home.html index c39ec9e6..0b469a0d 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,4 +1,4 @@ -{{define "title"}}Home{{end}} +{{define "title"}}{{T "home"}}{{end}} {{define "contclass"}}cont-home{{end}} {{define "content"}}
@@ -11,11 +11,11 @@
- - - - - + + + + + {{ range .ListTorrents}} - Nyaa Pantsu - {{block "title" .}}Error 404{{end}} + Nyaa Pantsu - {{block "title" .}}{{ T "error_404" }}{{end}} @@ -33,7 +33,7 @@
- + - + - + - + - + - + - + {{ range $index, $element := .Comments }} @@ -60,13 +60,14 @@ {{end}}
- + {{/* There should be a better way to use translation on this... */}} +
{{with .Captcha}} {{block "captcha" .}}{{end}} {{end}} - + {{end}}
CategoryNameDateSizeLinks{{T "category"}}{{T "name"}}{{T "date"}}{{T "size"}}{{T "links"}}
Name{{T "name"}} {{.Name}}
Hash{{T "hash"}} {{.Hash}}
Date{{T "date"}} {{.Date}}
Size{{T "size"}} {{.Filesize}}
Links{{T "links"}} Download! @@ -39,12 +39,12 @@
Description{{T "description"}} {{.Description}}
Comments{{T "comments"}}