vietnamese
This commit is contained in:
+27
@@ -90,3 +90,30 @@ fn add_emojis(state: &State, s: String, no_title: Option<bool>) -> Value {
|
||||
let escaped = utils::html_escape(&s);
|
||||
Value::from_safe_string(utils::replace_emojis(&escaped, &base, no_title.unwrap_or(false)).html)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
fn shared_files_drawer() {
|
||||
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
i18n::init(&root.join("frontend"));
|
||||
let env = environment(&root.join("templates"));
|
||||
let tpl = env.get_template("ChatActions/_chatactions_files.html").unwrap();
|
||||
let file = json!({
|
||||
"mid": 7, "url": "https://up.example.org/a.pdf", "name": "<b>a</b>.pdf", "size": "1 KiB",
|
||||
"date": "today", "published": "2026-01-01 10:00:00", "thumb": "/picture?url=x",
|
||||
});
|
||||
let data = |lang| json!({ "lang": lang, "jid": "bob@example.org", "images": [file], "videos": [], "recordings": [file], "files": [file] });
|
||||
|
||||
let html = tpl.render(data("en")).unwrap();
|
||||
assert!(html.contains("Recordings") && html.contains("Shared files"));
|
||||
assert!(html.contains("<b>a</b>.pdf") && !html.contains("<b>a</b>"));
|
||||
assert!(html.contains(r#"<audio controls preload="none" src="https://up.example.org/a.pdf""#));
|
||||
|
||||
let html = tpl.render(data("vi")).unwrap();
|
||||
assert!(html.contains("Ghi âm") && html.contains("Tệp đã chia sẻ"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user