Skip to content

Commit

Permalink
Merge pull request #236 from hydra/add-localization-support-2
Browse files Browse the repository at this point in the history
Localization - Add window title to the example.
  • Loading branch information
ecton authored Jan 10, 2025
2 parents 9881355 + 4e94b7a commit bc85af4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/assets/localizations/en-GB/hello.ftl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/assets/localizations/en-US/hello.ftl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/assets/localizations/es-ES/hello.ftl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 6 additions & 2 deletions examples/localization.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cushy::localization::Localization;
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;

Expand Down Expand Up @@ -129,7 +130,10 @@ fn main(app: &mut PendingApp) -> cushy::Result {
);
}

localization().into_window().open(app)?;
localization()
.into_window()
.titled(localize!("window-title"))
.open(app)?;

Ok(())
}
Expand Down

0 comments on commit bc85af4

Please sign in to comment.