Make the UI translatable

This commit is contained in:
Bat
2018-06-17 16:26:15 +01:00
parent cafb0e2277
commit 3207aa0e22
22 changed files with 326 additions and 89 deletions
+9 -9
View File
@@ -2,27 +2,27 @@
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock title %} ⋅ Plume</title>
<title>{% block title %}{% endblock title %} ⋅ {{ "Plume" | _ }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/static/main.css">
</head>
<body>
<header>
<nav id="menu"><a href="#">Menu</a></nav>
<nav id="menu"><a href="#">{{ "Menu" | _ }}</a></nav>
<nav>
<a href="/">Plume</a>
<a href="/">{{ "Plume" | _ }}</a>
{% block header %}
{% endblock header %}
</nav>
<nav>
{% if account %}
<a href="/dashboard">Dashboard</a>
<a href="/notifications">Notifications</a>
<a href="/me">My account</a>
<a href="/logout">Log Out</a>
<a href="/dashboard">{{ "Dashboard" | _ }}</a>
<a href="/notifications">{{ "Notifications" | _ }}</a>
<a href="/me">{{ "My account" | _ }}</a>
<a href="/logout">{{ "Log Out" | _ }}</a>
{% else %}
<a href="/login">Log In</a>
<a href="/users/new">Register</a>
<a href="/login">{{ "Log In" | _ }}</a>
<a href="/users/new">{{ "Register" | _ }}</a>
{% endif %}
</nav>
</header>
+3 -3
View File
@@ -10,12 +10,12 @@
<p>{{ blog.summary }}</p>
<section>
<h2>Latest articles</h2>
<h2>{{ "Latest articles" | _ }}</h2>
{% if recents | length < 1 %}
<p>No posts to see here yet.</p>
<p>{{ "No posts to see here yet." | _ }}</p>
{% endif %}
{% if is_author %}
<a href="new" class="button inline-block">New article</a>
<a href="new" class="button inline-block">{{ "New article" | _ }}</a>
{% endif %}
<div class="cards">
{% for article in recents %}
+5 -5
View File
@@ -1,15 +1,15 @@
{% extends "base" %}
{% block title %}
New blog
{{ "New blog" | _ }}
{% endblock title %}
{% block content %}
<h1>Create a blog</h1>
<h1>{{ "Create a blog" | _ }}</h1>
<form method="post">
<label for="title">Title</label>
<label for="title">{{ "Title" | _ }}</label>
<input name="title">
<input type="submit" value="Create blog"/>
<input type="submit" value="{{ "Create blog"}}"/>
</form>
{% endblock content %}
| _ {% endblock content %}
+4 -4
View File
@@ -1,15 +1,15 @@
{% extends "base" %}
{% block title %}
Comment "{{ post.title }}"
{{ "Comment \"{{ post }}\"" | _(post=post.title) }}
{% endblock title %}
{% block content %}
<h1>Comment "{{ post.title }}"</h1>
<h1>{{ "Comment \"{{ post }}\"" | _(post=post.title) }}</h1>
<form method="post">
<label for="content">Content</label>
<label for="content">{{ "Content" | _ }}</label>
<textarea name="content"></textarea>
<input type="submit" value="Submit comment"/>
<input type="submit" value="{{ "Submit comment" | _ }}"/>
</form>
{% endblock content %}
+2 -2
View File
@@ -1,6 +1,6 @@
{% extends "errors/base" %}
{% block error %}
<h1>Something broke on our side.</h1>
<h2>Sorry about that. If you think this is a bug, please report it.</h2>
<h1>{{ "Something broke on our side." | _ }}</h1>
<h2>{{ "Sorry about that. If you think this is a bug, please report it." | _ }}</h2>
{% endblock error %}
+4 -4
View File
@@ -1,15 +1,15 @@
{% extends "base" %}
{% block title %}
Configuration
{{ "Configuration" | _ }}
{% endblock title %}
{% block content %}
<h1>Configure your instance</h1>
<h1>{{ "Configure your instance" | _ }}</h1>
<form method="post">
<label for="name">Name</label>
<label for="name">{{ "Name" | _ }}</label>
<input name="name">
<input type="submit" value="Let's go!"/>
<input type="submit" value="{{ "Let's go!" | _ }}"/>
</form>
{% endblock content %}
+1 -1
View File
@@ -8,7 +8,7 @@
{% block content %}
<h1>{{ "Welcome on {{ instance_name }}" | _(instance_name=instance.name) }}</h1>
<h2>Latest articles</h2>
<h2>{{ "Latest articles" }}</h2>
<div class="cards">
{% for article in recents %}
{{ macros::post_card(article=article) }}
+2 -2
View File
@@ -1,11 +1,11 @@
{% extends "base" %}
{% block title %}
Notifications
{{ "Notifications" | _ }}
{% endblock title %}
{% block content %}
<h1>Notifications</h1>
<h1>{{ "Notifications" | _ }}</h1>
<div class="list">
{% for notification in notifications %}
<div class="card">
+11 -11
View File
@@ -16,7 +16,7 @@
{% endif %}
<p>
<b>Written by <a href="/@/{{ author.fqn }}/">{{ name }}</a></b>
<b>{{ "Written by {{ link_start }}{{ name }}{{ link_end }}" | _(link_start="<a href=\"/@/{{ author.fqn }}/\">", name=name, link_end="</a>")}}</b>
&mdash;
<span>{{ date | date(format="%B %e, %Y") }}</span>
</p>
@@ -26,33 +26,33 @@
</article>
<div class="article-meta">
<p>This article is under the {{ post.license }} license.</p>
<p>{{ "This article is under the {{ license }} license." | _(license=post.license) }}</p>
<div class="inline">
<p>
{{ n_likes }} like{{ n_likes | pluralize }}
{{ "{{ count }} likes" | _n(singular="One like", count=n_likes) }}
</p>
<a class="button" href="like">
{% if has_liked %}
I don't like this anymore
{{ "I don't like this anymore" | _ }}
{% else %}
Add yours
{{ "Add yours" | _ }}
{% endif %}
</a>
<p>
{{ n_reshares }} reshare{{ n_reshares | pluralize }}
{{ "{{ count }} reshares" | _n(singular="One reshare", count=n_reshares) }}
</p>
<a class="button" href="reshare">
{% if has_reshared %}
I don't want to reshare this anymore
{{ "I don't want to reshare this anymore" | _ }}
{% else %}
Reshare
{{ "Reshare" | _ }}
{% endif %}
</a>
</div>
<h2>Comments</h2>
<h2>{{ "Comments" | _ }}</h2>
<div class="list">
{% for comment in comments %}
{% if comment.author.display_name %}
@@ -63,10 +63,10 @@
<div class="card" id="comment-{{ comment.id }}">
<a href="/@/{{ comment.author.fqn }}/"><b>{{ comment_author_name }}</b></a>
<div>{{ comment.content | safe }}</div>
<a href="comment?responding_to={{ comment.id }}">Respond</a>
<a href="comment?responding_to={{ comment.id }}">{{ "Respond" | _ }}</a>
</div>
{% endfor %}
</div>
<a class="button inline-block" href="comment?">Comment</a>
<a class="button inline-block" href="comment?">{{ "Comment" | _ }}</a>
</div>
{% endblock content %}
+6 -6
View File
@@ -1,21 +1,21 @@
{% extends "base" %}
{% block title %}
New post
{{ "New post" | _ }}
{% endblock title %}
{% block content %}
<h1>Create a post</h1>
<h1>{{ "Create a post" | _ }}</h1>
<form method="post">
<label for="title">Title</label>
<label for="title">{{ "Title" | _ }}</label>
<input name="title">
<label for="content">Content</label>
<label for="content">{{ "Content" | _ }}</label>
<textarea name="content"></textarea>
<label for="license">License</label>
<label for="license">{{ "License" | _ }}</label>
<input name="license">
<input type="submit" value="Publish"/>
<input type="submit" value="{{ "Publish" | _ }}"/>
</form>
{% endblock content %}
+5 -5
View File
@@ -1,21 +1,21 @@
{% extends "base" %}
{% block title %}
Login
{{ "Login" | _ }}
{% endblock title %}
{% block content %}
<h1>Login</h1>
<h1>{{ "Login" | _ }}</h1>
{% if message %}
<p>{{ message }}</p>
{% endif %}
<form method="post">
<label for="email_or_name">Username or email</label>
<label for="email_or_name">{{ "Username or email" | _ }}</label>
<input name="email_or_name">
<label for="password">Password</label>
<label for="password">{{ "Password" | _ }}</label>
<input type="password" name="password">
<input type="submit" value="Login"/>
<input type="submit" value="{{ "Login" | _ }}"/>
</form>
{% endblock content %}
+5 -5
View File
@@ -2,18 +2,18 @@
{% import "macros" as macros %}
{% block title %}
Dashboard
{{ "Dashboard" | _ }}
{% endblock title %}
{% block content %}
<h1>Your Dashboard</h1>
<h1>{{ "Your Dashboard" | _ }}</h1>
<section>
<h2>Your Blogs</h2>
<h2>{{ "Your Blogs" | _ }}</h2>
{% if blogs | length < 1 %}
<p>You don't have any blog yet. Create your own, or ask to join one.</p>
<p>{{ "You don't have any blog yet. Create your own, or ask to join one." | _ }}</p>
{% endif %}
<a class="button inline-block" href="/blogs/new">Start a new blog</a>
<a class="button inline-block" href="/blogs/new">{{ "Start a new blog" | _ }}</a>
<div class="list">
{% for blog in blogs %}
<div class="card">
+8 -8
View File
@@ -16,27 +16,27 @@
<h1>
{{ name }}
{% if user.is_admin %}
<span class="badge">Admin</span>
<span class="badge">{{ "Admin" | _ }}</span>
{% endif %}
{% if is_self %}
<span class="badge">It is you</span>
<span class="badge">{{ "It is you" | _ }}</span>
{% endif %}
</h1>
{% if is_self %}
<a href="edit" class="button inline-block">Edit your profile</a>
<a href="edit" class="button inline-block">{{ "Edit your profile" | _ }}</a>
{% endif %}
{% if is_remote %}
<a class="inline-block button" href="{{ user.ap_url }}">Open on {{ instance_url }}</a>
<a class="inline-block button" href="{{ user.ap_url }}">{{ "Open on {{ instance_url }}" | _(instance_url=instance_url) }}</a>
{% endif %}
{% if not is_self and account %}
{% if follows %}
<a href="follow/" class="inline-block button">Follow</a>
<a href="follow/" class="inline-block button">{{ "Follow" | _ }}</a>
{% else %}
<a href="follow/" class="inline-block button">Unfollow</a>
<a href="follow/" class="inline-block button">{{ "Unfollow" | _ }}</a>
{% endif %}
{% endif %}
</div>
@@ -50,7 +50,7 @@
</div>
{% if recents | length != 0 %}
<h2>Latest articles</h2>
<h2>{{ "Latest articles" | _ }}</h2>
<div class="cards">
{% for article in recents %}
{{ macros::post_card(article=article) }}
@@ -59,7 +59,7 @@
{% endif %}
{% if reshares | length != 0 %}
<h2>Recently reshared</h2>
<h2>{{ "Recently reshared" | _ }}</h2>
<div class="cards">
{% for article in reshares %}
{{ macros::post_card(article=article) }}
+6 -6
View File
@@ -1,24 +1,24 @@
{% extends "base" %}
{% block title %}
Edit your account
{{ "Edit your account" | _ }}
{% endblock title %}
{% block content %}
<h1>Your Profile</h1>
<h1>{{ "Your Profile" | _ }}</h1>
<form method="post">
<!-- Rocket hack to use various HTTP methods -->
<input type=hidden name="_method" value="put">
<label for="display_name">Display Name</label>
<label for="display_name">{{ "Display Name" | _ }}</label>
<input name="display_name" value="{{ account.display_name }}">
<label for="email">Email</label>
<label for="email">{{ "Email" | _ }}</label>
<input name="email" value="{{ account.email }}">
<label for="summary">Summary</label>
<label for="summary">{{ "Summary" | _ }}</label>
<input name="summary" value="{{ account.summary }}">
<input type="submit" value="Update account"/>
<input type="submit" value="{{ "Update account" | _ }}"/>
</form>
{% endblock content %}
+8 -8
View File
@@ -7,7 +7,7 @@
{% set name = user.username %}
{% endif %}
{{ name }}'s Followers
{{ "{{ name }}'s followers" | _(name=name) }}
{% endblock title %}
{% block content %}
@@ -15,28 +15,28 @@
<h1>
{{ name }}
{% if user.is_admin %}
<span class="badge">Admin</span>
<span class="badge">{{ "Admin" | _ }}</span>
{% endif %}
{% if is_self %}
<span class="badge">It is you</span>
<span class="badge">{{ "It is you" | _ }}</span>
{% endif %}
</h1>
{% if is_remote %}
<a class="inline-block button" href="{{ user.ap_url }}">Open on {{ instance_url }}</a>
<a class="inline-block button" href="{{ user.ap_url }}">{{ "Open on {{ instance_url }}" | _(instance_url=instance_url) }}</a>
{% endif %}
{% if not is_self and account %}
{% if (not is_self) and account %}
{% if follows %}
<a href="../follow/" class="inline-block button">Follow</a>
<a href="../follow/" class="inline-block button">{{ "Follow" | _ }}</a>
{% else %}
<a href="../follow/" class="inline-block button">Unfollow</a>
<a href="../follow/" class="inline-block button">{{ "Unfollow" | _ }}</a>
{% endif %}
{% endif %}
</div>
<h2>Followers</h2>
<h2>{{ "Followers" | _ }}</h2>
<div class="cards">
{% for follower in followers %}
{% if follower.display_name %}
+7 -7
View File
@@ -1,24 +1,24 @@
{% extends "base" %}
{% block title %}
New Account
{{ "New Account" | _ }}
{% endblock title %}
{% block content %}
<h1>Create an account</h1>
<h1>{{ "Create an account" | _ }}</h1>
<form method="post">
<label for="username">Username</label>
<label for="username">{{ "Username" | _ }}</label>
<input name="username">
<label for="email">Email</label>
<label for="email">{{ "Email" | _ }}</label>
<input name="email">
<label for="password">Password</label>
<label for="password">{{ "Password" | _ }}</label>
<input type="password" name="password">
<label for="password_confirmation">Password confirmation</label>
<label for="password_confirmation">{{ "Password confirmation" | _ }}</label>
<input type="password" name="password_confirmation">
<input type="submit" value="Create account"/>
<input type="submit" value="{{ "Create account" | _ }}"/>
</form>
{% endblock content %}