22 lines
798 B
Go
22 lines
798 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package presentation
|
|
|
|
import "unicode"
|
|
|
|
// Phonetic_letter matches Python Fenrir's alphabet, including its capitalization.
|
|
// Other runes use the active punctuation profile's character naming instead.
|
|
func Phonetic_letter(char rune) string {
|
|
words := [...]string{"alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whisky", "x ray", "yankee", "zulu"}
|
|
upper := unicode.ToUpper(char)
|
|
if upper < 'A' || upper > 'Z' {
|
|
return ""
|
|
}
|
|
word := words[upper-'A']
|
|
if unicode.IsUpper(char) {
|
|
word = string(unicode.ToUpper(rune(word[0]))) + word[1:]
|
|
}
|
|
return word
|
|
}
|