i18n: adapt for rtl templates

This commit is contained in:
Vincent Breitmoser
2021-02-19 03:40:52 +01:00
parent bb4a1859a7
commit 31531ad050
3 changed files with 28 additions and 19 deletions

40
dist/assets/site.css vendored
View File

@@ -162,23 +162,16 @@ code.snippet {
blockquote { blockquote {
font-family: monospace; font-family: monospace;
background: #f9f9f9; background: #f9f9f9;
border-left: 10px solid #ccc; border-inline-start: 10px solid #ccc;
margin: 1.5em 10px; margin: 1.5em 10px;
padding: 0.5em 10px; padding: 0.5em 10px;
} }
blockquote:before {
color: #ccc;
font-size: 4em;
line-height: 0.1em;
margin-right: 0.25em;
vertical-align: -0.4em;
}
blockquote p { blockquote p {
display: inline; display: inline;
} }
li { li {
text-align: left; text-align: start;
} }
abbr { abbr {
@@ -196,10 +189,12 @@ abbr {
border: 3px solid; border: 3px solid;
padding: 5px; padding: 5px;
height: 20px; height: 20px;
border-radius: 5px;
outline: none; outline: none;
border-bottom-right-radius: 0; border-radius: 5px 0 0 5px;
border-top-right-radius: 0; }
.rtl .manageEmail, .rtl .searchTerm, .rtl .fileUpload {
border-radius: 0 5px 5px 0;
} }
.manageEmail { .manageEmail {
@@ -218,17 +213,20 @@ abbr {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
width: 65%; width: 65%;
text-align: left; text-align: start;
} }
.publishedUid div { .publishedUid div {
float: right; float: right;
} }
.rtl .publishedUid div {
float: left;
}
.verificationEmails { .verificationEmails {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
width: 50%; width: 50%;
text-align: left; text-align: start;
} }
.verificationEmails ul { .verificationEmails ul {
margin-top: 0.3em; margin-top: 0.3em;
@@ -265,8 +263,11 @@ abbr {
} }
.searchButton, .manageButton, .uploadButton { .searchButton, .manageButton, .uploadButton {
border-bottom-left-radius: 0; border-radius: 0 5px 5px 0;
border-top-left-radius: 0; }
.rtl .searchButton, .rtl .manageButton, .rtl .uploadButton {
border-radius: 5px 0 0 5px;
} }
.button img, .button svg { .button img, .button svg {
@@ -288,7 +289,7 @@ abbr {
/* This is used to enlarge the card, but is also used to constrain the /* This is used to enlarge the card, but is also used to constrain the
flow of text in /about. */ flow of text in /about. */
.card > .about { .card > .about {
text-align: left; text-align: start;
} }
span.fingerprint { span.fingerprint {
@@ -303,9 +304,11 @@ span.email {
.debug_link { .debug_link {
position: absolute; position: absolute;
right: 0px; right: 0px;
left: 0px;
top: 0px; top: 0px;
margin: 10px; margin: 10px;
font-size: 12px; font-size: 12px;
text-align: end;
} }
.debug_link a { .debug_link a {
@@ -321,8 +324,9 @@ span.email {
z-index: -1; z-index: -1;
bottom: 0; bottom: 0;
right: 0; right: 0;
left: 0;
width: 100%; width: 100%;
text-align: right; text-align: end;
font-size: 12px; font-size: 12px;
color: #bbb; color: #bbb;
margin: 10px; margin: 10px;

View File

@@ -1,5 +1,5 @@
<!doctype html> <!doctype html>
<html lang="{{lang}}"> <html lang="{{lang}}" dir="{{htmldir}}" class="{{htmlclass}}">
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="/assets/site.css?v=19" type="text/css"/> <link rel="stylesheet" href="/assets/site.css?v=19" type="text/css"/>

View File

@@ -197,6 +197,8 @@ mod templates {
pub version: String, pub version: String,
pub base_uri: String, pub base_uri: String,
pub lang: String, pub lang: String,
pub htmldir: String,
pub htmlclass: String,
pub page: T, pub page: T,
} }
@@ -213,6 +215,7 @@ mod templates {
impl<T: serde::Serialize> HagridLayout<T> { impl<T: serde::Serialize> HagridLayout<T> {
pub fn new(page: T, i18n: I18n, origin: RequestOrigin) -> Self { pub fn new(page: T, i18n: I18n, origin: RequestOrigin) -> Self {
let is_rtl = (i18n.lang) == "ar";
Self { Self {
error: None, error: None,
version: env!("VERGEN_SEMVER").to_string(), version: env!("VERGEN_SEMVER").to_string(),
@@ -220,6 +223,8 @@ mod templates {
base_uri: origin.get_base_uri().to_string(), base_uri: origin.get_base_uri().to_string(),
page: page, page: page,
lang: i18n.lang.to_string(), lang: i18n.lang.to_string(),
htmldir: if is_rtl { "rtl".to_owned() } else { "ltr".to_owned() },
htmlclass: if is_rtl { "rtl".to_owned() } else { "".to_owned() },
} }
} }
} }