/usr/share/svxlink/events.d/locale.tcl is in svxlink-server 14.08.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ###############################################################################
#
# Locale specific functions for playing back time, numbers and spelling words.
# Often, the functions in this file are the only ones that have to be
# reimplemented for a new language pack.
#
###############################################################################
#
# Spell the specified word using a phonetic alphabet
#
proc spellWord {word} {
set word [string tolower $word];
for {set i 0} {$i < [string length $word]} {set i [expr $i + 1]} {
set char [string index $word $i];
if {$char == "*"} {
playMsg "Default" "star";
} elseif {$char == "/"} {
playMsg "Default" "slash";
} elseif {$char == "-"} {
playMsg "Default" "dash";
} elseif {[regexp {[a-z0-9]} $char]} {
playMsg "Default" "phonetic_$char";
}
}
}
#
# Spell the specified number digit for digit
#
proc spellNumber {number} {
for {set i 0} {$i < [string length $number]} {set i [expr $i + 1]} {
set ch [string index $number $i];
if {$ch == "."} {
playMsg "Default" "decimal";
} else {
playMsg "Default" "$ch";
}
}
}
#
# Say the specified two digit number (00 - 99)
#
proc playTwoDigitNumber {number} {
if {[string length $number] != 2} {
puts "*** WARNING: Function playTwoDigitNumber received a non two digit number: $number";
return;
}
set first [string index $number 0];
if {($first == "0") || ($first == "O")} {
playMsg "Default" $first;
playMsg "Default" [string index $number 1];
} elseif {$first == "1"} {
playMsg "Default" $number;
} elseif {[string index $number 1] == "0"} {
playMsg "Default" $number;
} else {
playMsg "Default" "[string index $number 0]X";
playMsg "Default" "[string index $number 1]";
}
}
#
# Say the specified three digit number (000 - 999)
#
proc playThreeDigitNumber {number} {
if {[string length $number] != 3} {
puts "*** WARNING: Function playThreeDigitNumber received a non three digit number: $number";
return;
}
set first [string index $number 0];
if {($first == "0") || ($first == "O")} {
spellNumber $number
} else {
append first "00";
playMsg "Default" $first;
if {[string index $number 1] != "0"} {
playMsg "Default" "and"
playTwoDigitNumber [string range $number 1 2];
} elseif {[string index $number 2] != "0"} {
playMsg "Default" "and"
playMsg "Default" [string index $number 2];
}
}
}
#
# Say a number as intelligent as posible. Examples:
#
# 1 - one
# 24 - twentyfour
# 245 - twohundred and fourtyfive
# 1234 - twelve thirtyfour
# 12345 - onehundred and twentythree fourtyfive
# 136.5 - onehundred and thirtysix point five
#
proc playNumber {number} {
if {[regexp {(\d+)\.(\d+)?} $number -> integer fraction]} {
playNumber $integer;
playMsg "Default" "decimal";
spellNumber $fraction;
return;
}
while {[string length $number] > 0} {
set len [string length $number];
if {$len == 1} {
playMsg "Default" $number;
set number "";
} elseif {$len % 2 == 0} {
playTwoDigitNumber [string range $number 0 1];
set number [string range $number 2 end];
} else {
playThreeDigitNumber [string range $number 0 2];
set number [string range $number 3 end];
}
}
}
#
# Say the time specified by function arguments "hour" and "minute".
#
proc playTime {hour minute} {
# Strip white space and leading zeros. Check ranges.
if {[scan $hour "%d" hour] != 1 || $hour < 0 || $hour > 23} {
error "playTime: Non digit hour or value out of range: $hour"
}
if {[scan $minute "%d" minute] != 1 || $minute < 0 || $minute > 59} {
error "playTime: Non digit minute or value out of range: $hour"
}
if {$hour < 12} {
set ampm "AM";
if {$hour == 0} {
set hour 12;
}
} else {
set ampm "PM";
if {$hour > 12} {
set hour [expr $hour - 12];
}
};
playMsg "Default" [expr $hour];
if {$minute != 0} {
if {[string length $minute] == 1} {
set minute "O$minute";
}
playTwoDigitNumber $minute;
}
playSilence 100;
playMsg "Core" $ampm;
}
#
# This file has not been truncated
#
|