From 67897a68ea8a12d0d3e29c77db76ae24623eae00 Mon Sep 17 00:00:00 2001 From: ElegantMonkey <ramonzitosdesorte@hotmail.com> Date: Mon, 8 May 2017 17:42:44 -0300 Subject: [PATCH] Extract strings from remaining templates --- service/user/locale/en-us.all.json | 84 ++++++++++++++++++++++++++++++ templates/_search.html | 72 ++++++++++++------------- templates/_user_list_torrents.html | 10 ++-- templates/view.html | 19 +++---- 4 files changed, 135 insertions(+), 50 deletions(-) diff --git a/service/user/locale/en-us.all.json b/service/user/locale/en-us.all.json index 5e137023..617dd3a4 100644 --- a/service/user/locale/en-us.all.json +++ b/service/user/locale/en-us.all.json @@ -331,6 +331,14 @@ "id": "magnet_link", "translation": "Magnet Link" }, + { + "id": "all_categories", + "translation": "All categories" + }, + { + "id": "anime", + "translation": "Anime" + }, { "id": "anime_amv", "translation": "Anime - Anime Music Video" @@ -347,6 +355,10 @@ "id": "anime_raw", "translated": "Anime - Raw" }, + { + "id": "audio", + "translated": "Audio" + }, { "id": "audio_lossless", "translated": "Audio - Lossless" @@ -355,6 +367,10 @@ "id": "audio_lossy", "translated": "Audio - Lossy" }, + { + "id": "literature", + "translated": "Literature" + }, { "id": "literature_english_translated", "translated": "Literature - English-translated" @@ -367,6 +383,10 @@ "id": "literature_non_english_translated", "translated": "Literature - Non-English-translated" }, + { + "id": "live_action", + "translated": "Live Action" + }, { "id": "live_action_english_translated", "translated": "Live Action - English-translated" @@ -383,6 +403,10 @@ "id": "live_action_raw", "translated": "Live Action - Raw" }, + { + "id": "pictures", + "translated": "Pictures" + }, { "id": "pictures_graphics", "translated": "Pictures - Graphics" @@ -391,6 +415,10 @@ "id": "pictures_photos", "translated": "Pictures - Photos" }, + { + "id": "software", + "translated": "Software" + }, { "id": "software_applications", "translated": "Software - Applications" @@ -406,5 +434,61 @@ { "id": "limited_html_set_is_allowed_use", "translated": "A limited set of HTML is allowed in the description, make sure to use" + }, + { + "id": "show_all", + "translated": "Show all" + }, + { + "id": "filter_remakes", + "translated": "Filter Remakes" + }, + { + "id": "trusted", + "translated": "Trusted" + }, + { + "id": "id", + "translated": "ID" + }, + { + "id": "downloads", + "translated": "Downloads" + }, + { + "id": "descending", + "translated": "Descending" + }, + { + "id": "ascending", + "translated": "Ascending" + }, + { + "id": "search", + "translated": "Search" + }, + { + "id": "hash", + "translated": "Hash" + }, + { + "id": "description", + "translated": "Description" + }, + { + "id": "comments", + "translated": "Comments" + }, + { + "id": "submit_a_comment_as_username", + "translated": "Submit a comment as %s" + }, + { + "id": "submit_a_comment_as_anonymous", + "translated": "Submit a comment as Anonymous" + }, + { + "id": "submit", + "translated": "Submit" } ] 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"}} <select name="c" class="form-control input-sm" value> - <option value="_">All categories</option> - <option value="3_" {{if eq .Search.Category "3_"}}selected{{end}}>Anime</option> - <option value="3_12" {{if eq .Search.Category "3_12"}}selected{{end}}>Anime - Anime Music Video</option> - <option value="3_5" {{if eq .Search.Category "3_5"}}selected{{end}}>Anime - English-translated</option> - <option value="3_13" {{if eq .Search.Category "3_13"}}selected{{end}}>Anime - Non-English-translated</option> - <option value="3_6" {{if eq .Search.Category "3_6"}}selected{{end}}>Anime - Raw</option> - <option value="2_" {{if eq .Search.Category "2_"}}selected{{end}}>Audio</option> - <option value="2_3" {{if eq .Search.Category "2_3"}}selected{{end}}>Audio - Lossless</option> - <option value="2_4" {{if eq .Search.Category "2_4"}}selected{{end}}>Audio - Lossy</option> - <option value="4_" {{if eq .Search.Category "4_"}}selected{{end}}>Literature</option> - <option value="4_7" {{if eq .Search.Category "4_7"}}selected{{end}}>Literature - English-translated</option> - <option value="4_8" {{if eq .Search.Category "4_8"}}selected{{end}}>Literature - Raw</option> - <option value="4_14" {{if eq .Search.Category "4_14"}}selected{{end}}>Literature - Non-English-translated</option> - <option value="5_" {{if eq .Search.Category "5_"}}selected{{end}}>Live Action</option> - <option value="5_9" {{if eq .Search.Category "5_9"}}selected{{end}}>Live Action - English-translated</option> - <option value="5_10" {{if eq .Search.Category "5_10"}}selected{{end}}>Live Action - Idol/Promotional Video</option> - <option value="5_18" {{if eq .Search.Category "5_18"}}selected{{end}}>Live Action - Non-English-translated</option> - <option value="5_11" {{if eq .Search.Category "5_11"}}selected{{end}}>Live Action - Raw</option> - <option value="6_" {{if eq .Search.Category "6_"}}selected{{end}}>Pictures</option> - <option value="6_15" {{if eq .Search.Category "6_15"}}selected{{end}}>Pictures - Graphics</option> - <option value="6_16" {{if eq .Search.Category "6_16"}}selected{{end}}>Pictures - Photos</option> - <option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>Software</option> - <option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>Software - Applications</option> - <option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>Software - Games</option> + <option value="_">{{T "all_categories"}}</option> + <option value="3_" {{if eq .Search.Category "3_"}}selected{{end}}>{{T "anime"}}</option> + <option value="3_12" {{if eq .Search.Category "3_12"}}selected{{end}}>{{T "anime_amv"}}</option> + <option value="3_5" {{if eq .Search.Category "3_5"}}selected{{end}}>{{T "anime_english_translated"}}</option> + <option value="3_13" {{if eq .Search.Category "3_13"}}selected{{end}}>{{T "anime_non_english_translated"}}</option> + <option value="3_6" {{if eq .Search.Category "3_6"}}selected{{end}}>{{T "anime_raw"}}</option> + <option value="2_" {{if eq .Search.Category "2_"}}selected{{end}}>{{T "audio"}}</option> + <option value="2_3" {{if eq .Search.Category "2_3"}}selected{{end}}>{{T "audio_lossless"}}</option> + <option value="2_4" {{if eq .Search.Category "2_4"}}selected{{end}}>{{T "audio_lossy"}}</option> + <option value="4_" {{if eq .Search.Category "4_"}}selected{{end}}>{{T "literature"}}</option> + <option value="4_7" {{if eq .Search.Category "4_7"}}selected{{end}}>{{T "literature_english_translated"}}</option> + <option value="4_8" {{if eq .Search.Category "4_8"}}selected{{end}}>{{T "literature_raw"}}</option> + <option value="4_14" {{if eq .Search.Category "4_14"}}selected{{end}}>{{T "literature_non_english_translated"}}</option> + <option value="5_" {{if eq .Search.Category "5_"}}selected{{end}}>{{T "live_action"}}</option> + <option value="5_9" {{if eq .Search.Category "5_9"}}selected{{end}}>{{T "live_action_english_translated"}}</option> + <option value="5_10" {{if eq .Search.Category "5_10"}}selected{{end}}>{{T "live_action_idol_pv"}}</option> + <option value="5_18" {{if eq .Search.Category "5_18"}}selected{{end}}>{{T "live_action_non_english_translated"}}</option> + <option value="5_11" {{if eq .Search.Category "5_11"}}selected{{end}}>{{T "live_action_raw"}}</option> + <option value="6_" {{if eq .Search.Category "6_"}}selected{{end}}>{{T "pictures"}}</option> + <option value="6_15" {{if eq .Search.Category "6_15"}}selected{{end}}>{{T "pictures_graphics"}}</option> + <option value="6_16" {{if eq .Search.Category "6_16"}}selected{{end}}>{{T "pictures_photos"}}</option> + <option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>{{T "software"}}</option> + <option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>{{T "software_applications"}}</option> + <option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>{{T "software_games"}}</option> </select> <select name="s" class="form-control input-sm"> - <option value="">Show all</option> - <option value="2" {{if eq .Search.Status "2"}}selected{{end}}>Filter Remakes</option> - <option value="3" {{if eq .Search.Status "3"}}selected{{end}}>Trusted</option> + <option value="">{{T "show_all"}}</option> + <option value="2" {{if eq .Search.Status "2"}}selected{{end}}>{{T "filter_remakes"}}</option> + <option value="3" {{if eq .Search.Status "3"}}selected{{end}}>{{T "trusted"}}</option> <option value="4" {{if eq .Search.Status "4"}}selected{{end}}>A+</option> </select> {{end}} {{define "search_advanced"}} <select name="sort" class="form-control input-sm"> - <option value="torrent_id" {{if eq .Search.Sort "torrent_id"}}selected{{end}}>ID</option> - <option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>Name</option> - <option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>Date</option> - <option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>Downloads</option> - <option value="filesize" {{if eq .Search.Sort "filesize"}}selected{{end}}>Size</option> + <option value="torrent_id" {{if eq .Search.Sort "torrent_id"}}selected{{end}}>{{T "id"}}</option> + <option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>{{T "name"}}</option> + <option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>{{T "date"}}</option> + <option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>{{T "downloads"}}</option> + <option value="filesize" {{if eq .Search.Sort "filesize"}}selected{{end}}>{{T "size"}}</option> </select> <select name="order" class="form-control input-sm"> - <option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option> - <option value="asc" {{if eq .Search.Order "asc"}}selected{{end}}>Ascending</option> + <option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>{{T "descending"}}</option> + <option value="asc" {{if eq .Search.Order "asc"}}selected{{end}}>{{T "ascending"}}</option> </select> <select name="max" class="form-control input-sm"> <option value="5" {{if eq .Navigation.MaxItemPerPage 5}}selected{{end}}>5</option> @@ -65,9 +65,9 @@ {{define "search_button"}} <div class="input-group"> - <input name="q" class="form-control input-sm" placeholder="Search" type="text" value="{{.Search.Query}}"> + <input name="q" class="form-control input-sm" placeholder="{{T "search"}}" type="text" value="{{.Search.Query}}"> <span class="input-group-btn"> - <button type="submit" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-search" aria-hidden="true"></span><span class="search_text"> Search</span></button> + <button type="submit" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-search" aria-hidden="true"></span><span class="search_text"> {{T "search"}}</span></button> </span> </div> {{end}} diff --git a/templates/_user_list_torrents.html b/templates/_user_list_torrents.html index acba09af..a3be9f66 100644 --- a/templates/_user_list_torrents.html +++ b/templates/_user_list_torrents.html @@ -3,11 +3,11 @@ <div class="table-responsive"> <table class="table custom-table-hover"> <tr> - <th>Category</th> - <th>Name</th> - <th>Date</th> - <th>Size</th> - <th>Links</th> + <th>{{T "category"}}</th> + <th>{{T "name"}}</th> + <th>{{T "date"}}</th> + <th>{{T "size"}}</th> + <th>{{T "links"}}</th> </tr> {{ range .Torrents }} <tr class="torrent-info diff --git a/templates/view.html b/templates/view.html index a4e8d6d2..9f229574 100644 --- a/templates/view.html +++ b/templates/view.html @@ -8,26 +8,26 @@ <tr {{if eq .Status 2}}class="remake"{{end}} {{if eq .Status 3}}class="trusted"{{end}} {{if eq .Status 4}}class="aplus"{{end}}> - <td>Name</td> + <td>{{T "name"}}</td> <td> {{.Name}} <img style="float:right" src="{{$.URL.Parse (printf "/img/torrents/%s.png" .Sub_Category) }}"> </td> </tr> <tr> - <td>Hash</td> + <td>{{T "hash"}}</td> <td class="torrent-hash">{{.Hash}}</td> </tr> <tr> - <td>Date</td> + <td>{{T "date"}}</td> <td class="date-full">{{.Date}}</td> </tr> <tr> - <td>Size</td> + <td>{{T "size"}}</td> <td>{{.Filesize}}</td> </tr> <tr> - <td>Links</td> + <td>{{T "links"}}</td> <td> <a aria-label="Magnet Button" href="{{.Magnet}}" type="button" class="btn btn-success download-btn"> <span class="glyphicon glyphicon-magnet" aria-hidden="true"></span> Download! @@ -39,12 +39,12 @@ </td> </tr> <tr> - <td>Description</td> + <td>{{T "description"}}</td> <td>{{.Description}}</td> </tr> <tr style="height:2em"> <td></td><td></td> </tr> <tr> - <td>Comments</td> + <td>{{T "comments"}}</td> <td></td> </tr> {{ range $index, $element := .Comments }} @@ -60,13 +60,14 @@ {{end}} <form method="post"> <div class="form-group"> - <label for="comment">Submit a Comment as {{ if gt .User.Id 0}} {{.User.Username}} {{else}} Anonymous {{end}}</label> + {{/* There should be a better way to use translation on this... */}} + <label for="comment">{{ if gt .User.Id 0}} {{T "submit_a_comment_as_username" .User.Username}} {{else}} {{T "submit_a_comment_as_anonymous"}} {{end}}</label> <textarea name="comment" class="form-control" rows="5"></textarea> </div> {{with .Captcha}} {{block "captcha" .}}{{end}} {{end}} - <input type="submit" value="Submit"> + <input type="submit" value="{{T "submit"}}"> </form> </div> {{end}}