Add translation capability

This commit is contained in:
sqozz
2017-12-29 08:03:17 +01:00
parent 2c220afced
commit 9c053b5021
15 changed files with 342 additions and 132 deletions

View File

@ -6,7 +6,7 @@ vim: ts=2 noexpandtab
{% set active_page = "categories" %}
{% block content %}
<link href="{{ url_for("static", filename="css/categories.css") }}" rel="stylesheet">
<h2 class="headline">Categories</h2>
<h2 class="headline">{{ _("Categories") }}</h2>
<div id="categories">
{% for category in categories %}
<div>

View File

@ -2,13 +2,13 @@
vim: ts=2 noexpandtab
-->
{% extends "index.html" %}
{% block title %}{{ super() }} - {{ getLocalString(language, "create") }}{% endblock%}
{% block title %}{{ super() }} - {{ _("Create") }}{% endblock%}
{% set active_page = "create" %}
{% block content %}
<link href="{{ url_for("static", filename="css/create.css") }}" rel="stylesheet">
<script src="{{ url_for("static", filename="js/create.js") }}"></script>
<div>
<h2 class="headline">{{ getLocalString(language, "create_new_torrent") }}</h2>
<h2 class="headline">{{ _("Create new torrent") }}</h2>
{% if errors %}
{% for error in errors %}
<div class="alert alert-danger alert-dismissible" role="alert">
@ -27,24 +27,24 @@ vim: ts=2 noexpandtab
{% endif %}
<form class="form-horizontal" action="/create" method="post" enctype="multipart/form-data" onsubmit="return validateForm()">
<div class="form-group">
<label for="inputTorrentFile" class="col-sm-3 control-label">{{ getLocalString(language, "torrent_file") }}</label>
<label for="inputTorrentFile" class="col-sm-3 control-label">{{ _("Torrent file") }}</label>
<div class="col-sm-9">
<input name="torrentFile" class="file" type="file" size="50" maxlength="100000" accept="application/x-bittorrent" onchange="setButtonToFilename(event)">
</div>
</div>
<div class="form-group detectedInfosGroup">
<label for="inputTorrentFile" class="col-sm-3 control-label">File info</label>
<label for="inputTorrentFile" class="col-sm-3 control-label">{{ _("File info") }}</label>
<div class="col-sm-9 detectedInfos">
<div class="detectedGroup sizeGroup">
<h5>{{ getLocalString(language, "size") }}:</h5>
<h5>{{ _("Size") }}:</h5>
<p class="detectedSize"></p>
</div>
<div class="detectedGroup trackerGroup">
<h5>{{ getLocalString(language, "tracker") }}:</h5>
<h5>{{ _("Tracker") }}:</h5>
<p class="detectedTracker"></p>
</div>
<div class="detectedGroup filesGroup">
<h5>{{ getLocalString(language, "detected_files") }}:</h5>
<h5>{{ _("Detected files") }}:</h5>
<div class="detectedFiles">
<ul>
</ul>
@ -53,12 +53,12 @@ vim: ts=2 noexpandtab
</div>
</div>
<div class="form-group">
<label for="inputCategory" class="col-sm-3 control-label">{{ getLocalString(language, "category") }}</label>
<label for="category" class="col-sm-3 control-label">{{ _("Category") }}</label>
<div class="col-sm-9">
<div class="row row-container">
<div class="col-md-6 category-column">
<select class="form-control dropdown" id="category" name="category">
<option value="-1" selected>--- Select Category ---</option>
<option value="-1" selected>--- {{ _("Select Category") }} ---</option>
{% for category in categories %}
<option value="{{ category.id }}">{{ category.label }}</option>
{% endfor %}
@ -66,28 +66,28 @@ vim: ts=2 noexpandtab
</div>
<div class="col-md-6 subcategory-column">
<select class="form-control dropdown" id="subcategory" name="subcategory">
<option value="-1" selected>--- Select Subcategory ---</option>
<option value="-1" selected>--- {{ _("Select Subcategory") }} ---</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="inputName" class="col-sm-3 control-label">{{ getLocalString(language, "name") }}</label>
<label for="inputName" class="col-sm-3 control-label">{{ _("Name") }}</label>
<div class="col-sm-9">
<input type="text" name="name" class="form-control name" placeholder="e.g. Attack of the Killer Tomatoes" aria-describedby="basic-addon1">
<input type="text" name="name" class="form-control name" placeholder="{{ _("e.g. Attack of the Killer Tomatoes") }}" aria-describedby="basic-addon1">
</div>
</div>
<div class="form-group">
<label for="inputName" class="col-sm-3 control-label">{{ getLocalString(language, "audio_quality") }}</label>
<label for="inputName" class="col-sm-3 control-label">{{ _("Audio quality") }}</label>
<div class="col-sm-9">
<input type="text" name="audioquality_description" class="form-control name" placeholder="e.g. English, AC-3 at 384kbps" aria-describedby="basic-addon1">
<input type="text" name="audioquality_description" class="form-control name" placeholder="{{ _("e.g. English, AC-3 @ 384kbps") }}" aria-describedby="basic-addon1">
</div>
</div>
<div class="form-group">
<label for="inputName" class="col-sm-3 control-label">{{ getLocalString(language, "video_quality") }}</label>
<label for="inputName" class="col-sm-3 control-label">{{ _("Video quality") }}</label>
<div class="col-sm-9">
<input type="text" name="videoquality_description" class="form-control name" placeholder="e.g. XviD, 720×400 at 1809 kbps" aria-describedby="basic-addon1">
<input type="text" name="videoquality_description" class="form-control name" placeholder="{{ _("e.g. XviD, 720×400 @ 1809 kbps") }}" aria-describedby="basic-addon1">
</div>
</div>
<!--
@ -115,14 +115,14 @@ vim: ts=2 noexpandtab
</div>
-->
<div class="form-group">
<label for="inputName" class="col-sm-3 control-label">{{ getLocalString(language, "description") }}</label>
<label for="inputName" class="col-sm-3 control-label">{{ _("Description") }}</label>
<div class="col-sm-9">
<textarea name="description" class="form-control description" rows="10" placeholder="Hint: Markdown is supported in this field"></textarea>
<textarea name="description" class="form-control description" rows="10" placeholder="{{ _("Hint: Markdown is supported in this field") }}"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {{ getLocalString(language, "create") }}!</button>
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {{ _("Create") }}!</button>
</div>
</div>
</form>

