mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
First pass at internationalization and localization
This commit is contained in:
parent
04ed5d62dd
commit
ad2a87d317
6 changed files with 127 additions and 66 deletions
69
bookwyrm/locale/en/LC_MESSAGES/django.po
Normal file
69
bookwyrm/locale/en/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2021-02-27 13:41-0800\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:15
|
||||||
|
msgid "Decentralized"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:21
|
||||||
|
msgid "Friendly"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:27
|
||||||
|
msgid "Anti-Corporate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:42
|
||||||
|
#, python-format
|
||||||
|
msgid "Join %(name)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:47
|
||||||
|
msgid "This instance is closed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/discover/landing_layout.html:53
|
||||||
|
msgid "Your Account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_layout.html:30
|
||||||
|
msgid "Follow Requests"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_layout.html:48
|
||||||
|
msgid "Activity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_layout.html:54
|
||||||
|
msgid "Reading Goal"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_layout.html:60
|
||||||
|
msgid "Lists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_layout.html:66
|
||||||
|
msgid "Shelves"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: bookwyrm/templates/user/user_preview.html:13
|
||||||
|
#, python-format
|
||||||
|
msgid "Joined %(date)s"
|
||||||
|
msgstr ""
|
|
@ -1,9 +1,10 @@
|
||||||
''' bookwyrm settings and configuration '''
|
''' bookwyrm settings and configuration '''
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from environs import Env
|
from environs import Env
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
env = Env()
|
env = Env()
|
||||||
DOMAIN = env('DOMAIN')
|
DOMAIN = env('DOMAIN')
|
||||||
|
@ -27,6 +28,7 @@ EMAIL_USE_TLS = env('EMAIL_USE_TLS', True)
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale'),]
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
||||||
|
@ -58,6 +60,7 @@ INSTALLED_APPS = [
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<section class="level is-mobile">
|
|
||||||
<div class="level-item has-text-centered">
|
|
||||||
<div>
|
|
||||||
<p class="title has-text-weight-normal"><span class="icon icon-graphic-paperplane"></span></p>
|
|
||||||
<p class="heading">Decentralized</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="level-item has-text-centered">
|
|
||||||
<div>
|
|
||||||
<p class="title has-text-weight-normal"><span class="icon icon-graphic-heart"></span></p>
|
|
||||||
<p class="heading">Friendly</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="level-item has-text-centered">
|
|
||||||
<div>
|
|
||||||
<p class="title has-text-weight-normal"><span class="icon icon-graphic-banknote"></span></p>
|
|
||||||
<p class="heading">Anti-Corporate</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load humanize %}
|
{% load i18n %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
@ -8,7 +8,26 @@
|
||||||
<h2 class="subtitle">{{ site.instance_tagline }}</h2>
|
<h2 class="subtitle">{{ site.instance_tagline }}</h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{% include 'discover/icons.html' %}
|
<section class="level is-mobile">
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="title has-text-weight-normal"><span class="icon icon-graphic-paperplane"></span></p>
|
||||||
|
<p class="heading">{% trans "Decentralized" %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="title has-text-weight-normal"><span class="icon icon-graphic-heart"></span></p>
|
||||||
|
<p class="heading">{% trans "Friendly" %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="title has-text-weight-normal"><span class="icon icon-graphic-banknote"></span></p>
|
||||||
|
<p class="heading">{% trans "Anti-Corporate" %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="tile is-ancestor">
|
<section class="tile is-ancestor">
|
||||||
<div class="tile is-7 is-parent">
|
<div class="tile is-7 is-parent">
|
||||||
|
@ -20,37 +39,22 @@
|
||||||
{% if not request.user.is_authenticated %}
|
{% if not request.user.is_authenticated %}
|
||||||
<div class="tile is-child box has-background-primary-light content">
|
<div class="tile is-child box has-background-primary-light content">
|
||||||
{% if site.allow_registration %}
|
{% if site.allow_registration %}
|
||||||
<h2 class="title">Join {{ site.name }}</h2>
|
<h2 class="title">{% blocktrans with name=site.name %}Join {{ name }}{% endblocktrans %}</h2>
|
||||||
<form name="register" method="post" action="/register">
|
<form name="register" method="post" action="/register">
|
||||||
{% include 'snippets/register_form.html' %}
|
{% include 'snippets/register_form.html' %}
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2 class="title">This instance is closed</h2>
|
<h2 class="title">{% trans "This instance is closed" %}</h2>
|
||||||
<p>{{ site.registration_closed_text | safe}}</p>
|
<p>{{ site.registration_closed_text | safe}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="tile is-child box has-background-white-bis">
|
<div class="tile is-child box has-background-white-bis">
|
||||||
<h2 class="title is-4">Your Account</h2>
|
<h2 class="title is-4">{% trans "Your Account" %}</h2>
|
||||||
<div class="media block">
|
{% include 'user/user_preview.html' with user=request.user %}
|
||||||
<div class="media-left">
|
|
||||||
<a href="{{ user.local_path }}">
|
|
||||||
{% include 'snippets/avatar.html' with user=user large=True %}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="media-content">
|
|
||||||
<p>{% if user.name %}{{ user.name }}{% else %}{{ user.localname }}{% endif %}</p>
|
|
||||||
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
|
|
||||||
<p>Joined {{ user.created_date | naturaltime }}</p>
|
|
||||||
<p>
|
|
||||||
<a href="{{ user.local_path }}/followers">{{ user.followers.count }} follower{{ user.followers.count | pluralize }}</a>,
|
|
||||||
<a href="{{ user.local_path }}/following">{{ user.following.count }} following</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="box content">
|
<div class="box content">
|
||||||
{% if user.summary %}
|
{% if request.user.summary %}
|
||||||
{{ user.summary | to_markdown | safe }}
|
{{ request.user.summary | to_markdown | safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
|
{% load i18n %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
|
||||||
|
@ -11,22 +12,7 @@
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-two-fifths">
|
<div class="column is-two-fifths">
|
||||||
<div class="media">
|
{% include 'user/user_preview.html' with user=user %}
|
||||||
<div class="media-left">
|
|
||||||
<a href="{{ user.local_path }}">
|
|
||||||
{% include 'snippets/avatar.html' with user=user large=True %}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="media-content">
|
|
||||||
<p>{% if user.name %}{{ user.name }}{% else %}{{ user.localname }}{% endif %}</p>
|
|
||||||
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
|
|
||||||
<p>Joined {{ user.created_date | naturaltime }}</p>
|
|
||||||
<p>
|
|
||||||
<a href="{{ user.local_path }}/followers">{{ user.followers.count }} follower{{ user.followers.count | pluralize }}</a>,
|
|
||||||
<a href="{{ user.local_path }}/following">{{ user.following.count }} following</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column box has-background-white-bis content">
|
<div class="column box has-background-white-bis content">
|
||||||
|
@ -41,7 +27,7 @@
|
||||||
|
|
||||||
{% if is_self and user.follower_requests.all %}
|
{% if is_self and user.follower_requests.all %}
|
||||||
<div class="follow-requests">
|
<div class="follow-requests">
|
||||||
<h2>Follow Requests</h2>
|
<h2>{% trans "Follow Requests" %}</h2>
|
||||||
{% for requester in user.follower_requests.all %}
|
{% for requester in user.follower_requests.all %}
|
||||||
<div class="row shrink">
|
<div class="row shrink">
|
||||||
<p>
|
<p>
|
||||||
|
@ -59,25 +45,25 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% url 'user-feed' user|username as url %}
|
{% url 'user-feed' user|username as url %}
|
||||||
<li{% if url == request.path or url == request.path|add:'/' %} class="is-active"{% endif %}>
|
<li{% if url == request.path or url == request.path|add:'/' %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">Activity</a>
|
<a href="{{ url }}">{% trans "Activity" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% if is_self or user.goal.exists %}
|
{% if is_self or user.goal.exists %}
|
||||||
{% now 'Y' as year %}
|
{% now 'Y' as year %}
|
||||||
{% url 'user-goal' user|username year as url %}
|
{% url 'user-goal' user|username year as url %}
|
||||||
<li{% if url in request.path %} class="is-active"{% endif %}>
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">Reading Goal</a>
|
<a href="{{ url }}">{% trans "Reading Goal" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_self or user.lists.exists %}
|
{% if is_self or user.lists.exists %}
|
||||||
{% url 'user-lists' user|username as url %}
|
{% url 'user-lists' user|username as url %}
|
||||||
<li{% if url in request.path %} class="is-active"{% endif %}>
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">Lists</a>
|
<a href="{{ url }}">{% trans "Lists" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.shelf_set.exists %}
|
{% if user.shelf_set.exists %}
|
||||||
{% url 'user-shelves' user|username as url %}
|
{% url 'user-shelves' user|username as url %}
|
||||||
<li{% if url in request.path %} class="is-active"{% endif %}>
|
<li{% if url in request.path %} class="is-active"{% endif %}>
|
||||||
<a href="{{ url }}">Shelves</a>
|
<a href="{{ url }}">{% trans "Shelves" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
20
bookwyrm/templates/user/user_preview.html
Normal file
20
bookwyrm/templates/user/user_preview.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% load i18n %}
|
||||||
|
{% load humanize %}
|
||||||
|
|
||||||
|
<div class="media block">
|
||||||
|
<div class="media-left">
|
||||||
|
<a href="{{ user.local_path }}">
|
||||||
|
{% include 'snippets/avatar.html' with user=user large=True %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="media-content">
|
||||||
|
<p>{% if user.name %}{{ user.name }}{% else %}{{ user.localname }}{% endif %}</p>
|
||||||
|
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
|
||||||
|
<p>{% blocktrans with date=user.created_date|naturaltime %}Joined {{ date }}{% endblocktrans %}</p>
|
||||||
|
<p>
|
||||||
|
<a href="{{ user.local_path }}/followers">{{ user.followers.count }} follower{{ user.followers.count | pluralize }}</a>,
|
||||||
|
<a href="{{ user.local_path }}/following">{{ user.following.count }} following</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue