Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - initial RTL support #575 #577

Merged
merged 9 commits into from Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
980 changes: 475 additions & 505 deletions po/plume/ar.po

Large diffs are not rendered by default.

805 changes: 389 additions & 416 deletions po/plume/bg.po

Large diffs are not rendered by default.

852 changes: 411 additions & 441 deletions po/plume/ca.po

Large diffs are not rendered by default.

1,014 changes: 492 additions & 522 deletions po/plume/cs.po

Large diffs are not rendered by default.

1,016 changes: 493 additions & 523 deletions po/plume/de.po

Large diffs are not rendered by default.

593 changes: 283 additions & 310 deletions po/plume/en.po

Large diffs are not rendered by default.

689 changes: 331 additions & 358 deletions po/plume/eo.po

Large diffs are not rendered by default.

1,006 changes: 488 additions & 518 deletions po/plume/es.po

Large diffs are not rendered by default.

1,028 changes: 499 additions & 529 deletions po/plume/fr.po

Large diffs are not rendered by default.

1,014 changes: 492 additions & 522 deletions po/plume/gl.po

Large diffs are not rendered by default.

937 changes: 455 additions & 482 deletions po/plume/hi.po

Large diffs are not rendered by default.

713 changes: 343 additions & 370 deletions po/plume/hr.po

Large diffs are not rendered by default.

1,014 changes: 492 additions & 522 deletions po/plume/it.po

Large diffs are not rendered by default.

1,010 changes: 490 additions & 520 deletions po/plume/ja.po

Large diffs are not rendered by default.

966 changes: 468 additions & 498 deletions po/plume/nb.po

Large diffs are not rendered by default.

1,012 changes: 491 additions & 521 deletions po/plume/pl.po

Large diffs are not rendered by default.

544 changes: 262 additions & 282 deletions po/plume/plume.pot

Large diffs are not rendered by default.

978 changes: 474 additions & 504 deletions po/plume/pt.po

Large diffs are not rendered by default.

773 changes: 373 additions & 400 deletions po/plume/ro.po

Large diffs are not rendered by default.

846 changes: 408 additions & 438 deletions po/plume/ru.po

Large diffs are not rendered by default.

1,026 changes: 498 additions & 528 deletions po/plume/sk.po

Large diffs are not rendered by default.

639 changes: 306 additions & 333 deletions po/plume/sr.po

Large diffs are not rendered by default.

