Add security, i18n, analysis, backup, notifications

This commit is contained in:
2026-02-27 17:16:41 +02:00
parent d6a6fb9eca
commit a1c7f72d1d
46 changed files with 7908 additions and 481 deletions

34
src/i18n.rs Normal file
View File

@@ -0,0 +1,34 @@
/// Mark a string for translation.
/// Currently a passthrough; will use gettext when locale support is wired up.
pub fn i18n(msgid: &str) -> String {
msgid.to_string()
}
/// Translate a string with singular/plural forms.
pub fn ni18n(singular: &str, plural: &str, n: u32) -> String {
if n == 1 {
singular.to_string()
} else {
plural.to_string()
}
}
/// Translate a string and replace named placeholders.
pub fn i18n_f(msgid: &str, args: &[(&str, &str)]) -> String {
let mut result = msgid.to_string();
for (key, value) in args {
result = result.replace(key, value);
}
result
}
/// Translate a string with singular/plural forms and named placeholders.
#[allow(dead_code)]
pub fn ni18n_f(singular: &str, plural: &str, n: u32, args: &[(&str, &str)]) -> String {
let base = if n == 1 { singular } else { plural };
let mut result = base.to_string();
for (key, value) in args {
result = result.replace(key, value);
}
result
}