36 lines
977 B
Go
36 lines
977 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package app
|
|
|
|
import (
|
|
"unicode"
|
|
|
|
"git.stormux.org/storm/fenrir/internal/i18n"
|
|
"git.stormux.org/storm/fenrir/internal/presentation"
|
|
)
|
|
|
|
func (s *echoSpeaker) say_spelling(spelling presentation.Spelling) {
|
|
for _, char := range spelling.Text {
|
|
if !spelling.Phonetic {
|
|
s.say_character(char)
|
|
continue
|
|
}
|
|
text := presentation.Phonetic_letter(char)
|
|
if text == "" {
|
|
text = presentation.Character(char)
|
|
if s.punctuation != nil {
|
|
text = s.punctuation.Character(char)
|
|
}
|
|
}
|
|
if unicode.IsUpper(char) && s.settings != nil && s.settings.Reading.SayCapForCapitals {
|
|
text = i18n.T("cap") + " " + text
|
|
}
|
|
// Phonetics bypass character capital beeps/pitch and text processing:
|
|
// names (including punctuation within names) must be spoken only once.
|
|
s.Speaker.Say(text)
|
|
}
|
|
// Copy-last-echo retains the complete source, not the last spelled rune.
|
|
s.last = spelling.Text
|
|
}
|