Quick first pass at tagging strings for localization

This commit is contained in:
Mouse Reeve
2021-02-27 14:22:39 -08:00
parent 791968ece5
commit 8e5e3a84d6
16 changed files with 456 additions and 102 deletions

View File

@ -1,4 +1,5 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% block content %}
<div class="block">
@ -9,8 +10,8 @@
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
<div class="column is-narrow">
<a href="{{ author.local_path }}/edit">
<span class="icon icon-pencil" title="Edit Author">
<span class="is-sr-only">Edit Author</span>
<span class="icon icon-pencil" title="{% trans 'Edit Author' %}">
<span class="is-sr-only">{% trans "Edit Author" %}</span>
</span>
</a>
</div>
@ -25,12 +26,12 @@
</p>
{% endif %}
{% if author.wikipedia_link %}
<p><a href="{{ author.wikipedia_link }}" rel=”noopener” target="_blank">Wikipedia</a></p>
<p><a href="{{ author.wikipedia_link }}" rel=”noopener” target="_blank">{% trans "Wikipedia" %}</a></p>
{% endif %}
</div>
<div class="block">
<h3 class="title is-4">Books by {{ author.name }}</h3>
<h3 class="title is-4">{% blocktrans with name=author.name %}Books by {{ name }}{% endblocktrans %}</h3>
{% include 'snippets/book_tiles.html' with books=books %}
</div>
{% endblock %}

View File

