From faec0d8dcbb140734bbe21d9adb2f9de0faaa92f Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Fri, 3 Jan 2025 18:24:46 +0100 Subject: [PATCH 1/2] Localization - Add window title to the example. --- examples/assets/localizations/en-GB/hello.ftl | 1 + examples/assets/localizations/en-US/hello.ftl | 1 + examples/assets/localizations/es-ES/hello.ftl | 1 + examples/localization.rs | 7 +++++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/assets/localizations/en-GB/hello.ftl b/examples/assets/localizations/en-GB/hello.ftl index fb7589358..b87fb34ab 100644 --- a/examples/assets/localizations/en-GB/hello.ftl +++ b/examples/assets/localizations/en-GB/hello.ftl @@ -1,3 +1,4 @@ +window-title = Localization example message-hello-world = Hello, world! language-en-gb = English (Great Britain) language-en-us = English (United States) diff --git a/examples/assets/localizations/en-US/hello.ftl b/examples/assets/localizations/en-US/hello.ftl index 3d04a52a6..731ca5cfc 100644 --- a/examples/assets/localizations/en-US/hello.ftl +++ b/examples/assets/localizations/en-US/hello.ftl @@ -1,3 +1,4 @@ +window-title = Localization example message-hello-world = Howdy, world! language-en-gb = English (Great Britain) language-en-us = English (United States) diff --git a/examples/assets/localizations/es-ES/hello.ftl b/examples/assets/localizations/es-ES/hello.ftl index 5315be567..7905094f8 100644 --- a/examples/assets/localizations/es-ES/hello.ftl +++ b/examples/assets/localizations/es-ES/hello.ftl @@ -1,3 +1,4 @@ +window-totle = Ejemplo de localización message-hello-world = ¡Hola, mundo! language-en-gb = Inglés (Gran Bretaña) language-en-us = Inglés (Estados Unidos) diff --git a/examples/localization.rs b/examples/localization.rs index a64cd0ebf..3dbe755d1 100644 --- a/examples/localization.rs +++ b/examples/localization.rs @@ -1,8 +1,9 @@ -use cushy::localization::Localization; +use cushy::localization::{Localization, Localize}; use cushy::value::{Dynamic, Source}; use cushy::widget::MakeWidget; use cushy::{localize, Open, PendingApp}; use unic_langid::LanguageIdentifier; +use cushy::widgets::Localized; fn localization() -> impl MakeWidget { // Create a widget showing `message-hello-world`, which we will place on the @@ -129,7 +130,9 @@ fn main(app: &mut PendingApp) -> cushy::Result { ); } - localization().into_window().open(app)?; + localization().into_window() + .titled(localize!("window-title")) + .open(app)?; Ok(()) } From 4e94b7a46eac58d341d9750a74209c5aadf6e499 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Fri, 10 Jan 2025 08:12:30 -0800 Subject: [PATCH 2/2] Running cargo fmt --- examples/localization.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/localization.rs b/examples/localization.rs index 3dbe755d1..63b69c40f 100644 --- a/examples/localization.rs +++ b/examples/localization.rs @@ -1,9 +1,9 @@ use cushy::localization::{Localization, Localize}; use cushy::value::{Dynamic, Source}; use cushy::widget::MakeWidget; +use cushy::widgets::Localized; use cushy::{localize, Open, PendingApp}; use unic_langid::LanguageIdentifier; -use cushy::widgets::Localized; fn localization() -> impl MakeWidget { // Create a widget showing `message-hello-world`, which we will place on the @@ -130,7 +130,8 @@ fn main(app: &mut PendingApp) -> cushy::Result { ); } - localization().into_window() + localization() + .into_window() .titled(localize!("window-title")) .open(app)?;