Skip to content

Commit 5184b2c

Browse files
committed
Use normal string for toggle switch labels
1 parent 30c8965 commit 5184b2c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

druid/src/widget/switch.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ use crate::piet::{
2121
use crate::theme;
2222
use crate::widget::Align;
2323
use crate::{
24-
BaseState, BoxConstraints, Env, Event, EventCtx, LayoutCtx, LocalizedString, PaintCtx,
25-
UpdateCtx, Widget,
24+
BaseState, BoxConstraints, Env, Event, EventCtx, LayoutCtx, PaintCtx, UpdateCtx, Widget,
2625
};
2726

2827
/// A switch that toggles a boolean.
@@ -55,12 +54,8 @@ impl Switch {
5554
let font_size = env.get(theme::TEXT_SIZE_NORMAL);
5655
let switch_height = env.get(theme::BORDERED_WIDGET_HEIGHT);
5756

58-
let label: LocalizedString<&str> = if *data {
59-
LocalizedString::new("On")
60-
} else {
61-
LocalizedString::new("Off")
62-
};
63-
let localized_label = label.localized_str().to_uppercase();
57+
// TODO: use LocalizedString
58+
let label = if *data { "ON" } else { "OFF" };
6459

6560
let font = paint_ctx
6661
.text()
@@ -70,7 +65,7 @@ impl Switch {
7065

7166
let text_layout = paint_ctx
7267
.text()
73-
.new_text_layout(&font, &localized_label)
68+
.new_text_layout(&font, label)
7469
.build()
7570
.unwrap();
7671

0 commit comments

Comments
 (0)