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

View File

@ -1,5 +1,5 @@
<!doctype html>
<html lang="{{lang}}">
<html lang="{{lang}}" dir="{{htmldir}}" class="{{htmlclass}}">
<head>
<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"/>

View File

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