From 0792b531489a8a8e241d4714b536895fc9774be1 Mon Sep 17 00:00:00 2001 From: Buffett <1buffetts@gmail.com> Date: Wed, 19 Feb 2025 02:04:44 +0800 Subject: [PATCH 1/6] initial commit for i18n package support --- src/lib/components/Navbar.svelte | 8 + src/routes/+page.svelte | 310 +++++++++++++++---------------- 2 files changed, 162 insertions(+), 156 deletions(-) diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 5846411..df09d47 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -50,6 +50,14 @@ function setLanguage(lang: 'en' | 'zh') { language.set(lang); + console.log('set language to', lang); + console.log('current pathname:', window.location.pathname); + if (lang === 'zh' && !window.location.pathname.startsWith('/zh')) { + window.location.assign('/zh' + window.location.pathname + window.location.search); + } else if (lang === 'en' && window.location.pathname.startsWith('/zh')) { + console.log('goto', window.location.pathname.replace('/zh', '') + window.location.search); + window.location.assign(window.location.pathname.replace('/zh', '') + window.location.search); + } } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 8e76dfe..3cc3d68 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -3,124 +3,124 @@ import { Button, Card } from 'flowbite-svelte'; import { ArrowRight, Mic, Brain, GraduationCap, Github } from 'lucide-svelte'; import { onMount } from 'svelte'; - import { language } from '$lib/stores/language'; // Import the global language store + //import { language } from '$lib/stores/language'; // Import the global language store let title = $state('Hinagiku'); let highlight = $state(0); - let lang = language; // Use the global language store directly + //let lang = language; // Use the global language store directly - const translations = { - en: { - transcript: 'Real-time Transcription', - Itanalysis: 'Intelligent Analysis', - educational: 'Educational Focus', - tr_details: - 'Capture every valuable insight from your discussions with our advanced speech-to-text technology.', - ia_details: - 'Get AI-powered insights and suggestions to improve discussion quality and participation.', - ef_details: - 'Purpose-built for educational environments with features that support meaningful learning.', - Ai_describe: - 'Our AI-powered system emphasizes student-led discussions while providing structured guidance, making it easier for teachers to direct learning and analyze outcomes.', - intro: - 'Hinagiku helps educators facilitate more engaging and productive discussions through real-time transcription and intelligent analysis.', - welcome: 'Welcome to Hinagiku!', - profile: 'Profile', - dashboard: 'Go to Dashboard', - signOut: 'Sign out', - login: 'Login', - started: 'Get Started', - learn: 'Learn More', - whyChoose: 'Why Choose Hinagiku?', - whyChooseDesc: - 'Our platform combines cutting-edge technology with educational expertise to enhance learning outcomes.', - howItWorks: 'How It Works', - howItWorksDesc: - 'Hinagiku enhances the Think-Pair-Share learning technique with AI assistance throughout the entire process.', - preparation: '1. Preparation', - preparationDesc: - 'Teachers create discussion templates and set up dynamic timelines for structured learning sessions.', - joinSession: '2. Join Session', - joinSessionDesc: - 'Students easily join discussions by scanning a session QR code, then form or join groups.', - discussion: '3. Discussion', - discussionDesc: - 'AI assists in guiding individual reflection, group discussions, and helps maintain focus on the topic.', - analysis: '4. Analysis', - analysisDesc: - 'Get visual summaries and insights from discussions to understand class perspectives and engagement.', - communityDriven: 'Community-Driven Templates', - communityDrivenDesc: - 'Access and share discussion templates with educators worldwide. Build upon proven discussion frameworks or contribute your own.', - browseTemplates: 'Browse public templates from experienced educators', - forkTemplates: 'Fork and customize existing templates for your needs', - shareTemplates: 'Share your successful discussion formats with the community', - collaborateTemplates: 'Collaborate with other educators to improve templates', - exploreTemplates: 'Explore Templates', - storyBehind: 'The Story Behind Our Name', - storyBehindDesc: - 'Hinagiku (雛菊), or Daisy in English, is an intelligent system designed to support discussions in educational environments.', - realTime: - "One of Hinagiku's key features is its real-time voice transcription and analysis, which helps hosts provide timely and insightful feedback, setting it apart from other educational tools.", - coreValues: - 'We chose the name Hinagiku because it reflects our core values: resilience, simplicity, and growth—much like the daisy flower itself, which flourishes in diverse conditions.', - mission: - 'Our mission is to help participants and hosts connect meaningfully by providing tools that facilitate better communication and collaboration in classrooms.', - openSource: 'Open Source', - openSourceDesc: - 'Hinagiku is open source and available on GitHub. We welcome contributions from the community!', - viewOnGitHub: 'View on GitHub' - }, - zh: { - transcript: '即時轉錄', - Itanalysis: '智慧分析', - educational: '教育焦點', - tr_details: '使用我們先進的語音轉文字技術捕獲討論中的每一個寶貴見解。', - ia_details: '獲取AI提供的見解和建議,以提高討論品質和參與度。', - ef_details: '專為教育環境而設計,具被助於有效學習的功能。', - Ai_describe: - '我們的AI系統強調學生主導的討論,同時提供結構化指導,使教師更容易引導學習並分析結果。', - intro: 'Hinagiku透過即時轉錄和智慧分析幫助教育工作者促進更具吸引力和生產力的討論。', - welcome: '歡迎來到Hinagiku!', - profile: '個人资料', - dashboard: '儀表板', - signOut: '登出', - login: '登入', - started: '開始使用', - learn: '了解更多', - whyChoose: '為什麼選擇Hinagiku?', - whyChooseDesc: '我們的平台結合了尖端技術和教育專業知識,以提高學習成果。', - howItWorks: '它是如何工作的', - howItWorksDesc: 'Hinagiku在整個過程中通過AI輔助增強了Think-Pair-Share學習技術。', - preparation: '1. 準備', - preparationDesc: '教師創建討論模板並設置動態時間表以進行結構化學習會話。', - joinSession: '2. 加入會話', - joinSessionDesc: '學生通過掃描會話QRcode輕鬆加入討論,然後組建或加入小組。', - discussion: '3. 討論', - discussionDesc: 'AI協助指導個人反思、小組討論,並幫助保持對主題的關注。', - analysis: '4. 分析', - analysisDesc: '從討論中獲取視覺摘要和見解,以了解班級的觀點和參與度。', - communityDriven: '社區驅動的模板', - communityDrivenDesc: - '訪問並分享來自全球教育工作者的討論模板。在經過驗證的討論框架上進行構建或貢獻您自己的模板。', - browseTemplates: '瀏覽來自經驗豐富的教育工作者的公共模板', - forkTemplates: '分叉並自定義現有模板以滿足您的需求', - shareTemplates: '與社區分享您成功的討論格式', - collaborateTemplates: '與其他教育工作者合作改進模板', - exploreTemplates: '探索模板', - storyBehind: '我們名字背後的故事', - storyBehindDesc: - 'Hinagiku(雛菊),或英文中的Daisy,是一個旨在支持教育環境中討論的智能系統。', - realTime: - 'Hinagiku的一個關鍵功能是其實時語音轉錄和分析,這有助於主持人提供及時和有見地的反饋,使其與其他教育工具區分開來。', - coreValues: - '我們選擇Hinagiku這個名字是因為它反映了我們的核心價值觀:韌性、簡單和成長——就像雛菊花一樣,在不同的條件下茁壯成長。', - mission: '我們的使命是通過提供促進更好溝通和協作的工具,幫助參與者和主持人有意義地聯繫。', - openSource: '開源', - openSourceDesc: 'Hinagiku是開源的,並在GitHub上可用。我們歡迎社區的貢獻!', - viewOnGitHub: '在GitHub上查看' - } - }; + // const translations = { + // en: { + // transcript: 'Real-time Transcription', + // Itanalysis: 'Intelligent Analysis', + // educational: 'Educational Focus', + // tr_details: + // 'Capture every valuable insight from your discussions with our advanced speech-to-text technology.', + // ia_details: + // 'Get AI-powered insights and suggestions to improve discussion quality and participation.', + // ef_details: + // 'Purpose-built for educational environments with features that support meaningful learning.', + // Ai_describe: + // 'Our AI-powered system emphasizes student-led discussions while providing structured guidance, making it easier for teachers to direct learning and analyze outcomes.', + // intro: + // 'Hinagiku helps educators facilitate more engaging and productive discussions through real-time transcription and intelligent analysis.', + // welcome: 'Welcome to Hinagiku!', + // profile: 'Profile', + // dashboard: 'Go to Dashboard', + // signOut: 'Sign out', + // login: 'Login', + // started: 'Get Started', + // learn: 'Learn More', + // whyChoose: 'Why Choose Hinagiku?', + // whyChooseDesc: + // 'Our platform combines cutting-edge technology with educational expertise to enhance learning outcomes.', + // howItWorks: 'How It Works', + // howItWorksDesc: + // 'Hinagiku enhances the Think-Pair-Share learning technique with AI assistance throughout the entire process.', + // preparation: '1. Preparation', + // preparationDesc: + // 'Teachers create discussion templates and set up dynamic timelines for structured learning sessions.', + // joinSession: '2. Join Session', + // joinSessionDesc: + // 'Students easily join discussions by scanning a session QR code, then form or join groups.', + // discussion: '3. Discussion', + // discussionDesc: + // 'AI assists in guiding individual reflection, group discussions, and helps maintain focus on the topic.', + // analysis: '4. Analysis', + // analysisDesc: + // 'Get visual summaries and insights from discussions to understand class perspectives and engagement.', + // communityDriven: 'Community-Driven Templates', + // communityDrivenDesc: + // 'Access and share discussion templates with educators worldwide. Build upon proven discussion frameworks or contribute your own.', + // browseTemplates: 'Browse public templates from experienced educators', + // forkTemplates: 'Fork and customize existing templates for your needs', + // shareTemplates: 'Share your successful discussion formats with the community', + // collaborateTemplates: 'Collaborate with other educators to improve templates', + // exploreTemplates: 'Explore Templates', + // storyBehind: 'The Story Behind Our Name', + // storyBehindDesc: + // 'Hinagiku (雛菊), or Daisy in English, is an intelligent system designed to support discussions in educational environments.', + // realTime: + // "One of Hinagiku's key features is its real-time voice transcription and analysis, which helps hosts provide timely and insightful feedback, setting it apart from other educational tools.", + // coreValues: + // 'We chose the name Hinagiku because it reflects our core values: resilience, simplicity, and growth—much like the daisy flower itself, which flourishes in diverse conditions.', + // mission: + // 'Our mission is to help participants and hosts connect meaningfully by providing tools that facilitate better communication and collaboration in classrooms.', + // openSource: 'Open Source', + // openSourceDesc: + // 'Hinagiku is open source and available on GitHub. We welcome contributions from the community!', + // viewOnGitHub: 'View on GitHub' + // }, + // zh: { + // transcript: '即時轉錄', + // Itanalysis: '智慧分析', + // educational: '教育焦點', + // tr_details: '使用我們先進的語音轉文字技術捕獲討論中的每一個寶貴見解。', + // ia_details: '獲取AI提供的見解和建議,以提高討論品質和參與度。', + // ef_details: '專為教育環境而設計,具被助於有效學習的功能。', + // Ai_describe: + // '我們的AI系統強調學生主導的討論,同時提供結構化指導,使教師更容易引導學習並分析結果。', + // intro: 'Hinagiku透過即時轉錄和智慧分析幫助教育工作者促進更具吸引力和生產力的討論。', + // welcome: '歡迎來到Hinagiku!', + // profile: '個人资料', + // dashboard: '儀表板', + // signOut: '登出', + // login: '登入', + // started: '開始使用', + // learn: '了解更多', + // whyChoose: '為什麼選擇Hinagiku?', + // whyChooseDesc: '我們的平台結合了尖端技術和教育專業知識,以提高學習成果。', + // howItWorks: '它是如何工作的', + // howItWorksDesc: 'Hinagiku在整個過程中通過AI輔助增強了Think-Pair-Share學習技術。', + // preparation: '1. 準備', + // preparationDesc: '教師創建討論模板並設置動態時間表以進行結構化學習會話。', + // joinSession: '2. 加入會話', + // joinSessionDesc: '學生通過掃描會話QRcode輕鬆加入討論,然後組建或加入小組。', + // discussion: '3. 討論', + // discussionDesc: 'AI協助指導個人反思、小組討論,並幫助保持對主題的關注。', + // analysis: '4. 分析', + // analysisDesc: '從討論中獲取視覺摘要和見解,以了解班級的觀點和參與度。', + // communityDriven: '社區驅動的模板', + // communityDrivenDesc: + // '訪問並分享來自全球教育工作者的討論模板。在經過驗證的討論框架上進行構建或貢獻您自己的模板。', + // browseTemplates: '瀏覽來自經驗豐富的教育工作者的公共模板', + // forkTemplates: '分叉並自定義現有模板以滿足您的需求', + // shareTemplates: '與社區分享您成功的討論格式', + // collaborateTemplates: '與其他教育工作者合作改進模板', + // exploreTemplates: '探索模板', + // storyBehind: '我們名字背後的故事', + // storyBehindDesc: + // 'Hinagiku(雛菊),或英文中的Daisy,是一個旨在支持教育環境中討論的智能系統。', + // realTime: + // 'Hinagiku的一個關鍵功能是其實時語音轉錄和分析,這有助於主持人提供及時和有見地的反饋,使其與其他教育工具區分開來。', + // coreValues: + // '我們選擇Hinagiku這個名字是因為它反映了我們的核心價值觀:韌性、簡單和成長——就像雛菊花一樣,在不同的條件下茁壯成長。', + // mission: '我們的使命是通過提供促進更好溝通和協作的工具,幫助參與者和主持人有意義地聯繫。', + // openSource: '開源', + // openSourceDesc: 'Hinagiku是開源的,並在GitHub上可用。我們歡迎社區的貢獻!', + // viewOnGitHub: '在GitHub上查看' + // } + // }; onMount(() => { const interval = setInterval(() => { @@ -134,8 +134,8 @@ return () => clearInterval(interval); }); //for i18n support - // import * as m from '$lib/paraglide/messages.js' - // import { languageTag } from '$lib/paraglide/runtime.js' + import * as m from '$lib/paraglide/messages.js'; + //import { languageTag } from '$lib/paraglide/runtime.js' @@ -161,20 +161,20 @@