593 changes: 283 additions & 310 deletions po/plume/sv.po

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/template_utils.rs
Expand Up @@ -146,7 +146,7 @@ pub fn avatar(
pub fn tabs(links: &[(&str, String, bool)]) -> Html<String> {
let mut res = String::from(r#"<div class="tabs">"#);
for (url, title, selected) in links {
res.push_str(r#"<a href=""#);
res.push_str(r#"<a dir="auto" href=""#);
res.push_str(url);
if *selected {
res.push_str(r#"" class="selected">"#);
Expand Down Expand Up @@ -176,7 +176,7 @@ pub fn paginate_param(
p
})
.unwrap_or_default();
res.push_str(r#"<div class="pagination">"#);
res.push_str(r#"<div class="pagination" dir="auto">"#);
if page != 1 {
res.push_str(
format!(
Expand Down Expand Up @@ -239,13 +239,13 @@ macro_rules! input {

Html(format!(
r#"
<label for="{name}">
<label for="{name}" dir="auto">
{label}
{optional}
{details}
</label>
{error}
<input type="{kind}" id="{name}" name="{name}" value="{val}" {props}/>
<input type="{kind}" id="{name}" name="{name}" value="{val}" {props} dir="auto"/>
"#,
name = stringify!($name),
label = i18n!(cat, $label),
Expand All @@ -264,7 +264,7 @@ macro_rules! input {
$err.errors().get(stringify!($name))
{
format!(
r#"<p class="error">{}</p>"#,
r#"<p class="error" dir="auto">{}</p>"#,
errs[0]
.message
.clone()
Expand Down Expand Up @@ -332,8 +332,8 @@ macro_rules! input {
let cat = $catalog;
Html(format!(
r#"
<label for="{name}">{label}</label>
<input type="{kind}" id="{name}" name="{name}" {props}/>
<label for="{name}" dir="auto">{label}</label>
<input type="{kind}" id="{name}" name="{name}" {props} dir="auto"/>
"#,
name = stringify!($name),
label = i18n!(cat, $label),
Expand Down
20 changes: 10 additions & 10 deletions templates/blogs/details.rs.html
Expand Up @@ -24,7 +24,7 @@
<link href='@Instance::get_local().unwrap().compute_box("~", &blog.fqn, "atom.xml")' rel='alternate' type='application/atom+xml'>
<link href='@blog.ap_url' rel='alternate' type='application/activity+json'>
}, {
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)">@blog.title</a>
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)" dir="auto">@blog.title</a>
}, {
<div class="hidden">
@for author in authors {
Expand All @@ -41,38 +41,38 @@
}
<div class="h-card">
<div class="user">
<div class="flex wrap">
<div class="flex wrap" dir="auto">
<div class="avatar medium" style="background-image: url('@blog.icon_url(ctx.0)');" aria-label="@i18n!(ctx.1, "{}'s icon"; &blog.title)"></div>
<img class="hidden u-photo" src="@blog.icon_url(ctx.0)"/>

<h1 class="grow flex vertical">
<span class="p-name">@blog.title</span>
<small>~@blog.fqn</small>
<small dir="auto">~@blog.fqn</small>
</h1>

@if ctx.2.clone().and_then(|u| u.is_author_in(ctx.0, &blog).ok()).unwrap_or(false) {
<a href="@uri!(posts::new: blog = &blog.fqn)" class="button">@i18n!(ctx.1, "New article")</a>
<a href="@uri!(blogs::edit: name = &blog.fqn)" class="button">@i18n!(ctx.1, "Edit")</a>
<a href="@uri!(posts::new: blog = &blog.fqn)" class="button" dir="auto">@i18n!(ctx.1, "New article")</a>
<a href="@uri!(blogs::edit: name = &blog.fqn)" class="button" dir="auto">@i18n!(ctx.1, "Edit")</a>
}
</div>

<main class="user-summary">
<main class="user-summary" dir="auto">
<p>
@i18n!(ctx.1, "There's one author on this blog: ", "There are {0} authors on this blog: "; authors.len())
@for (i, author) in authors.iter().enumerate() {@if i >= 1 {, }
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>}
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)" dir="auto">@author.name()</a>}
</p>
@Html(blog.summary_html.clone())
</main>
</div>

<section>
<h2>
<h2 dir="auto">
@i18n!(ctx.1, "Latest articles")
<small><a href="@uri!(blogs::atom_feed: name = &blog.fqn)" title="Atom feed">@icon!("rss")</a></small>
</h2>
@if posts.is_empty() {
<p>@i18n!(ctx.1, "No posts to see here yet.")</p>
<p dir="auto">@i18n!(ctx.1, "No posts to see here yet.")</p>
}
<div class="cards">
@for article in posts {
Expand Down
4 changes: 2 additions & 2 deletions templates/blogs/new.rs.html
Expand Up @@ -7,9 +7,9 @@
@(ctx: BaseContext, form: &NewBlogForm, errors: ValidationErrors)

@:base(ctx, i18n!(ctx.1, "New Blog"), {}, {}, {
<h1>@i18n!(ctx.1, "Create a blog")</h1>
<h1 dir="auto">@i18n!(ctx.1, "Create a blog")</h1>
<form method="post" action="@uri!(blogs::create)">
@input!(ctx.1, title (text), "Title", form, errors, "required minlength=\"1\"")
<input type="submit" value="@i18n!(ctx.1, "Create blog")"/>
<input type="submit" value="@i18n!(ctx.1, "Create blog")" dir="auto"/>
</form>
})
4 changes: 2 additions & 2 deletions templates/partials/comment.rs.html
Expand Up @@ -9,7 +9,7 @@
<div class="comment u-comment h-cite" id="comment-@comm.id">
<main class="content">
<header>
<a class="author u-author h-card" href="@uri!(user::details: name = &author.fqn)">
<a class="author u-author h-card" href="@uri!(user::details: name = &author.fqn)" dir="auto">
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
<span class="display-name p-name">@author.name()</span>
<small>@author.fqn</small>
Expand All @@ -27,7 +27,7 @@
<div class="text p-content">
@if comm.sensitive {
<details>
<summary>@comm.spoiler_text</summary>
<summary dir="auto">@comm.spoiler_text</summary>
}
@Html(&comm.content)
@if comm.sensitive {
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/home_feed.rs.html
Expand Up @@ -6,7 +6,7 @@

@if !articles.is_empty() {
<div class="h-feed">
<h2><span class="p-name">@title</span> &mdash; <a href="@link">@i18n!(ctx.1, "View all")</a></h2>
<h2 dir="auto"><span class="p-name">@title</span> &mdash; <a href="@link">@i18n!(ctx.1, "View all")</a></h2>
<div class="cards">
@for article in articles {
@:post_card(ctx, article)
Expand Down
6 changes: 3 additions & 3 deletions templates/partials/image_select.rs.html
Expand Up @@ -3,7 +3,7 @@

@(ctx: BaseContext, id: &str, title: String, optional: bool, medias: Vec<Media>, selected: Option<i32>)

<label for="@id">
<label for="@id" dir="auto">
@title
@if optional {
<small>@i18n!(ctx.1, "Optional")</small>
Expand All @@ -13,7 +13,7 @@
<option value="none" @if selected.is_none() { selected }>@i18n!(ctx.1, "None")</option>
@for media in medias {
@if media.category() == MediaCategory::Image {
<option value="@media.id" @if selected.map(|c| c == media.id).unwrap_or(false) { selected }>
<option value="@media.id" @if selected.map(|c| c == media.id).unwrap_or(false) { selected } dir="auto">
@if !media.alt_text.is_empty() {
@media.alt_text
} else {
Expand All @@ -22,4 +22,4 @@
</option>
}
}
</select>
</select>
2 changes: 1 addition & 1 deletion templates/partials/instance_description.rs.html
Expand Up @@ -4,7 +4,7 @@

@(ctx: BaseContext, instance: Instance, n_users: i64, n_articles: i64)

<section class="split">
<section class="split" dir="auto">
<div class="presentation card">
<h2>@i18n!(ctx.1, "What is Plume?")</h2>
<main>
Expand Down
4 changes: 2 additions & 2 deletions templates/partials/post_card.rs.html
Expand Up @@ -8,13 +8,13 @@
@if article.cover_id.is_some() {
<div class="cover" style="background-image: url('@Html(article.cover_url(ctx.0).unwrap_or_default())')"></div>
}
<h3 class="p-name">
<h3 class="p-name" dir="auto">
<a class="u-url" href="@uri!(posts::details: blog = article.get_blog(ctx.0).unwrap().fqn, slug = &article.slug, responding_to = _)">
@article.title
</a>
</h3>
<main>
<p class="p-summary">@article.subtitle</p>
<p class="p-summary" dir="auto">@article.subtitle</p>
</main>
<footer class="authors">
@Html(i18n!(ctx.1, "By {0}"; format!(
Expand Down
20 changes: 10 additions & 10 deletions templates/posts/details.rs.html
Expand Up @@ -28,8 +28,8 @@
@if article.cover_id.is_some() { style="background-image: url('@article.cover_url(ctx.0).unwrap_or_default()'" }
>
<div>
<h1 class="article p-name">@article.title</h1>
<div class="article-info">
<h1 class="article p-name" dir="auto">@article.title</h1>
<div class="article-info" dir="auto">
<span class="author">
@Html(i18n!(ctx.1, "Written by {0}"; format!("<a href=\"{}\">{}</a>",
uri!(user::details: name = &author.fqn),
Expand All @@ -38,20 +38,20 @@ <h1 class="article p-name">@article.title</h1>
&mdash;
<span class="date dt-published" datetime="@article.creation_date.format("%F %T")">@article.creation_date.format("%B %e, %Y")</span><a class="u-url" href="@article.ap_url"></a>
</div>
<h2 class="article p-summary">@article.subtitle</h2>
<h2 class="article p-summary" dir="auto">@article.subtitle</h2>
</div>
@if article.cover_id.is_some() {
<div class="shadow"></div>
<img class="u-photo hidden" src="@article.cover_url(ctx.0).unwrap_or_default()"/>
}
</header>

<article class="e-content">
<article class="e-content" dir="auto">
@Html(&article.content)
</article>
<div class="article-meta">
<section class="split">
<ul class="tags">
<ul class="tags" dir="auto">
@for tag in tags {
@if !tag.is_hashtag {
<li><a class="p-category" href="@uri!(tags::tag: name = &tag.tag, page = _)">@tag.tag</a></li>
Expand All @@ -60,7 +60,7 @@ <h2 class="article p-summary">@article.subtitle</h2>
}
}
</ul>
<p class="right">
<p class="right" dir="auto">
@if article.license.is_empty() {
@i18n!(ctx.1, "All rights reserved."; &article.license)
} else {
Expand Down Expand Up @@ -116,7 +116,7 @@ <h2 class="article p-summary">@article.subtitle</h2>
</section>
}
<section class="banner">
<div class="flex p-author h-card user">
<div class="flex p-author h-card user" dir="auto">
@avatar(ctx.0, &author, Size::Medium, true, ctx.1)
<div class="grow">
<h2 class="p-name">
Expand All @@ -132,7 +132,7 @@ <h2 class="p-name">
}
</div>
</section>
<section class="comments">
<section class="comments" dir="auto">
<h2>@i18n!(ctx.1, "Comments")</h2>

@if ctx.2.is_some() {
Expand All @@ -143,7 +143,7 @@ <h2>@i18n!(ctx.1, "Comments")</h2>
@if let Some(ref prev) = previous_comment {
<input type="hidden" name="responding_to" value="@prev.id"/>
}
<textarea id="plume-editor" name="content">@comment_form.content</textarea>
<textarea id="plume-editor" name="content" dir="auto">@comment_form.content</textarea>
<input type="submit" value="@i18n!(ctx.1, "Submit comment")" />
</form>
}
Expand All @@ -153,7 +153,7 @@ <h2>@i18n!(ctx.1, "Comments")</h2>
@:comment(ctx, &comm, Some(&article.ap_url), &blog.fqn, &article.slug)
}
} else {
<p class="center">@i18n!(ctx.1, "No comments yet. Be the first to react!")</p>
<p class="center" dir="auto">@i18n!(ctx.1, "No comments yet. Be the first to react!")</p>
}
</section>
</div>
Expand Down
14 changes: 7 additions & 7 deletions templates/posts/new.rs.html
Expand Up @@ -12,8 +12,8 @@
@(ctx: BaseContext, title: String, blog: Blog, editing: bool, form: &NewPostForm, is_draft: bool, article: Option<Post>, errors: ValidationErrors, medias: Vec<Media>, content_len: u64)

@:base(ctx, title.clone(), {}, {}, {
<h1 id="plume-editor-title">@title</h1>
<div id="plume-editor" style="display: none;">
<h1 id="plume-editor-title" dir="auto">@title</h1>
<div id="plume-editor" style="display: none;" dir="auto">
<header>
<button id="publish" class="button">@i18n!(ctx.1, "Publish")</button>
<p id="char-count">@content_len</p>
Expand All @@ -32,10 +32,10 @@ <h1 id="plume-editor-title">@title</h1>
@format!(r#"<p class="error">{}</p>"#, errs[0].message.clone().unwrap_or_else(|| Cow::from("Unknown error")))
}

<label for="editor-content">@i18n!(ctx.1, "Content")<small>@i18n!(ctx.1, "Markdown syntax is supported")</small></label>
<textarea id="editor-content" name="content" rows="20">@Html(&form.content)</textarea>
<small id="editor-left">@content_len</small>
<p>
<label for="editor-content" dir="auto">@i18n!(ctx.1, "Content")<small>@i18n!(ctx.1, "Markdown syntax is supported")</small></label>
<textarea id="editor-content" name="content" rows="20" dir="auto">@Html(&form.content)</textarea>
<small id="editor-left" dir="auto">@content_len</small>
<p dir="auto">
@i18n!(ctx.1, "You can upload media to your gallery, and then copy their Markdown code into your articles to insert them.")
<a href="@uri!(medias::new)">@i18n!(ctx.1, "Upload media")</a>
</p>
Expand All @@ -47,7 +47,7 @@ <h1 id="plume-editor-title">@title</h1>
@:image_select(ctx, "cover", i18n!(ctx.1, "Illustration"), true, medias, form.cover)

@if is_draft {
<label for="draft">
<label for="draft" dir="auto">
<input type="checkbox" name="draft" id="draft" checked>
@i18n!(ctx.1, "This is a draft, don't publish it yet.")
</label>
Expand Down
2 changes: 1 addition & 1 deletion templates/posts/remote_interact.rs.html
Expand Up @@ -9,6 +9,6 @@
@(ctx: BaseContext, post: Post, login_form: LoginForm, login_errs: ValidationErrors, remote_form: RemoteForm, remote_errs: ValidationErrors)

@:remote_interact_base(ctx, i18n!(ctx.1, "Interact with {}"; post.title.clone()), i18n!(ctx.1, "Log in to interact"), i18n!(ctx.1, "Enter your full username to interact"), {
<h1>@i18n!(ctx.1, "Interact with {}"; post.title.clone())</h1>
<h1 dir="auto">@i18n!(ctx.1, "Interact with {}"; post.title.clone())</h1>
@:post_card(ctx, post)
}, login_form, login_errs, remote_form, remote_errs)