comparison src/lib/Chat.luan @ 74:64e35a92d163 default tip

add translation
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 28 Aug 2025 13:31:46 -0600
parents 44bec62c49e2
children
comparison
equal deleted inserted replaced
73:60ebb333b40c 74:64e35a92d163
88 name = chat.name 88 name = chat.name
89 show_text = chat.show_text 89 show_text = chat.show_text
90 autoplay = chat.autoplay 90 autoplay = chat.autoplay
91 is_private = chat.is_private 91 is_private = chat.is_private
92 stt_prompt = chat.stt_prompt 92 stt_prompt = chat.stt_prompt
93 language = chat.language
93 } 94 }
94 end 95 end
95 96
96 function chat.name_html() 97 function chat.name_html()
97 return html_encode(chat.name) 98 return html_encode(chat.name)
110 end 111 end
111 112
112 local function option(name,text) 113 local function option(name,text)
113 local selected = name==chat.show_text and " selected" or "" 114 local selected = name==chat.show_text and " selected" or ""
114 %> 115 %>
115 <option <%=name%><%=selected%>><%=text%></option> 116 <option value=<%=name%><%=selected%>><%=text%></option>
116 <% 117 <%
117 end 118 end
118 119
119 local function assistant_controls() 120 local function assistant_controls()
120 return `%> 121 return `%>
122 <div trans=needed>Translating...</div>
121 <div controls> 123 <div controls>
122 <audio controls preload=none></audio> 124 <audio controls preload=none></audio>
123 <select> 125 <select onchange="showSelected(this)">
124 <% 126 <%
125 option("show_text","Show text") 127 option("hide_text","Hide text")
126 if chat.has_ruby then 128 if chat.has_ruby then
127 option("hide_ruby","Hide pronunciation") 129 option("hide_ruby","Hide pronunciation")
128 end 130 end
129 option("hide_text","Hide text") 131 option("show_text","Show text")
132 if chat.language ~= "en" then
133 option("show_trans","Show translation")
134 end
130 %> 135 %>
131 </select> 136 </select>
132 </div> 137 </div>
133 <% ` 138 <% `
134 end 139 end