From 9dc07a38dbea58e69c606e39c81e44f1310f3fee Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Fri, 30 Sep 2022 23:14:25 +0300 Subject: [PATCH] Follow-up from i18n-helpers MR --- .gitlab/scripts/code-quality.sh | 14 ++++++++++++-- client/examples/chat-cli/main.rs | 2 +- client/i18n/src/bin/i18n-check.rs | 2 +- client/i18n/src/bin/i18n-csv.rs | 4 ++-- client/src/lib.rs | 4 ++-- voxygen/src/hud/chat.rs | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitlab/scripts/code-quality.sh b/.gitlab/scripts/code-quality.sh index 60b7285084..d610acc878 100755 --- a/.gitlab/scripts/code-quality.sh +++ b/.gitlab/scripts/code-quality.sh @@ -1,6 +1,16 @@ #!/bin/bash # cargo clippy is a superset of cargo check, so we don't check manually -time cargo clippy --all-targets --locked --features="bin_cmd_doc_gen,bin_compression,bin_csv,bin_graphviz,bin_bot,bin_asset_migrate,asset_tweak" -- -D warnings && + +time cargo clippy \ + --all-targets \ + --locked \ + --features="bin_cmd_doc_gen,bin_compression,bin_csv,bin_graphviz,bin_bot,bin_asset_migrate,asset_tweak,bin,stat" \ + -- -D warnings && + # Ensure that the veloren-voxygen default-publish feature builds as it excludes some default features -time cargo clippy -p veloren-voxygen --locked --no-default-features --features="default-publish" -- -D warnings && +time cargo clippy -p \ + veloren-voxygen --locked \ + --no-default-features \ + --features="default-publish" \ + -- -D warnings && time cargo fmt --all -- --check diff --git a/client/examples/chat-cli/main.rs b/client/examples/chat-cli/main.rs index 7c60e062f2..4f0a525098 100644 --- a/client/examples/chat-cli/main.rs +++ b/client/examples/chat-cli/main.rs @@ -99,7 +99,7 @@ fn main() { "{}", localize_chat_message( m, - |msg| client.lockup_msg_context(msg), + |msg| client.lookup_msg_context(msg), &localisation.read(), SHOW_NAME, ) diff --git a/client/i18n/src/bin/i18n-check.rs b/client/i18n/src/bin/i18n-check.rs index 002d76e9a2..8471797247 100644 --- a/client/i18n/src/bin/i18n-check.rs +++ b/client/i18n/src/bin/i18n-check.rs @@ -1,6 +1,6 @@ use clap::{Arg, Command}; use common_assets::find_root; -use veloren_voxygen_i18n::{ +use veloren_client_i18n::{ analysis::{Language, ReferenceLanguage}, REFERENCE_LANG, }; diff --git a/client/i18n/src/bin/i18n-csv.rs b/client/i18n/src/bin/i18n-csv.rs index d26706f2ed..b98317f84c 100644 --- a/client/i18n/src/bin/i18n-csv.rs +++ b/client/i18n/src/bin/i18n-csv.rs @@ -1,6 +1,6 @@ use common_assets::find_root; use std::{fs, io::Write, path::Path}; -use veloren_voxygen_i18n::{ +use veloren_client_i18n::{ analysis::{Language, ReferenceLanguage}, list_localizations, REFERENCE_LANG, }; @@ -26,7 +26,7 @@ fn main() { .and_then(|s| s.to_str()) .unwrap_or(""); - format!("{file}") + file.to_string() }; for meta in list { let code = meta.language_identifier; diff --git a/client/src/lib.rs b/client/src/lib.rs index f2da92c438..a04165415e 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -2643,7 +2643,7 @@ impl Client { /// Get important information from client that is necessary for message /// localisation - pub fn lockup_msg_context(&self, msg: &comp::ChatMsg) -> ChatTypeContext { + pub fn lookup_msg_context(&self, msg: &comp::ChatMsg) -> ChatTypeContext { let mut result = ChatTypeContext { you: self.uid().expect("Client doesn't have a Uid!!!"), player_alias: HashMap::new(), @@ -2861,7 +2861,7 @@ mod tests { let msg: comp::ChatMsg = msg; let _s: String = localize_chat_message( msg, - |msg| client.lockup_msg_context(msg), + |msg| client.lookup_msg_context(msg), &localisation.read(), true, ) diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 544563fdf5..3a86ce63bd 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -421,7 +421,7 @@ impl<'a> Widget for Chat<'a> { .map(|m| { localize_chat_message( m.clone(), - |msg| self.client.lockup_msg_context(msg), + |msg| self.client.lookup_msg_context(msg), self.localized_strings, show_char_name, )