@ -1,4 +1,5 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load bookwyrm_tags %}
{% load humanize %}
{% block content %}
@ -23,8 +24,8 @@
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
<div class="column is-narrow">
<a href="{{ book.id }}/edit">
<span class="icon icon-pencil" title="Edit Book">
<span class="is-sr-only">Edit Book</span>
<span class="icon icon-pencil" title="{% trans "Edit Book" %}">
<span class="is-sr-only">{% trans "Edit Book" %}</span>
</span>
</a>
</div>
@ -39,13 +40,13 @@
{% if request.user.is_authenticated and not book.cover %}
<div class="box p-2">
<h3 class="title is-6 mb-1">Add cover</h3>
<h3 class="title is-6 mb-1">{% trans "Add cover" %}</h3>
<form name="add-cover" method="POST" action="/upload-cover/{{ book.id }}" enctype="multipart/form-data">
{% csrf_token %}
<label class="label">
<input type="file" name="cover" accept="image/*" enctype="multipart/form-data" id="id_cover" required>
</label>
<button class="button is-small is-primary" type="submit">Add</button>
<button class="button is-small is-primary" type="submit">{% trans "Add" %}</button>
</form>
</div>
{% endif %}
@ -54,21 +55,21 @@
<dl>
{% if book.isbn_13 %}
<div class="is-flex is-justify-content-space-between">
<dt>ISBN:</dt>
<dt>{% trans "ISBN:" %}</dt>
<dd>{{ book.isbn_13 }}</dd>
</div>
{% endif %}
{% if book.oclc_number %}
<div class="is-flex is-justify-content-space-between">
<dt>OCLC Number:</dt>
<dt>{% trans "OCLC Number:" %}</dt>
<dd>{{ book.oclc_number }}</dd>
</div>
{% endif %}
{% if book.asin %}
<div class="is-flex is-justify-content-space-between">
<dt>ASIN:</dt>
<dt>{% trans "ASIN:" %}</dt>
<dd>{{ book.asin }}</dd>
</div>
{% endif %}
@ -80,7 +81,7 @@
</p>
{% if book.openlibrary_key %}
<p><a href="https://openlibrary.org/books/{{ book.openlibrary_key }}" target="_blank" rel="noopener">View on OpenLibrary</a></p>
<p><a href="https://openlibrary.org/books/{{ book.openlibrary_key }}" target="_blank" rel="noopener">{% trans "View on OpenLibrary" %}</a></p>
{% endif %}
</section>
</div>
@ -98,11 +99,11 @@
<form name="add-description" method="POST" action="/add-description/{{ book.id }}">
{% csrf_token %}
<p class="fields is-grouped">
<label class="label"for="id_description">Description:</label>
<label class="label"for="id_description">{% trans "Description:" %}</label>
<textarea name="description" cols="None" rows="None" class="textarea" id="id_description"></textarea>
</p>
<div class="field">
<button class="button is-primary" type="submit">Save</button>
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="add-description" controls_uid=book.id hide_inactive=True %}
</div>
</form>
@ -134,20 +135,20 @@
{% if request.user.is_authenticated %}
<section class="block">
<header class="columns">
<h2 class="column title is-5 mb-1">Your reading activity</h2>
<h2 class="column title is-5 mb-1">{% trans "Your reading activity" %}</h2>
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with text="Add read dates" icon="plus" class="is-small" controls_text="add-readthrough" %}
</div>
</header>
{% if not readthroughs.exists %}
<p>You don't have any reading activity for this book.</p>
<p>{% trans "You don't have any reading activity for this book." %}</p>
{% endif %}
<section class="hidden box" id="add-readthrough">
<form name="add-readthrough" action="/create-readthrough" method="post">
{% include 'snippets/readthrough_form.html' with readthrough=None %}
<div class="field is-grouped">
<div class="control">
<button class="button is-primary" type="submit">Create</button>
<button class="button is-primary" type="submit">{% trans "Create" %}</button>
</div>
<div class="control">
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="add-readthrough" %}
@ -168,11 +169,11 @@
<section class="block">
<form name="tag" action="/tag/" method="post">
<label for="tags" class="is-3">Tags</label>
<label for="tags" class="is-3">{% trans "Tags" %}</label>
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input id="tags" class="input" type="text" name="name">
<button class="button" type="submit">Add tag</button>
<button class="button" type="submit">{% trans "Add tag" %}</button>
</form>
</section>
{% endif %}
@ -189,7 +190,7 @@
<div class="column is-narrow">
{% if book.subjects %}
<section class="content block">
<h2 class="title is-5">Subjects</h2>
<h2 class="title is-5">{% trans "Subjects" %}</h2>
<ul>
{% for subject in book.subjects %}
<li>{{ subject }}</li>
@ -200,7 +201,7 @@
{% if book.subject_places %}
<section class="content block">
<h2 class="title is-5">Places</h2>
<h2 class="title is-5">{% trans "Places" %}</h2>
<ul>
{% for place in book.subject_placess %}
<li>{{ place }}</li>
@ -211,7 +212,7 @@
{% if lists.exists %}
<section class="content block">
<h2 class="title is-5">Lists</h2>
<h2 class="title is-5">{% trans "Lists" %}</h2>
<ul>
{% for list in lists %}
<li><a href="{{ list.local_path }}">{{ list.name }}</a></li>
@ -240,7 +241,7 @@
{% include 'snippets/username.html' with user=rating.user %}
</div>
<div class="field is-grouped mb-0">
<div>rated it</div>
<div>{% trans "rated it" %}</div>
{% include 'snippets/stars.html' with rating=rating.rating %}
</div>
<div>
@ -257,4 +258,3 @@
</div>
{% endblock %}

View File

