vietnamese

This commit is contained in:
nnduc
2026-10-24 17:46:20 +07:00
parent 5467b0aa2c
commit a3cf10cb0a
33 changed files with 4306 additions and 94 deletions
+27
View File
@@ -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("&lt;b&gt;a&lt;/b&gt;.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ẻ"));
}
}