Forms · SignaturePad: Sign here and Clear read i18n (English and zh-CN built in)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 19:05:31 -04:00
1 parent defbec006e
commit a6b1bb0929
2 files changed
+9 -2

No files matched your search

+5 -2
View File
@@ -9,6 +9,7 @@ use gpui::{
use crate::{
buttons::{Button, ButtonVariant},
i18n,
layout::seeded::use_seeded,
theme::{ActiveTheme, ControlSize, Radius, TextSize},
};
@@ -238,7 +239,9 @@ impl RenderOnce for SignaturePad {
.text_size(theme.text_size(TextSize::Sm))
.text_color(colors.fg_subtle)
.child("×")
.when(empty, |line| line.child("Sign here")),
.when(empty, |line| {
line.child(i18n::text(cx, "signature.here", &[]))
}),
)
.child(
canvas(
@@ -262,7 +265,7 @@ impl RenderOnce for SignaturePad {
.gap_1()
.child(pad)
.child(
Button::new((self.id, "clear"), "Clear")
Button::new((self.id, "clear"), i18n::text(cx, "signature.clear", &[]))
.size(ControlSize::Sm)
.variant(ButtonVariant::Ghost)
.disabled(empty)
+4
View File
@@ -65,6 +65,8 @@ const EN: &[(&str, &str)] = &[
("pagination.previous", "Previous page"),
("pagination.next", "Next page"),
("pagination.jump", "Go to"),
("signature.here", "Sign here"),
("signature.clear", "Clear"),
];
const ZH_CN: &[(&str, &str)] = &[
@@ -128,6 +130,8 @@ const ZH_CN: &[(&str, &str)] = &[
("pagination.previous", "上一页"),
("pagination.next", "下一页"),
("pagination.jump", "跳至"),
("signature.here", "在此签名"),
("signature.clear", "清除"),
];
/// Ely's own message for `key` in `locale`, English for a locale Ely does not ship; fails on an unknown key.