View File

@ -2,7 +2,7 @@
vim: ts=2 noexpandtab
-->
{% extends "index.html" %}
{% block title %}{{ super() }} - Results{% endblock%}
{% block title %}{{ super() }} - {{ _("Results") }}{% endblock%}
{% set active_page = "search" %}
{% block content %}
<link href="{{ url_for("static", filename="css/details.css") }}" rel="stylesheet">

View File

@ -2,9 +2,9 @@
vim: ts=2 noexpandtab
-->
{% set navigation_bar = [
("/", "search", "Search", "glyphicon-search"),
("/categories", "categories", "Categories", "glyphicon-th"),
("/create", "create", "Create", "glyphicon-plus")
("/", "search", _("Search"), "glyphicon-search"),
("/categories", "categories", _("Categories"), "glyphicon-th"),
("/create", "create", _("Create"), "glyphicon-plus")
] -%}
<!DOCTYPE html>
@ -23,7 +23,6 @@ vim: ts=2 noexpandtab
<body>
<script type="text/javascript">
var global_strings = {{json.dumps(strings)|safe}};
var global_categories = {{json.dumps(categories)|safe}};
</script>
<div class="site-wrapper">

View File

@ -2,26 +2,26 @@
vim: ts=2 noexpandtab
-->
{% extends "index.html" %}
{% block title %}{{ super() }} - Results{% endblock%}
{% block title %}{{ super() }} - {{ _("Results") }}{% endblock%}
{% set active_page = "search" %}
{% block content %}
<link href="{{ url_for("static", filename="css/result.css") }}" rel="stylesheet">
<script src="{{ url_for("static", filename="js/main.js") }}"></script>
<table>
<tr>
<th>Name</th>
<th>Size</th>
<th>Snatches</th>
<th>UL</th>
<th>DL</th>
<th>{{ _("Name") }}</th>
<th>{{ _("Size") }}</th>
<th>{{ _("Snatches") }}</th>
<th>{{ _("UL") }}</th>
<th>{{ _("DL") }}</th>
</tr>
{% for result in results %}
<tr>
<td><a href="/download/{{ result[0] }}">{{ result[1] }}</a></td>
<td>{{ result[2] }}</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>{{ _("N/A") }}</td>
<td>{{ _("N/A") }}</td>
<td>{{ _("N/A") }}</td>
</tr>
{% endfor %}
</table>

View File

@ -2,7 +2,7 @@
vim: ts=2 noexpandtab
-->
{% extends "index.html" %}
{% block title %}{{ super() }} - Search{% endblock%}
{% block title %}{{ super() }} - {{ _("Search") }}{% endblock%}
{% set active_page = "search" %}
{% block content %}
<link href="{{ url_for("static", filename="css/search.css") }}" rel="stylesheet">
@ -12,11 +12,11 @@ vim: ts=2 noexpandtab
<form action="search" >
<div class="form-group">
<div class="input-group search-box">
<input type="text" name="q" class="form-control" placeholder="Seach for…" aria-describedby="basic-addon2">
<input type="text" name="q" class="form-control" placeholder="{{ _("Seach for") }}" aria-describedby="basic-addon2">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
{{ getLocalString(language, "search") }}!
{{ _("Search!") }}
</button>
</span>
</div>