diff options
author | Vincent Breitmoser <look@my.amazin.horse> | 2021-02-19 03:40:52 +0100 |
---|---|---|
committer | Vincent Breitmoser <look@my.amazin.horse> | 2021-02-20 13:38:56 +0100 |
commit | 31531ad0500b9c22f84ce83661baa8868ad5b47a (patch) | |
tree | 12ee94028d7244eb43a179a783bbb2f8263ae2b7 /src | |
parent | bb4a1859a7533169e993531735764ecdeccc122e (diff) |
i18n: adapt for rtl templates
Diffstat (limited to 'src')
-rw-r--r-- | src/web/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/web/mod.rs b/src/web/mod.rs index 3f38704..1c1da02 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -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() }, } } } |