- {translations[$lang].intro} + {m.intro()}

{#if $user} {:else} - + {/if}
@@ -189,9 +189,9 @@
-

{translations[$lang].whyChoose}

+

{m.whyChoose()}

- {translations[$lang].whyChooseDesc} + {m.whyChooseDesc()}

@@ -202,9 +202,9 @@
-

{translations[$lang].transcript}

+

{m.transcript()}

- {translations[$lang].tr_details} + {m.tr_details()}

@@ -214,9 +214,9 @@ -

{translations[$lang].Itanalysis}

+

{m.Itanalysis()}

- {translations[$lang].ia_details} + {m.ia_details()}

@@ -226,9 +226,9 @@ -

{translations[$lang].educational}

+

{m.educational()}

- {translations[$lang].ef_details} + {m.ef_details()}

@@ -239,45 +239,45 @@
-

{translations[$lang].howItWorks}

+

{m.howItWorks()}

- {translations[$lang].howItWorksDesc} + {m.howItWorksDesc()}

-

{translations[$lang].preparation}

+

{m.preparation()}

- {translations[$lang].preparationDesc} + {m.preparationDesc()}

-

{translations[$lang].joinSession}

+

{m.joinSession()}

- {translations[$lang].joinSessionDesc} + {m.joinSessionDesc()}

-

{translations[$lang].discussion}

+

{m.discussion()}

- {translations[$lang].discussionDesc} + {m.discussionDesc()}

-

{translations[$lang].analysis}

+

{m.analysis()}

- {translations[$lang].analysisDesc} + {m.analysisDesc()}

- {translations[$lang].Ai_describe} + {m.Ai_describe()}

@@ -289,21 +289,21 @@

- {translations[$lang].communityDriven} + {m.communityDriven()}

- {translations[$lang].communityDrivenDesc} + {m.communityDrivenDesc()}

    -
  • {translations[$lang].browseTemplates}
  • -
  • {translations[$lang].forkTemplates}
  • -
  • {translations[$lang].shareTemplates}
  • -
  • {translations[$lang].collaborateTemplates}
  • +
  • {m.browseTemplates()}
  • +
  • {m.forkTemplates()}
  • +
  • {m.shareTemplates()}
  • +
  • {m.collaborateTemplates()}
@@ -332,21 +332,19 @@ />
-

{translations[$lang].storyBehind}

+

{m.storyBehind()}

- Hinagiku (雛菊), {translations[ - $lang - ].storyBehindDesc} + Hinagiku (雛菊), {m.storyBehindDesc()}

- {translations[$lang].realTime} + {m.realTime()}

- {translations[$lang].coreValues} + {m.coreValues()}

- {translations[$lang].mission} + {m.mission()}

@@ -358,9 +356,9 @@
-

{translations[$lang].openSource}

+

{m.openSource()}

- {translations[$lang].openSourceDesc} + {m.openSourceDesc()}

From f562a4c1a34e1d25d1e8eed4086ed1bc3b10d9ee Mon Sep 17 00:00:00 2001 From: Buffett <1buffetts@gmail.com> Date: Wed, 19 Feb 2025 15:18:59 +0800 Subject: [PATCH 2/6] fix: language switcher in navbar --- src/lib/components/Navbar.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index df09d47..1ca3f4d 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -55,8 +55,8 @@ if (lang === 'zh' && !window.location.pathname.startsWith('/zh')) { window.location.assign('/zh' + window.location.pathname + window.location.search); } else if (lang === 'en' && window.location.pathname.startsWith('/zh')) { - console.log('goto', window.location.pathname.replace('/zh', '') + window.location.search); - window.location.assign(window.location.pathname.replace('/zh', '') + window.location.search); + console.log('gotoen', window.location.pathname.replace('/zh', '')); + window.location.assign(window.location.pathname.replace('zh', '') + window.location.search); } } From 400ff3fe749ba49190ade3c151f3cf81be0c7bc5 Mon Sep 17 00:00:00 2001 From: Buffett <1buffetts@gmail.com> Date: Thu, 20 Feb 2025 12:09:10 +0800 Subject: [PATCH 3/6] add i18n support for 7 components and 2 pages --- messages/en.json | 71 +++++++- messages/zh.json | 72 +++++++- src/lib/components/Chatroom.svelte | 33 +--- src/lib/components/Navbar.svelte | 28 +--- src/lib/components/QrScanner.svelte | 36 +--- src/lib/components/SessionCard.svelte | 19 +-- src/lib/components/session/HostView.svelte | 101 ++---------- .../components/session/ParticipantView.svelte | 155 ++++-------------- .../components/session/StageProgress.svelte | 22 +-- src/routes/+page.svelte | 119 +------------- src/routes/session/[id]/+page.svelte | 13 +- 11 files changed, 220 insertions(+), 449 deletions(-) diff --git a/messages/en.json b/messages/en.json index 587a02a..d779d66 100644 --- a/messages/en.json +++ b/messages/en.json @@ -40,5 +40,74 @@ "coreValues": "We chose the name Hinagiku because it reflects our core values: resilience, simplicity, and growth—much like the daisy flower itself, which flourishes in diverse conditions.", "mission": "Our mission is to help participants and hosts connect meaningfully by providing tools that facilitate better communication and collaboration in classrooms.", "openSource": "Open Source", - "openSourceDesc": "Hinagiku is open source and available on GitHub. We welcome contributions from the community!" + "openSourceDesc": "Hinagiku is open source and available on GitHub. We welcome contributions from the community!", + "confirmEndGroup": "Entering the Ended Stage is irreversible. Are you sure you want to proceed?", + "confirm": "Confirm", + "cancel": "Cancel", + "confirmEndSummarize": "Are you sure you want to confirm the group summary?", + "finishgroup": "Finish Group Discussion", + "groupInfo": "Group Information", + "groupManagement": "Group Management", + "createNewGroup": "Create New Group", + "jointGroup": "Join Group", + "waitStart": "Waiting for session to start...", + "end": "Please wait for the host to end the session.", + "status": "Session Status", + "individual": "Work on your individual contributions", + "beforeGroup": "Get ready to collaborate with your group.", + "group": "Collaborate with your group members.", + "ended": "Ended", + "member": "Members: ", + "groupNum": "Group Number", + "notInGroup": "You are not in a group yet.", + "leaveGroup": "Leave Group", + "hostBeginShortly": "The host will begin the session shortly.", + "unknownUser": "Unknown User", + "loadingProfile": "Loading...", + "you": "You", + "leader": " (Leader)", + "creatingGroup": "Creating...", + "joinExistingGroup": "Join Existing Group", + "enterGroupNumber": "Enter group number (1-50)", + "successCreateGroup": "Group created successfully", + "failedCreateGroup": "Failed to create group", + "successJoinGroup": "Joined group successfully", + "failedJoinGroup": "Failed to join group", + "successLeaveGroup": "Successfully left group", + "failedLeaveGroup": "Failed to leave group", + "invalidGroupNumber": "Please enter a valid group number (1-50)", + "placeholder": "Type your message...(max 500 characters)", + "send": "Send", + "record": "Record", + "stop": "Stop", + "thinking": "Thinking", + "waiting": "Waiting", + "confirmEndStage": "Entering the Ended Stage is irreversible. Are you sure you want to proceed?", + "stopCamera": "Stop Camera", + "startCamera": "Start Camera", + "uploadQrImage": "Upload QR Code Image", + "errorScanning": "error during scanning: ", + "errorStartingCamera": "error during starting camera: ", + "errorScanningFile": "error during scanning file: ", + "unableToFindQr": "Unable to find QR code in the image. Please ensure the image is clear and contains a valid QR code.", + "hosteBy": "Hosted by", + "viewSession": "View Session", + "joinSessionHost": "Join Session", + "joinSessionDescHost": "Please scan the QR code or enter the code to join the session.", + "showCode": "Show Code", + "showCodeDesc": "Show a 6-digit code for participants to join the session.", + "finalSummary": "Final Summary", + "mainTask": "Main Task", + "subtasks": "Subtasks:", + "resources": "Resources", + "noResources": "No resources available", + "waitingForParticipants": "Waiting for participants to join groups...", + "noParticipants": "No participants", + "removeParticipant": "Remove participant", + "openChatHistory": "Open chat history", + "openGroupChatHistory": "Open group chat history", + "warningInappropriate": "Warning: inappropriate content detected.", + "warningOffTopic": "Warning: many off-topic messages.", + "hostedBy": "Hosted by", + "sessionLabels": "Session Labels" } diff --git a/messages/zh.json b/messages/zh.json index 4523330..894e999 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -41,5 +41,75 @@ "mission": "我們的使命是通過提供促進更好溝通和協作的工具,幫助參與者和主持人有意義地聯繫。", "openSource": "開源", "openSourceDesc": "Hinagiku是開源的,並在GitHub上可用。我們歡迎社區的貢獻!", - "viewOnGitHub": "在GitHub上查看" + "viewOnGitHub": "在GitHub上查看", + "confirmEndGroup": "進入 Ended Stage 將無法返回,確定要繼續嗎?", + "confirm": "確定", + "cancel": "取消", + "finishgroup": "結束群組討論", + "confirmEndSummarize": "確定要確認群組總結嗎?", + "groupInfo": "群組資訊", + "groupManagement": "群組管理", + "createNewGroup": "建立新群組", + "jointGroup": "加入群組", + "waitStart": "等待會議開始...", + "end": "請等待主持人結束會議。", + "status": "會議狀態", + "individual": "進行個人觀念發想", + "beforeGroup": "準備好與您的小組合作", + "group": "與您的小組成員合作討論", + "ended": "已結束", + "member": "成員:", + "groupNum": "小組編號", + "notInGroup": "您還沒有加入任何群組。", + "leaveGroup": "退出群組", + "hostBeginShortly": "主持人即將開始會議。", + "unknownUser": "未知使用者", + "loadingProfile": "載入中...", + "you": "您", + "leader": "(組長)", + "creatingGroup": "正在建立...", + "joinExistingGroup": "加入現有群組", + "enterGroupNumber": "請輸入群組編號 (1-50)", + "successCreateGroup": "成功建立群組", + "failedCreateGroup": "無法建立群組", + "successJoinGroup": "成功加入群組", + "failedJoinGroup": "無法加入群組", + "successLeaveGroup": "成功退出群組", + "failedLeaveGroup": "無法退出群組", + "invalidGroupNumber": "請輸入有效的群組編號 (1-50)", + "placeholder": "手動輸入文字...(最多500個字元)", + "send": "送出", + "record": "錄音", + "waiting": "等待中", + "stop": "停止", + "thinking": "正在思考", + "confirmEndStage": "進入總結階段將無法返回,確定要繼續嗎?", + "confirmEnd": "確定", + "stopCamera": "停止相機", + "startCamera": "啟動相機", + "uploadQrImage": "上傳QRcode圖片", + "errorScanning": "掃描過程中出錯:", + "errorStartingCamera": "啟動相機過程中出錯:", + "errorScanningFile": "掃描文件過程中出錯:", + "unableToFindQr": "無法在圖像中找到QRcode。請確保圖像清晰並包含有效的QRcode。", + "hosteBy": "主持人:", + "viewSession": "查看會話", + "joinSessionHost": "加入會話", + "joinSessionDescHost": "請掃描QRcode或輸入代碼以加入會話。", + "showCode": "顯示代碼", + "showCodeDesc": "顯示一個6位數的代碼供參與者加入會話。", + "finalSummary": "最終總結", + "mainTask": "主要任務", + "subtasks": "子任務:", + "resources": "資源", + "noResources": "沒有可用資源", + "waitingForParticipants": "等待參與者加入小組...", + "noParticipants": "沒有參與者", + "removeParticipant": "移除參與者", + "openChatHistory": "打開聊天記錄", + "openGroupChatHistory": "打開小組聊天記錄", + "warningInappropriate": "警告:檢測到不適當內容。", + "warningOffTopic": "警告:許多離題訊息。", + "hostedBy": "主持人:", + "sessionLabels": "會話標籤" } diff --git a/src/lib/components/Chatroom.svelte b/src/lib/components/Chatroom.svelte index b8b83de..8019e42 100644 --- a/src/lib/components/Chatroom.svelte +++ b/src/lib/components/Chatroom.svelte @@ -3,7 +3,7 @@ import { Mic, Send, Square } from 'lucide-svelte'; // Added Square icon import import AudioPlayer from './AudioPlayer.svelte'; import { renderMarkdown } from '$lib/utils/renderMarkdown'; - import { language } from '$lib/stores/language'; // Import the global language store + import * as m from '$lib/paraglide/messages.js'; interface Conversation { name: string; @@ -36,25 +36,6 @@ let messagesContainer: HTMLDivElement; let dots = $state('...'); - const translations = { - en: { - placeholder: 'Type your message...(max 500 characters)', - send: 'Send', - record: 'Record', - waiting: 'Waiting', - stop: 'Stop', - thinking: 'Thinking' - }, - zh: { - placeholder: '手動輸入文字...(最多500個字元)', - send: '送出', - record: '錄音', - waiting: '等待', - stop: '停止', - thinking: '正在思考' - } - }; - function scrollToBottom() { if (!messagesContainer || !autoscroll) return; @@ -167,7 +148,7 @@

- {#await renderMarkdown(`${translations[$language].thinking}${dots}`)} + {#await renderMarkdown(`${m.thinking()}${dots}`)} Loading ... {:then content} @@ -187,7 +168,7 @@