@ -24,45 +24,45 @@
<div class="columns">
<div class="column">
<h2 class="title is-4">Metadata</h2>
<p><label class="label" for="id_name">Name:</label> {{ form.name }}</p>
<h2 class="title is-4">{% trans "Metadata" %}</h2>
<p><label class="label" for="id_name">{% trans "Name:" %}</label> {{ form.name }}</p>
{% for error in form.name.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_bio">Bio:</label> {{ form.bio }}</p>
<p><label class="label" for="id_bio">{% trans "Bio:" %}</label> {{ form.bio }}</p>
{% for error in form.bio.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_wikipedia_link">Wikipedia link:</label> {{ form.wikipedia_link }}</p>
<p><label class="label" for="id_wikipedia_link">{% trans "Wikipedia link:" %}</label> {{ form.wikipedia_link }}</p>
{% for error in form.wikipedia_link.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_born">Birth date:</label> {{ form.born }}</p>
<p><label class="label" for="id_born">{% trans "Birth date:" %}</label> {{ form.born }}</p>
{% for error in form.born.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_died">Death date:</label> {{ form.died }}</p>
<p><label class="label" for="id_died">{% trans "Death date:" %}</label> {{ form.died }}</p>
{% for error in form.died.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
</div>
<div class="column">
<h2 class="title is-4">Author Identifiers</h2>
<p><label class="label" for="id_openlibrary_key">Openlibrary key:</label> {{ form.openlibrary_key }}</p>
<h2 class="title is-4">{% trans "Author Identifiers" %}</h2>
<p><label class="label" for="id_openlibrary_key">{% trans "Openlibrary key:" %}</label> {{ form.openlibrary_key }}</p>
{% for error in form.openlibrary_key.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_librarything_key">Librarything key:</label> {{ form.librarything_key }}</p>
<p><label class="label" for="id_librarything_key">{% trans "Librarything key:" %}</label> {{ form.librarything_key }}</p>
{% for error in form.librarything_key.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
<p><label class="label" for="id_goodreads_key">Goodreads key:</label> {{ form.goodreads_key }}</p>
<p><label class="label" for="id_goodreads_key">{% trans "Goodreads key:" %}</label> {{ form.goodreads_key }}</p>
{% for error in form.goodreads_key.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
@ -71,8 +71,8 @@
</div>
<div class="block">
<button class="button is-primary" type="submit">Save</button>
<a class="button" href="/author/{{ author.id }}">Cancel</a>
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
<a class="button" href="/author/{{ author.id }}">{% trans "Cancel" %}</a>
</div>
</form>

View File

@ -2,8 +2,8 @@
{% block content %}
<div class="block">
<h1 class="title">Server Error</h1>
<p>Something went wrong! Sorry about that.</p>
<h1 class="title">{% trans "Server Error" %}</h1>
<p>{% trans "Something went wrong! Sorry about that." %}</p>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block header %}
<div class="columns is-mobile">
<div class="column">
<h1 class="title">{{ year }} Reading Progress</h1>
<h1 class="title">{% blocktrans %}{{ year }} Reading Progress{% endblocktrans %}</h1>
</div>
{% if is_self and goal %}
<div class="column is-narrow">
@ -25,7 +25,7 @@
</h2>
</header>
<section class="card-content content">
<p>Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.</p>
<p>{% blocktrans %}Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.{% endblocktrans %}</p>
{% include 'snippets/goal_form.html' with goal=goal year=year %}
</section>

View File

@ -2,12 +2,12 @@
{% load humanize %}
{% block content %}
<div class="block">
<h1 class="title">Import Books</h1>
<h1 class="title">{% trans "Import Books" %}</h1>
<form name="import" action="/import" method="post" enctype="multipart/form-data">
{% csrf_token %}
<label class="label" for="source">
<p>Data source</p>
<p>{% trans "Data source" %}</p>
<div class="select {{ class }}">
<select name="source" id="source">
<option value="GoodReads" {% if current == 'GoodReads' %}selected{% endif %}>
@ -25,23 +25,23 @@
</div>
<div class="field">
<label class="label">
<input type="checkbox" name="include_reviews" checked> Include reviews
<input type="checkbox" name="include_reviews" checked> {% trans "Include reviews" %}
</label>
</div>
<div class="field">
<label class="label">
<p>Privacy setting for imported reviews:</p>
<p>{% trans "Privacy setting for imported reviews:" %}</p>
{% include 'snippets/privacy_select.html' with no_label=True %}
</label>
</div>
<button class="button is-primary" type="submit">Import</button>
<button class="button is-primary" type="submit">{% trans "Import" %}</button>
</form>
</div>
<div class="content block">
<h2 class="title">Recent Imports</h2>
<h2 class="title">{% trans "Recent Imports" %}</h2>
{% if not jobs %}
<p>No recent imports</p>
<p>{% trans "No recent imports" %}</p>
{% endif %}
<ul>
{% for job in jobs %}

View File

@ -3,32 +3,32 @@
{% load humanize %}
{% block content %}
<div class="block">
<h1 class="title">Import Status</h1>
<h1 class="title">{% trans "Import Status" %}</h1>
<p>
Import started: {{ job.created_date | naturaltime }}
{% trans "Import started: " %}{{ job.created_date | naturaltime }}
</p>
{% if job.complete %}
<p>
Import completed: {{ task.date_done | naturaltime }}
{% trans "Import completed: " %}{{ task.date_done | naturaltime }}
</p>
{% elif task.failed %}
<div class="notification is-danger">TASK FAILED</div>
<div class="notification is-danger">{% trans "TASK FAILED" %}</div>
{% endif %}
</div>
<div class="block">
{% if not job.complete %}
Import still in progress.
{% trans "Import still in progress." %}
<p>
(Hit reload to update!)
{% trans "(Hit reload to update!)" %}
</p>
{% endif %}
</div>
{% if failed_items %}
<div class="block">
<h2 class="title is-4">Failed to load</h2>
<h2 class="title is-4">{% trans "Failed to load" %}</h2>
{% if not job.retry %}
<form name="retry" action="/import/{{ job.id }}" method="post">
{% csrf_token %}
@ -52,10 +52,10 @@
<div class="block pt-1 select-all">
<label class="label">
<input type="checkbox" class="checkbox">
Select all
{% trans "Select all" %}
</label>
</div>
<button class="button" type="submit">Retry items</button>
<button class="button" type="submit">{% trans "Retry items" %}</button>
{% else %}
<ul>
{% for item in failed_items %}
@ -77,17 +77,17 @@
{% endif %}
<div class="block">
<h2 class="title is-4">Successfully imported</h2>
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
<table class="table">
<tr>
<th>
Book
{% trans "Book" %}
</th>
<th>
Title
{% trans "Title" %}
</th>
<th>
Author
{% trans "Author" %}
</th>
<th>
</th>
@ -110,7 +110,7 @@
<td>
{% if item.book %}
<span class="icon icon-check">
<span class="is-sr-only">Imported</span>
<span class="is-sr-only">{% trans "Imported" %}</span>
</span>
{% endif %}
</td>

View File

@ -5,7 +5,7 @@
<div class="column">
<div class="block">
{% if valid %}
<h1 class="title">Create an Account</h1>
<h1 class="title">{% trans "Create an Account" %}</h1>
<div>
<form name="register" method="post" action="/register">
<input type=hidden name="invite_code" value="{{ invite.code }}">
@ -14,8 +14,8 @@
</div>
{% else %}
<div class="content">
<h1 class="title">Permission Denied</h1>
<p>Sorry! This invite code is no longer valid.</p>
<h1 class="title">{% trans "Permission Denied" %}</h1>
<p>{% trans "Sorry! This invite code is no longer valid." %}</p>
</div>
{% endif %}
</div>

View File

@ -34,7 +34,7 @@
<div class="control">
<button class="button" type="submit">
<span class="icon icon-search" title="Search">
<span class="is-sr-only">search</span>
<span class="is-sr-only">{% trans "search" %}</span>
</span>
</button>
</div>
@ -44,7 +44,7 @@
<div role="button" tabindex="0" class="navbar-burger pulldown-menu" data-controls="main-nav" aria-expanded="false">
<div class="navbar-item mt-3">
<div class="icon icon-dots-three-vertical" title="Main navigation menu">
<span class="is-sr-only">Main navigation menu</span>
<span class="is-sr-only">{% trans "Main navigation menu" %}</span>
</div>
</div>
</div>
@ -122,7 +122,7 @@
<a href="/notifications" class="tags has-addons">
<span class="tag is-medium">
<span class="icon icon-bell" title="Notifications">
<span class="is-sr-only">Notifications</span>
<span class="is-sr-only">{% trans "Notifications" %}</span>
</span>
</span>
<span class="{% if not request.user|notification_count %}hidden {% endif %}tag is-danger is-medium" data-poll="notifications">
@ -139,16 +139,16 @@
{% csrf_token %}
<div class="columns is-variable is-1">
<div class="column">
<label class="is-sr-only" for="id_localname">Username:</label>
<label class="is-sr-only" for="id_localname">{% trans "Username:" %}</label>
<input type="text" name="localname" maxlength="150" class="input" required="" id="id_localname" placeholder="username">
</div>
<div class="column">
<label class="is-sr-only" for="id_password">Username:</label>
<label class="is-sr-only" for="id_password">{% trans "Username:" %}</label>
<input type="password" name="password" maxlength="128" class="input" required="" id="id_password" placeholder="password">
<p class="help"><a href="/password-reset">Forgot your password?</a></p>
</div>
<div class="column is-narrow">
<button class="button is-primary" type="submit">Log in</button>
<button class="button is-primary" type="submit">{% trans "Log in" %}</button>
</div>
</div>
</form>
@ -179,11 +179,11 @@
<div class="columns">
<div class="column">
<p>
<a href="/about">About this server</a>
<a href="/about">{% trans "About this server" %}</a>
</p>
{% if site.admin_email %}
<p>
<a href="mailto:{{ site.admin_email }}">Contact site admin</a>
<a href="mailto:{{ site.admin_email }}">{% trans "Contact site admin" %}</a>
</p>
{% endif %}
</div>

View File

@ -4,20 +4,20 @@
<div class="columns">
<div class="column">
<div class="box">
<h1 class="title">Log in</h1>
<h1 class="title">{% trans "Log in" %}</h1>
{% if login_form.non_field_errors %}
<p class="notification is-danger">{{ login_form.non_field_errors }}</p>
{% endif %}
<form name="login" method="post" action="/login">
{% csrf_token %}
<div class="field">
<label class="label" for="id_localname">Username:</label>
<label class="label" for="id_localname">{% trans "Username:" %}</label>
<div class="control">
{{ login_form.localname }}
</div>
</div>
<div class="field">
<label class="label" for="id_password">Password:</label>
<label class="label" for="id_password">{% trans "Password:" %}</label>
<div class="control">
{{ login_form.password }}
</div>
@ -27,23 +27,23 @@
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-primary" type="submit">Log in</button>
<button class="button is-primary" type="submit">{% trans "Log in" %}</button>
</div>
<div class="control">
<small><a href="/password-reset">Forgot your password?</a></small>
<small><a href="/password-reset">{% trans "Forgot your password?" %}</a></small>
</div>
</div>
</form>
</div>
<div class="box has-background-primary-light">
{% if site.allow_registration %}
<h2 class="title">Create an Account</h2>
<h2 class="title">{% trans "Create an Account" %}</h2>
<form name="register" method="post" action="/register">
{% include 'snippets/register_form.html' %}
</form>
{% else %}
<h2 class="title">This instance is closed</h2>
<p>Contact an administrator to get an invite</p>
<h2 class="title">{% trans "This instance is closed" %}</h2>
<p>{% trans "Contact an administrator to get an invite" %}</p>
{% endif %}
</div>
</div>
@ -53,7 +53,7 @@
{% include 'snippets/about.html' %}
<p class="block">
<a href="/about/">More about this site</a>
<a href="/about/">{% trans "More about this site" %}</a>
</p>
</div>
</div>

View File

@ -3,11 +3,11 @@
{% load bookwyrm_tags %}
{% block content %}
<div class="block">
<h1 class="title">Notifications</h1>
<h1 class="title">{% trans "Notifications" %}</h1>
<form name="clear" action="/notifications" method="POST">
{% csrf_token %}
<button class="button is-danger is-light" type="submit" class="secondary">Delete notifications</button>
<button class="button is-danger is-light" type="submit" class="secondary">{% trans "Delete notifications" %}</button>
</form>
</div>
@ -98,7 +98,7 @@
{% endfor %}
{% if not notifications %}
<p>You're all caught up!</p>
<p>{% trans "You're all caught up!" %}</p>
{% endif %}
</div>
{% endblock %}

View File

@ -4,20 +4,20 @@
<div class="columns is-centered">
<div class="column is-half">
<div class="block">
<h1 class="title">Reset Password</h1>
<h1 class="title">{% trans "Reset Password" %}</h1>
{% if message %}<p>{{ message }}</p>{% endif %}
<p>A link to reset your password will be sent to your email address</p>
<p>{% trans "A link to reset your password will be sent to your email address" %}</p>
<form name="password-reset" method="post" action="/password-reset">
{% csrf_token %}
<div class="field">
<label class="label" for="id_email_register">Email address:</label>
<label class="label" for="id_email_register">{% trans "Email address:" %}</label>
<div class="control">
<input type="email" name="email" maxlength="254" class="input" id="id_email_register">
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-link" type="submit">Reset password</button>
<button class="button is-link" type="submit">{% trans "Reset password" %}</button>
</div>
</div>
</form>

View File

@ -7,10 +7,10 @@
<div class="block columns">
<div class="column">
<h2 class="title">Matching Books</h2>
<h2 class="title">{% trans "Matching Books" %}</h2>
<section class="block">
{% if not local_results.results %}
<p>No books found for "{{ query }}"</p>
<p>{% blocktrans %}No books found for "{{ query }}"{% endblocktrans %}</p>
{% else %}
<ul>
{% for result in local_results.results %}
@ -26,7 +26,7 @@
{% if book_results|slice:":1" and local_results.results %}
<div class="block">
<p>
Didn't find what you were looking for?
{% trans "Didn't find what you were looking for?" %}
</p>
{% include 'snippets/toggle/open_button.html' with text="Show results from other catalogues" small=True controls_text="more-results" %}
</div>
@ -49,7 +49,7 @@
{% csrf_token %}
<input type="hidden" name="remote_id" value="{{ result.key }}">
<div>{% include 'snippets/search_result_text.html' with result=result link=False %}</div>
<button type="submit" class="button is-small is-link">Import book</button>
<button type="submit" class="button is-small is-link">{% trans "Import book" %}</button>
</form>
</li>
{% endfor %}
@ -66,9 +66,9 @@
</div>
<div class="column">
<section class="block">
<h2 class="title">Matching Users</h2>
<h2 class="title">{% trans "Matching Users" %}</h2>
{% if not user_results %}
<p>No users found for "{{ query }}"</p>
<p>{% blocktrans %}No users found for "{{ query }}"{% endblocktrans %}</p>
{% endif %}
<ul>
{% for result in user_results %}
@ -81,9 +81,9 @@
</ul>
</section>
<section class="block">
<h2 class="title">Lists</h2>
<h2 class="title">{% trans "Lists" %}</h2>
{% if not list_results %}
<p>No lists found for "{{ query }}"</p>
<p>{% blocktrans %}No lists found for "{{ query }}"{% endblocktrans %}</p>
{% endif %}
{% for result in list_results %}
<div class="block">

View File

@ -3,7 +3,7 @@
{% block content %}
<div class="block">
<h1 class="title">Books tagged "{{ tag.name }}"</h1>
<h1 class="title">{% blocktrans %}Books tagged "{{ tag.name }}"{% endblocktrans %}</h1>
{% include 'snippets/book_tiles.html' with books=books.all %}
</div>