From 36d9c1383e8376414f7ea561bfef46ed41338ea2 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sun, 2 Dec 2018 12:29:05 -0800 Subject: [PATCH] Recognize translate text components, instead of showing "UNHANDLED" For example, if a server connection times out and you are kicked, Steven will now show disconnect.reason timeout, versus a non-descriptive UNHANDLED message. This text is supposed to be looked up in a translation table for localization, not yet supported, but showing the translation identifier is more informative than nothing. --- src/format.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/format.rs b/src/format.rs index 79248d4..29776bd 100644 --- a/src/format.rs +++ b/src/format.rs @@ -45,6 +45,9 @@ impl Component { }) } else if v.get("text").is_some() { Component::Text(TextComponent::from_value(v, modifier)) + } else if v.get("translate").is_some() { + // TODO: translations + Component::Text(TextComponent::new(v.get("translate").unwrap().as_str().unwrap())) } else { modifier.color = Some(Color::RGB(255, 0, 0)); Component::Text(TextComponent {