Follow-up from i18n-helpers MR

This commit is contained in:
juliancoffee 2022-09-30 23:14:25 +03:00
parent dd5523785c
commit 9dc07a38db
6 changed files with 19 additions and 9 deletions

View File

@ -1,6 +1,16 @@
#!/bin/bash #!/bin/bash
# cargo clippy is a superset of cargo check, so we don't check manually # 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 # 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 time cargo fmt --all -- --check

View File

@ -99,7 +99,7 @@ fn main() {
"{}", "{}",
localize_chat_message( localize_chat_message(
m, m,
|msg| client.lockup_msg_context(msg), |msg| client.lookup_msg_context(msg),
&localisation.read(), &localisation.read(),
SHOW_NAME, SHOW_NAME,
) )

View File

@ -1,6 +1,6 @@
use clap::{Arg, Command}; use clap::{Arg, Command};
use common_assets::find_root; use common_assets::find_root;
use veloren_voxygen_i18n::{ use veloren_client_i18n::{
analysis::{Language, ReferenceLanguage}, analysis::{Language, ReferenceLanguage},
REFERENCE_LANG, REFERENCE_LANG,
}; };

View File

@ -1,6 +1,6 @@
use common_assets::find_root; use common_assets::find_root;
use std::{fs, io::Write, path::Path}; use std::{fs, io::Write, path::Path};
use veloren_voxygen_i18n::{ use veloren_client_i18n::{
analysis::{Language, ReferenceLanguage}, analysis::{Language, ReferenceLanguage},
list_localizations, REFERENCE_LANG, list_localizations, REFERENCE_LANG,
}; };
@ -26,7 +26,7 @@ fn main() {
.and_then(|s| s.to_str()) .and_then(|s| s.to_str())
.unwrap_or("<err>"); .unwrap_or("<err>");
format!("{file}") file.to_string()
}; };
for meta in list { for meta in list {
let code = meta.language_identifier; let code = meta.language_identifier;

View File

@ -2643,7 +2643,7 @@ impl Client {
/// Get important information from client that is necessary for message /// Get important information from client that is necessary for message
/// localisation /// 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 { let mut result = ChatTypeContext {
you: self.uid().expect("Client doesn't have a Uid!!!"), you: self.uid().expect("Client doesn't have a Uid!!!"),
player_alias: HashMap::new(), player_alias: HashMap::new(),
@ -2861,7 +2861,7 @@ mod tests {
let msg: comp::ChatMsg = msg; let msg: comp::ChatMsg = msg;
let _s: String = localize_chat_message( let _s: String = localize_chat_message(
msg, msg,
|msg| client.lockup_msg_context(msg), |msg| client.lookup_msg_context(msg),
&localisation.read(), &localisation.read(),
true, true,
) )

View File

@ -421,7 +421,7 @@ impl<'a> Widget for Chat<'a> {
.map(|m| { .map(|m| {
localize_chat_message( localize_chat_message(
m.clone(), m.clone(),
|msg| self.client.lockup_msg_context(msg), |msg| self.client.lookup_msg_context(msg),
self.localized_strings, self.localized_strings,
show_char_name, show_char_name,
) )