diff src/lib/Chat.luan @ 74:64e35a92d163

add translation
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 28 Aug 2025 13:31:46 -0600
parents 44bec62c49e2
children
line wrap: on
line diff
--- a/src/lib/Chat.luan	Thu Aug 28 05:16:32 2025 -0600
+++ b/src/lib/Chat.luan	Thu Aug 28 13:31:46 2025 -0600
@@ -90,6 +90,7 @@
 			autoplay = chat.autoplay
 			is_private = chat.is_private
 			stt_prompt = chat.stt_prompt
+			language = chat.language
 		}
 	end
 
@@ -112,21 +113,25 @@
 	local function option(name,text)
 		local selected = name==chat.show_text and " selected" or ""
 %>
-						<option <%=name%><%=selected%>><%=text%></option>
+						<option value=<%=name%><%=selected%>><%=text%></option>
 <%
 	end
 
 	local function assistant_controls()
 		return `%>
+				<div trans=needed>Translating...</div>
 				<div controls>
 					<audio controls preload=none></audio>
-					<select>
+					<select onchange="showSelected(this)">
 <%
-						option("show_text","Show text")
+						option("hide_text","Hide text")
 			if chat.has_ruby then
 						option("hide_ruby","Hide pronunciation")
 			end
-						option("hide_text","Hide text")
+						option("show_text","Show text")
+			if chat.language ~= "en" then
+						option("show_trans","Show translation")
+			end
 %>
 					</select>
 				</div>