diff options
Diffstat (limited to 'src/modules/router/module.rs')
| -rw-r--r-- | src/modules/router/module.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/modules/router/module.rs b/src/modules/router/module.rs index 1987568..dc9dae8 100644 --- a/src/modules/router/module.rs +++ b/src/modules/router/module.rs @@ -27,14 +27,28 @@ pub fn module(router: &mut windmark::Router) { super::ticker::module(&context); })); router.set_post_route_callback(Box::new({ - |context, content| { + |context, response| { info!( "closed connection from {} to {}", context.tcp.peer_addr().unwrap().ip(), context.url.to_string(), ); - super::translate::module(&context, content); + if let Some(language) = + windmark::utilities::queries_from_url(context.url).get("translate") + { + if super::translate::module(&context, response, language).is_err() { + response.content = format!( + "An error occurred during the translation process. Your language \ + might not be supported.\n\n=> {} View Original\n\n{}", + context + .url + .to_string() + .replace(&format!("translate={language}"), ""), + response.content + ); + } + } } })); } |