fix(lang): alert_formatter is in english now
This commit is contained in:
@@ -7,15 +7,15 @@ pub struct AlertFormatter;
|
||||
impl AlertFormatter {
|
||||
fn get_message_for_metric(&self, metric: &str, level: &str) -> String {
|
||||
match (metric, level) {
|
||||
("CPU", "AVERTISSEMENT") => "Utilisation CPU élevée détectée".to_string(),
|
||||
("CPU", "CRITIQUE") => "CPU trop sollicité - Intervention requise !".to_string(),
|
||||
("Memory", "AVERTISSEMENT") => "Utilisation mémoire élevée".to_string(),
|
||||
("Memory", "CRITIQUE") => "Mémoire saturée - Risque de crash !".to_string(),
|
||||
("Swap", "AVERTISSEMENT") => "Utilisation du swap élevé".to_string(),
|
||||
("Swap", "CRITIQUE") => "Swap saturé - Performance dégradée !".to_string(),
|
||||
("Disk", "AVERTISSEMENT") => "Espace disque faible".to_string(),
|
||||
("Disk", "CRITIQUE") => "Disque presque plein - Nettoyage urgent !".to_string(),
|
||||
(metric, _) => format!("Problème de niveau '{}' détecté sur {}", level, metric),
|
||||
("CPU", "WARNING") => "High CPU usage detected".to_string(),
|
||||
("CPU", "CRITICAL") => "CPU overloaded - Intervention required!".to_string(),
|
||||
("Memory", "WARNING") => "High memory usage".to_string(),
|
||||
("Memory", "CRITICAL") => "Memory saturated - Risk of crash!".to_string(),
|
||||
("Swap", "WARNING") => "High swap usage".to_string(),
|
||||
("Swap", "CRITICAL") => "Swap saturated - Performance degraded!".to_string(),
|
||||
("Disk", "WARNING") => "Low disk space".to_string(),
|
||||
("Disk", "CRITICAL") => "Disk almost full - Urgent cleanup required!".to_string(),
|
||||
(metric, _) => format!("Level '{}' problem detected on {}", level, metric),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,13 +23,13 @@ impl AlertFormatter {
|
||||
impl ForFormattingMessage for AlertFormatter {
|
||||
fn format_violation(&self, violation: Box<dyn ForGettingViolationData>) -> String {
|
||||
let (emoji, level) = if violation.is_critical() {
|
||||
("🚨", "CRITIQUE")
|
||||
("🚨", "CRITICAL")
|
||||
} else {
|
||||
("⚠️", "AVERTISSEMENT")
|
||||
("⚠️", "WARNING")
|
||||
};
|
||||
|
||||
format!(
|
||||
"{} **{}** - {}\n\n**Valeur actuelle:** {:.2}%\n**Seuil:** {:.2}%",
|
||||
"{} **{}** - {}\n\n**Current Value:** {:.2}%\n**Threshold:** {:.2}%",
|
||||
emoji,
|
||||
level,
|
||||
self.get_message_for_metric(&violation.get_metric_name(), level),
|
||||
@@ -39,7 +39,7 @@ impl ForFormattingMessage for AlertFormatter {
|
||||
}
|
||||
|
||||
fn format_summary(&self, metrics: &HashMap<String, f32>) -> String {
|
||||
let mut result = "📊 **Rapport Système**\n\n```\n".to_string();
|
||||
let mut result = "📊 **System Report**\n\n```\n".to_string();
|
||||
|
||||
result.push_str(
|
||||
&metrics
|
||||
@@ -49,7 +49,7 @@ impl ForFormattingMessage for AlertFormatter {
|
||||
.join("\n"),
|
||||
);
|
||||
|
||||
result.push_str("\n```\n\n*Surveillance automatique*");
|
||||
result.push_str("\n```\n\n*Automatic monitoring*");
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user