Consolidate shared UI, hardware transport, and translation tooling

This commit is contained in:
Storm Dragon committed 2026-11-16 20:07:56 -05:00
1 parent ed6951f4cd
commit 2c612de63b
61 files changed
+2417 -1573

No files matched your search

+30 -15
View File
@@ -23,7 +23,22 @@ import (
"unicode/utf8"
)
func (s *Session) Open() string { return s.messages.T(s.form.Title) + ". " + s.Describe() }
func (s *Session) Open() string { return s.messages.T(s.form.Title) + ". " + s.describeArrival() }
// describeArrival names a list when focus lands on it. Detailed forms speak
// only a list's row, which loses its label once the page has other controls.
func (s *Session) describeArrival() string {
speech := s.Describe()
if !s.form.Detailed || s.closed || s.focus < 0 {
return speech
}
tab := s.form.Tabs[s.tab]
control := tab.Controls[s.focus]
if control.Kind != List || control.Selected < 0 || len(tab.Controls) < 2 {
return speech
}
return s.messages.T(control.Label) + ". " + speech
}
func (s *Session) describe() string {
if s.closed {
@@ -50,45 +65,45 @@ func (s *Session) describe() string {
if control.Selected < 0 {
return label
}
return label + " " + s.list_labels(control)[control.Selected]
return label + " " + s.listLabels(control)[control.Selected]
case Grid:
return s.messages.Format("{0} grid. {1}", label, s.describe_grid(control))
return s.messages.Format("{0} grid. {1}", label, s.describeGrid(control))
case ComboBox:
return s.messages.Format("{0} combo box {1}", label, s.describe_choice(control))
return s.messages.Format("{0} combo box {1}", label, s.describeChoice(control))
case Button:
return s.messages.Format("{0} button", label)
}
return label
}
func (s *Session) describe_choice(control Control) string {
func (s *Session) describeChoice(control Control) string {
choice := control.Choices[control.Selected]
text := s.choice_label(choice)
text := s.choiceLabel(choice)
if choice.Unavailable != "" {
text += ". " + s.messages.T("unavailable") + ": " + choice.Unavailable
}
return text
}
func (s *Session) choice_label(choice Choice) string {
func (s *Session) choiceLabel(choice Choice) string {
if choice.Literal {
return choice.Label
}
return s.messages.T(choice.Label)
}
func (s *Session) focused_group() string {
func (s *Session) focusedGroup() string {
if s.focus < 0 {
return ""
}
return s.form.Tabs[s.tab].Controls[s.focus].Group
}
func (s *Session) describe_focus(previousGroup string) string {
if group := s.focused_group(); group != "" && group != previousGroup {
return s.messages.T(group) + ". " + s.Describe()
func (s *Session) describeFocus(previousGroup string) string {
if group := s.focusedGroup(); group != "" && group != previousGroup {
return s.messages.T(group) + ". " + s.describeArrival()
}
return s.Describe()
return s.describeArrival()
}
func (s *Session) Describe() string { return s.Presentation().Speech }
@@ -138,8 +153,8 @@ func (s *Session) Presentation() Result {
switch c.Kind {
case List:
if c.Selected >= 0 {
speech = s.list_labels(c)[c.Selected]
text = s.messages.Format("{0}: {1}, {2} of {3}", label, speech, strconv.Itoa(c.Selected+1), strconv.Itoa(len(s.list_labels(c))))
speech = s.listLabels(c)[c.Selected]
text = s.messages.Format("{0}: {1}, {2} of {3}", label, speech, strconv.Itoa(c.Selected+1), strconv.Itoa(len(s.listLabels(c))))
}
case CheckBox:
state := Mark("unchecked")
@@ -152,7 +167,7 @@ func (s *Session) Presentation() Result {
text = s.messages.Format("{0}, button", label)
speech = text
case Grid:
text = s.describe_grid(c)
text = s.describeGrid(c)
speech = text
}
}