From 81cdcfc1a0222d06c45f6ba93cbff5c83c90d59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Tue, 27 Sep 2022 14:09:20 +0200 Subject: [PATCH] move voxygen/i18n to client/i18n to indicate that it can be used by more frontends if they want to make use of our helpers --- Cargo.lock | 42 +++++++++---------- Cargo.toml | 2 +- client/Cargo.toml | 6 +-- client/examples/chat-cli/main.rs | 3 +- {voxygen => client}/i18n/Cargo.toml | 4 +- {voxygen => client}/i18n/src/analysis.rs | 0 .../i18n/src/bin/i18n-check.rs | 0 {voxygen => client}/i18n/src/bin/i18n-csv.rs | 0 {voxygen => client}/i18n/src/error.rs | 0 {voxygen => client}/i18n/src/lib.rs | 0 {voxygen => client}/i18n/src/raw.rs | 0 client/src/lib.rs | 3 +- voxygen/Cargo.toml | 2 +- voxygen/i18n-helpers/Cargo.toml | 2 +- 14 files changed, 33 insertions(+), 31 deletions(-) rename {voxygen => client}/i18n/Cargo.toml (87%) rename {voxygen => client}/i18n/src/analysis.rs (100%) rename {voxygen => client}/i18n/src/bin/i18n-check.rs (100%) rename {voxygen => client}/i18n/src/bin/i18n-csv.rs (100%) rename {voxygen => client}/i18n/src/error.rs (100%) rename {voxygen => client}/i18n/src/lib.rs (100%) rename {voxygen => client}/i18n/src/raw.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 9dec3b09fd..ad98e1bdda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6675,6 +6675,7 @@ dependencies = [ "tokio", "tracing", "vek 0.15.8", + "veloren-client-i18n", "veloren-common", "veloren-common-base", "veloren-common-ecs", @@ -6683,10 +6684,27 @@ dependencies = [ "veloren-common-state", "veloren-common-systems", "veloren-network", - "veloren-voxygen-i18n", "veloren-voxygen-i18n-helpers", ] +[[package]] +name = "veloren-client-i18n" +version = "0.13.0" +dependencies = [ + "clap 3.2.22", + "deunicode", + "fluent", + "fluent-bundle", + "fluent-syntax", + "hashbrown 0.12.3", + "intl-memoizer", + "ron 0.8.0", + "serde", + "tracing", + "unic-langid", + "veloren-common-assets", +] + [[package]] name = "veloren-common" version = "0.10.0" @@ -7082,6 +7100,7 @@ dependencies = [ "treeculler", "vek 0.15.8", "veloren-client", + "veloren-client-i18n", "veloren-common", "veloren-common-base", "veloren-common-ecs", @@ -7092,7 +7111,6 @@ dependencies = [ "veloren-server", "veloren-voxygen-anim", "veloren-voxygen-egui", - "veloren-voxygen-i18n", "veloren-voxygen-i18n-helpers", "veloren-world", "wgpu", @@ -7126,32 +7144,14 @@ dependencies = [ "veloren-common-dynlib", ] -[[package]] -name = "veloren-voxygen-i18n" -version = "0.13.0" -dependencies = [ - "clap 3.2.22", - "deunicode", - "fluent", - "fluent-bundle", - "fluent-syntax", - "hashbrown 0.12.3", - "intl-memoizer", - "ron 0.8.0", - "serde", - "tracing", - "unic-langid", - "veloren-common-assets", -] - [[package]] name = "veloren-voxygen-i18n-helpers" version = "0.10.0" dependencies = [ "tracing", + "veloren-client-i18n", "veloren-common", "veloren-common-net", - "veloren-voxygen-i18n", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 70cc7c35cd..5b61b4528a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "common/systems", "common/frontend", "client", + "client/i18n", "plugin/api", "plugin/derive", "plugin/rt", @@ -21,7 +22,6 @@ members = [ "voxygen", "voxygen/anim", "voxygen/i18n-helpers", - "voxygen/i18n", "voxygen/egui", "world", "network", diff --git a/client/Cargo.toml b/client/Cargo.toml index b20d289588..c257a37a88 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [features] simd = ["vek/platform_intrinsics"] plugins = ["common-state/plugins"] -bin_bot = ["common-ecs", "serde", "ron", "clap", "structopt", "rustyline", "common-frontend", "async-channel", "voxygen-i18n-helpers", "voxygen-i18n"] +bin_bot = ["common-ecs", "serde", "ron", "clap", "structopt", "rustyline", "common-frontend", "async-channel", "voxygen-i18n-helpers", "client-i18n"] tracy = ["common-base/tracy"] tick_network = [] @@ -38,7 +38,7 @@ authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253 async-channel = { version = "1.6", optional = true } common-ecs = { package = "veloren-common-ecs", path = "../common/ecs", optional = true } voxygen-i18n-helpers = { package = "veloren-voxygen-i18n-helpers", path = "../voxygen/i18n-helpers", optional = true } -voxygen-i18n = { package = "veloren-voxygen-i18n", path = "../voxygen/i18n", optional = true } +client-i18n = { package = "veloren-client-i18n", path = "i18n", optional = true } serde = { version = "1.0", features = [ "rc", "derive" ], optional = true } ron = { version = "0.8", default-features = false, optional = true } clap = { version = "3.1.8", optional = true, features = ["color", "std"] } @@ -50,7 +50,7 @@ common-frontend = { package = "veloren-common-frontend", path = "../common/front [dev-dependencies] voxygen-i18n-helpers = { package = "veloren-voxygen-i18n-helpers", path = "../voxygen/i18n-helpers" } -voxygen-i18n = { package = "veloren-voxygen-i18n", path = "../voxygen/i18n" } +client-i18n = { package = "veloren-client-i18n", path = "i18n" } [[example]] name = "chat-cli" diff --git a/client/examples/chat-cli/main.rs b/client/examples/chat-cli/main.rs index 832eba4cab..8f6f128ffe 100644 --- a/client/examples/chat-cli/main.rs +++ b/client/examples/chat-cli/main.rs @@ -1,6 +1,7 @@ #![deny(unsafe_code)] #![deny(clippy::clone_on_ref_ptr)] +use client_i18n::LocalizationHandle; use common::{clock::Clock, comp}; use std::{ io, @@ -31,7 +32,7 @@ fn main() { info!("loading localisation"); - let localisation = voxygen_i18n::LocalizationHandle::load_expect("en"); + let localisation = LocalizationHandle::load_expect("en"); info!("Starting chat-cli..."); diff --git a/voxygen/i18n/Cargo.toml b/client/i18n/Cargo.toml similarity index 87% rename from voxygen/i18n/Cargo.toml rename to client/i18n/Cargo.toml index 2e0061c969..329daed3fc 100644 --- a/voxygen/i18n/Cargo.toml +++ b/client/i18n/Cargo.toml @@ -1,8 +1,8 @@ [package] authors = ["juliancoffee "] edition = "2021" -name = "veloren-voxygen-i18n" -description = "Crate for internalization and diagnostic of existing localizations." +name = "veloren-client-i18n" +description = "Optional crate for internalization and diagnostic of existing localizations for frontends to consume" version = "0.13.0" [dependencies] diff --git a/voxygen/i18n/src/analysis.rs b/client/i18n/src/analysis.rs similarity index 100% rename from voxygen/i18n/src/analysis.rs rename to client/i18n/src/analysis.rs diff --git a/voxygen/i18n/src/bin/i18n-check.rs b/client/i18n/src/bin/i18n-check.rs similarity index 100% rename from voxygen/i18n/src/bin/i18n-check.rs rename to client/i18n/src/bin/i18n-check.rs diff --git a/voxygen/i18n/src/bin/i18n-csv.rs b/client/i18n/src/bin/i18n-csv.rs similarity index 100% rename from voxygen/i18n/src/bin/i18n-csv.rs rename to client/i18n/src/bin/i18n-csv.rs diff --git a/voxygen/i18n/src/error.rs b/client/i18n/src/error.rs similarity index 100% rename from voxygen/i18n/src/error.rs rename to client/i18n/src/error.rs diff --git a/voxygen/i18n/src/lib.rs b/client/i18n/src/lib.rs similarity index 100% rename from voxygen/i18n/src/lib.rs rename to client/i18n/src/lib.rs diff --git a/voxygen/i18n/src/raw.rs b/client/i18n/src/raw.rs similarity index 100% rename from voxygen/i18n/src/raw.rs rename to client/i18n/src/raw.rs diff --git a/client/src/lib.rs b/client/src/lib.rs index 36cabc7386..c993a51360 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -2816,6 +2816,7 @@ impl Drop for Client { #[cfg(test)] mod tests { use super::*; + use client_i18n::LocalizationHandle; #[test] /// THIS TEST VERIFIES THE CONSTANT API. @@ -2845,7 +2846,7 @@ mod tests { password, |suggestion: &str| suggestion == auth_server, )); - let localisation = voxygen_i18n::LocalizationHandle::load_expect("en"); + let localisation = LocalizationHandle::load_expect("en"); let _ = veloren_client.map(|mut client| { //clock diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 04ce8e36df..d369d05583 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -49,7 +49,7 @@ common-systems = {package = "veloren-common-systems", path = "../common/systems" common-state = {package = "veloren-common-state", path = "../common/state"} anim = {package = "veloren-voxygen-anim", path = "anim"} -i18n = {package = "veloren-voxygen-i18n", path = "i18n"} +i18n = {package = "veloren-client-i18n", path = "../client/i18n"} i18n-helpers = {package = "veloren-voxygen-i18n-helpers", path = "i18n-helpers"} voxygen-egui = {package = "veloren-voxygen-egui", path = "egui", optional = true } diff --git a/voxygen/i18n-helpers/Cargo.toml b/voxygen/i18n-helpers/Cargo.toml index cb2f44ec1b..7126d15c74 100644 --- a/voxygen/i18n-helpers/Cargo.toml +++ b/voxygen/i18n-helpers/Cargo.toml @@ -8,6 +8,6 @@ version = "0.10.0" [dependencies] common-net = {package = "veloren-common-net", path = "../../common/net"} common = {package = "veloren-common", path = "../../common"} -i18n = {package = "veloren-voxygen-i18n", path = "../i18n"} +i18n = {package = "veloren-client-i18n", path = "../../client/i18n"} # Utility tracing = "0.1" \ No newline at end of file