diff --git a/messages/en.json b/messages/en.json
index 587a02a..0db2f33 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -40,5 +40,138 @@
"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",
+ "welcomeDashboard": "Welcome to your dashboard",
+ "stats": "Statistics",
+ "recentActivity": "Recent Activity",
+ "createTemplate": "Create Template",
+ "createTemplateDesc": "Create a new discussion template",
+ "dashjoinSession": "Join Session",
+ "dashjoinSessionDesc": "Join an existing discussion session",
+ "editProfile": "Edit Profile",
+ "editProfileDesc": "Update your profile settings",
+ "publicTemplates": "Public Templates",
+ "viewAll": "View All",
+ "yourTemplates": "Your Templates",
+ "noTemplates": "No templates created yet",
+ "createFirstTemplate": "Create your first template to get started",
+ "createTemplateButton": "Create Your First Template",
+ "noSessions": "No sessions created yet",
+ "createSession": "Create a new session with template",
+ "JjoinSession": "Join Discussion Session",
+ "scanQr": "Scan the QR code provided by your session host to join the discussion.",
+ "enterCode": "Or please enter the 6-digits code to join.",
+ "joinButton": "Join Session",
+ "enterCodePlaceholder": "Enter code",
+ "back": "← Back to home",
+ "button": "Login",
+ "Llogin": "Sign in with your Google account to get started",
+ "profileSettings": "Profile Settings",
+ "updateInfo": "Update your personal information and preferences",
+ "successMessage": "Profile updated successfully!",
+ "errorMessage": "Cannot update profile. Please try again later.",
+ "displayName": "Display Name",
+ "title": "Title",
+ "titlePlaceholder": "e.g. Professor, Student, Teaching Assistant",
+ "bio": "Bio",
+ "bioPlaceholder": "Tell us about yourself",
+ "bioHelp": "Write a short bio to help others know more about you",
+ "Ttitle": "Title",
+ "TsaveChanges": "Save Changes",
+ "saving": "Saving...",
+ "typeMessage": "Type your message...",
+ "waitResponse": "Waiting for response...",
+ "PwaitingForParticipants": "Please wait for other participants...",
+ "editTemplate": "Edit Template",
+ "startSession": "Start Session",
+ "saveChanges": "Save changes before starting a session",
+ "startDiscussion": "Start a discussion session with this template",
+ "templateTitle": "Template title",
+ "mainTaskDesc": "Main task description",
+ "subtaskDesc": "Subtask description",
+ "addSubtask": "Add Subtask",
+ "makePublic": "Make template public",
+ "backToDashboard": "Back to Dashboard",
+ "unsavedChanges": "You have unsaved changes!",
+ "deleteTemplate": "Delete this Template",
+ "saveChangesButton": "Save Changes",
+ "allChangesSaved": "All changes saved",
+ "deleteConfirmation": "Are you sure you want to delete this template?",
+ "yesDelete": "Yes, delete it",
+ "noCancel": "No, cancel",
+ "loadingTemplate": "Loading template...",
+ "taskDescription": "Task Description",
+ "Tsubtasks": "Subtasks",
+ "Tpublic": "Public",
+ "Tprivate": "Private",
+ "lastUpdated": "Last Updated"
}
diff --git a/messages/zh.json b/messages/zh.json
index 4523330..0f8e26e 100644
--- a/messages/zh.json
+++ b/messages/zh.json
@@ -41,5 +41,142 @@
"mission": "我們的使命是通過提供促進更好溝通和協作的工具,幫助參與者和主持人有意義地聯繫。",
"openSource": "開源",
"openSourceDesc": "Hinagiku是開源的,並在GitHub上可用。我們歡迎社區的貢獻!",
- "viewOnGitHub": "在GitHub上查看"
+ "confirmEndGroup": "進入 Ended Stage 將無法返回,確定要繼續嗎?",
+ "confirm": "確定",
+ "cancel": "取消",
+ "confirmEndSummarize": "確定要確認群組總結嗎?",
+ "finishgroup": "結束群組討論",
+ "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": "錄音",
+ "stop": "停止",
+ "thinking": "正在思考",
+ "waiting": "等待中",
+ "confirmEndStage": "進入總結階段將無法返回,確定要繼續嗎?",
+ "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": "會話標籤",
+ "welcomeDashboard": "歡迎來到您的儀表板",
+ "stats": "統計數據",
+ "recentActivity": "最近活動",
+ "createTemplate": "創建模板",
+ "createTemplateDesc": "創建一個新的討論模板",
+ "dashjoinSession": "加入會話",
+ "dashjoinSessionDesc": "加入現有的討論會話",
+ "editProfile": "編輯個人資料",
+ "editProfileDesc": "更新您的個人資料設置",
+ "publicTemplates": "公開模板",
+ "viewAll": "查看全部",
+ "yourTemplates": "您的模板",
+ "noTemplates": "尚未創建模板",
+ "createFirstTemplate": "創建您的第一個模板以開始",
+ "createTemplateButton": "創建您的第一個模板",
+ "noSessions": "尚未創建會話",
+ "createSession": "使用模板創建新會話",
+ "JjoinSession": "加入討論會話",
+ "scanQr": "掃描會話主持人提供的QRcode加入討論。",
+ "enterCode": "或是輸入6位數代碼加入。",
+ "joinButton": "加入會話",
+ "enterCodePlaceholder": "輸入代碼",
+ "back": "← 返回首頁",
+ "button": "login",
+ "Llogin": "使用您的Google帳戶登入",
+ "profileSettings": "個人資料設定",
+ "updateInfo": "更新您的個人資料和偏好",
+ "successMessage": "個人資料更新成功!",
+ "errorMessage": "無法更新個人資料。請稍後再試。",
+ "displayName": "顯示名稱",
+ "title": "標題",
+ "titlePlaceholder": "例如:教授、學生、助教",
+ "bio": "簡介",
+ "bioPlaceholder": "介紹一下你自己",
+ "bioHelp": "寫一個簡短的簡介,幫助其他人更好地了解你",
+ "Ttitle": "職稱",
+ "TsaveChanges": "保存更改",
+ "saving": "保存中...",
+ "typeMessage": "輸入您的訊息...",
+ "waitResponse": "等待回應...",
+ "PwaitingForParticipants": "請等待其他參與者...",
+ "editTemplate": "編輯模板",
+ "startSession": "開始會話",
+ "saveChanges": "保存更改後再開始會話",
+ "startDiscussion": "使用此模板開始討論會話",
+ "templateTitle": "模板標題",
+ "mainTaskDesc": "主要任務描述",
+ "subtaskDesc": "子任務描述",
+ "addSubtask": "添加子任務",
+ "makePublic": "將模板設為公開",
+ "backToDashboard": "返回儀表板",
+ "unsavedChanges": "您有未保存的更改!",
+ "deleteTemplate": "刪除此模板",
+ "saveChangesButton": "保存更改",
+ "allChangesSaved": "所有更改已保存",
+ "deleteConfirmation": "您確定要刪除此模板嗎?",
+ "yesDelete": "是的,刪除它",
+ "noCancel": "不,取消",
+ "loadingTemplate": "載入模板...",
+ "taskDescription": "任務描述",
+ "Tsubtasks": "子任務",
+ "Tpublic": "公開",
+ "Tprivate": "私人",
+ "lastUpdated": "最後更新時間",
+ "viewOnGitHub": "在GitHub上查看",
+ "confirmEnd": "確定",
+ "dashboardTitle": "參與者狀態儀表板",
+ "loadingGroups": "載入群組...",
+ "noParticipantsInGroup": "此群組中沒有參與者"
}
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 @@
{/if}
- {recording
- ? operating
- ? translations[$language].waiting
- : translations[$language].stop
- : translations[$language].record}
+ {recording ? (operating ? m.waiting() : m.stop()) : m.record()}
- {translations[$language].send}
+ {m.send()}
diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte
index 5846411..4e13309 100644
--- a/src/lib/components/Navbar.svelte
+++ b/src/lib/components/Navbar.svelte
@@ -6,28 +6,12 @@
import { onMount } from 'svelte';
import { page } from '$app/state';
import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let hinagiku = $state('Hinagiku');
let highlight = $state(0);
let hydrated = $state(false);
- const translations = {
- en: {
- welcome: 'Welcome to Hinagiku!',
- profile: 'Profile',
- dashboard: 'Dashboard',
- signOut: 'Sign out',
- login: 'Login'
- },
- zh: {
- welcome: '歡迎來到 Hinagiku!',
- profile: '個人資料',
- dashboard: '儀表板',
- signOut: '登出',
- login: '登入'
- }
- };
-
import { derived } from 'svelte/store';
const flagSrc = derived(language, ($language) => {
@@ -50,12 +34,20 @@
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('gotoen', window.location.pathname.replace('/zh', ''));
+ window.location.assign(window.location.pathname.replace('/zh', '') + window.location.search);
+ }
}
-
+
{#each hinagiku as c, i}{$user.email}
- {translations[$language].profile}
+ {m.profile()}
- {translations[$language].dashboard}
+ {m.dashboard()}
signOut()} class="flex items-center">
- {translations[$language].signOut}
+ {m.signOut()}
{:else if !page.url.pathname.startsWith('/login')}
- {translations[$language].login}
+ {m.login()}
{/if}
diff --git a/src/lib/components/QrScanner.svelte b/src/lib/components/QrScanner.svelte
index f955058..ba2d33c 100644
--- a/src/lib/components/QrScanner.svelte
+++ b/src/lib/components/QrScanner.svelte
@@ -2,7 +2,7 @@
import { notifications } from '$lib/stores/notifications';
import { Html5Qrcode } from 'html5-qrcode';
import { onMount, onDestroy } from 'svelte';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let { onScan } = $props<{
onScan: (code: string) => void;
@@ -12,28 +12,6 @@
let scanning = $state(false);
let fileInput: HTMLInputElement;
- const translations = {
- en: {
- 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.'
- },
- zh: {
- stopCamera: '停止相機',
- startCamera: '啟動相機',
- uploadQrImage: '上傳QRcode圖片',
- errorScanning: '掃描過程中出錯:',
- errorStartingCamera: '啟動相機過程中出錯:',
- errorScanningFile: '掃描文件過程中出錯:',
- unableToFindQr: '無法在圖像中找到QRcode。請確保圖像清晰並包含有效的QRcode。'
- }
- };
-
onMount(() => {
scanner = new Html5Qrcode('qr-reader');
});
@@ -62,11 +40,11 @@
if ((err as unknown as Error).toString().includes('NotFoundException')) {
return;
}
- // notifications.error(`${translations[$language].errorScanning} ${err}`);
+ // notifications.error(`${m.errorScanning()} ${err}`);
}
);
} catch (err) {
- notifications.error(`${translations[$language].errorStartingCamera} ${err}`);
+ notifications.error(`${m.errorStartingCamera()} ${err}`);
scanning = false;
}
}
@@ -80,9 +58,9 @@
onScan(result);
} catch (err) {
if ((err as unknown as Error).toString().includes('NotFoundException')) {
- notifications.error(translations[$language].unableToFindQr);
+ notifications.error(m.unableToFindQr());
} else {
- notifications.error(`${translations[$language].errorScanningFile} ${err}`);
+ notifications.error(`${m.errorScanningFile()} ${err}`);
}
} finally {
fileInput.value = '';
@@ -99,7 +77,7 @@
onclick={scanning ? () => scanner.stop() : startCamera}
class="w-full rounded-lg border px-6 py-2 hover:bg-gray-50"
>
- {scanning ? translations[$language].stopCamera : translations[$language].startCamera}
+ {scanning ? m.stopCamera() : m.startCamera()}
@@ -115,7 +93,7 @@
for="qr-image-input"
class="block w-full cursor-pointer rounded-lg border px-6 py-2 text-center hover:bg-gray-50"
>
- {translations[$language].uploadQrImage}
+ {m.uploadQrImage()}
diff --git a/src/lib/components/SessionCard.svelte b/src/lib/components/SessionCard.svelte
index ac0cf6f..fb592c3 100644
--- a/src/lib/components/SessionCard.svelte
+++ b/src/lib/components/SessionCard.svelte
@@ -1,7 +1,7 @@
@@ -64,9 +53,7 @@
{#if host}
- {translations[$language].hostedBy}
+ {m.hostedBy()}
{/if}
@@ -74,7 +61,7 @@
{createdAt.toLocaleString()}
-
{translations[$language].viewSession}
+
{m.viewSession()}
diff --git a/src/lib/components/session/HostView.svelte b/src/lib/components/session/HostView.svelte
index 7123cc9..e9ee122 100644
--- a/src/lib/components/session/HostView.svelte
+++ b/src/lib/components/session/HostView.svelte
@@ -34,7 +34,7 @@
import MostActiveGroups from './MostActiveGroups.svelte';
import LabelManager from './LabelManager.svelte';
import ResolveUsername from '../ResolveUsername.svelte';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let { session }: { session: Readable } = $props();
let code = $state('');
@@ -81,45 +81,6 @@
let conversationsData = $state>([]);
let keywordData = $state>({});
- const translations = {
- en: {
- joinSession: 'Join Session',
- joinSessionDesc: '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.'
- },
- zh: {
- joinSession: '加入會話',
- joinSessionDesc: '請掃描QRcode或輸入代碼以加入會話。',
- showCode: '顯示代碼',
- showCodeDesc: '顯示一個6位數的代碼供參與者加入會話。',
- finalSummary: '最終總結',
- mainTask: '主要任務',
- subtasks: '子任務:',
- resources: '資源',
- noResources: '沒有可用資源',
- waitingForParticipants: '等待參與者加入小組...',
- noParticipants: '沒有參與者',
- removeParticipant: '移除參與者',
- openChatHistory: '打開聊天記錄',
- openGroupChatHistory: '打開小組聊天記錄',
- warningInappropriate: '警告:檢測到不適當內容。',
- warningOffTopic: '警告:許多離題訊息。'
- }
- };
-
onMount(() => {
const unsubscribes: (() => void)[] = [];
const initializeSession = async () => {
@@ -231,7 +192,6 @@
limit(1)
);
const codeDoc = (await getDocs(codeQuery)).docs[0];
- //console.log(codeDoc.data());
if (!codeDoc || Timestamp.now().toMillis() - codeDoc.data()?.createTime.toMillis() > 3600000) {
code = await genCode();
@@ -491,7 +451,6 @@
}
conversationsData = await response.json();
- console.log(conversationsData);
} catch (error) {
console.error('無法加載對話資料:', error);
notifications.error('無法加載對話資料');
@@ -555,10 +514,10 @@
{#if $session?.status && $session.status === 'preparing'}
- {$language === 'zh' ? translations.zh.joinSession : translations.en.joinSession}
+ {m.joinSessionHost()}
- {$language === 'zh' ? translations.zh.joinSessionDesc : translations.en.joinSessionDesc}
+ {m.joinSessionDescHost()}
{#if $session?.status === 'preparing'}
@@ -570,10 +529,10 @@
{#if code === '' || code === 'Loading...'}
- {$language === 'zh' ? translations.zh.showCode : translations.en.showCode}
+ {m.showCode()}
- {$language === 'zh' ? translations.zh.showCodeDesc : translations.en.showCodeDesc}
+ {m.showCodeDesc()}
{:else}
@@ -589,7 +548,7 @@
{#if $session?.status === 'ended'}
- {$language === 'zh' ? translations.zh.finalSummary : translations.en.finalSummary}
+ {m.finalSummary()}
@@ -614,11 +573,7 @@
>
Groups
{#if $groups.length === 0}
-
{$language === 'zh'
- ? translations.zh.waitingForParticipants
- : translations.en.waitingForParticipants}
+
{m.waitingForParticipants()}
{:else}
{#each [...$groups].sort((a, b) => a.number - b.number) as group}
@@ -631,18 +586,12 @@
>
Group #{group.number}
- {$language === 'zh'
- ? translations.zh.openGroupChatHistory
- : translations.en.openGroupChatHistory}
+ {m.openGroupChatHistory()}
{#if group.participants.length === 0}
- {$language === 'zh'
- ? translations.zh.noParticipants
- : translations.en.noParticipants}
+ {m.noParticipants()}
{:else}
@@ -660,11 +609,7 @@
>
- {$language === 'zh'
- ? translations.zh.openChatHistory
- : translations.en.openChatHistory}
+ {m.openChatHistory()}
{#if participantProgress.has(participant)}
@@ -706,17 +651,9 @@
{/if}
{#if warning.moderation}
- {$language === 'zh'
- ? translations.zh.warningInappropriate
- : translations.en.warningInappropriate}
+ {m.warningInappropriate()}
{:else if warning.offTopic >= 3}
- {$language === 'zh'
- ? translations.zh.warningOffTopic
- : translations.en.warningOffTopic}
+ {m.warningOffTopic()}
{/if}
{/if}
{/if}
@@ -729,11 +666,7 @@
>
- {$language === 'zh'
- ? translations.zh.removeParticipant
- : translations.en.removeParticipant}
+ {m.removeParticipant()}
{/each}
@@ -748,14 +681,14 @@
- {$language === 'zh' ? translations.zh.mainTask : translations.en.mainTask}
+ {m.mainTask()}
{$session?.task}
{#if $session?.subtasks.length > 0}
- {$language === 'zh' ? translations.zh.subtasks : translations.en.subtasks}
+ {m.subtasks()}
{#each $session?.subtasks as subtask}
@@ -769,11 +702,11 @@
- {$language === 'zh' ? translations.zh.resources : translations.en.resources}
+ {m.resources()}
{#if $session?.resources.length === 0}
- {$language === 'zh' ? translations.zh.noResources : translations.en.noResources}
+ {m.noResources()}
{:else}
diff --git a/src/lib/components/session/ParticipantView.svelte b/src/lib/components/session/ParticipantView.svelte
index 3cb25f1..a305449 100644
--- a/src/lib/components/session/ParticipantView.svelte
+++ b/src/lib/components/session/ParticipantView.svelte
@@ -19,7 +19,7 @@
import GroupSummary from '$lib/components/session/GroupSummary.svelte';
import { initFFmpeg, float32ArrayToWav, wav2mp3 } from '$lib/utils/wav2mp3';
import EndedView from '$lib/components/session/EndedView.svelte';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
interface ChatroomConversation {
name: string;
@@ -133,15 +133,15 @@
if (!response.ok) {
await response.json(); // ignore result
- notifications.error(translations[$language].failedCreateGroup);
+ notifications.error(m.failedCreateGroup());
return;
}
- notifications.success(translations[$language].successCreateGroup);
+ notifications.success(m.successCreateGroup());
creating = false;
} catch (error) {
console.error('Error creating group:', error);
- notifications.error(translations[$language].failedCreateGroup);
+ notifications.error(m.failedCreateGroup());
} finally {
isCreatingGroup = false;
}
@@ -149,9 +149,7 @@
async function handleJoinGroup() {
if (!groupNumber || !/^(?:[1-9]|[1-4][0-9]|50)$/.test(groupNumber)) {
- notifications.error(
- translations[$language].invalidGroupNumber || 'Please enter a valid group number (1-50)'
- );
+ notifications.error(m.invalidGroupNumber() || 'Please enter a valid group number (1-50)');
return;
}
@@ -162,15 +160,15 @@
if (!response.ok) {
await response.json(); // ignore result
- notifications.error(translations[$language].failedJoinGroup);
+ notifications.error(m.failedJoinGroup());
return;
}
- notifications.success(translations[$language].successJoinGroup);
+ notifications.success(m.successJoinGroup());
creating = false;
} catch (error) {
console.error('Error joining group:', error);
- notifications.error(translations[$language].failedJoinGroup);
+ notifications.error(m.failedJoinGroup());
}
}
@@ -514,95 +512,17 @@
if (!response.ok) {
await response.json();
- throw new Error(translations[$language].failedLeaveGroup);
+ throw new Error(m.failedLeaveGroup());
}
- notifications.success(translations[$language].successLeaveGroup);
+ notifications.success(m.successLeaveGroup());
groupDoc = null;
conversationDoc = null;
} catch (error) {
console.error('Error leaving group:', error);
- notifications.error(translations[$language].failedLeaveGroup);
+ notifications.error(m.failedLeaveGroup());
}
}
-
- const translations = {
- en: {
- 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)'
- },
- zh: {
- 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)'
- }
- };
@@ -612,15 +532,15 @@
{#if groupStatus === 'discussion'}
- {translations[$language].finishgroup}
+ {m.finishgroup()}
{:else if groupStatus === 'summarize'}
- {translations[$language].confirmEndSummarize}
+ {m.confirmEndSummarize()}
{:else if groupStatus === 'end'}
- {translations[$language].end}
+ {m.end()}
{/if}
{/if}
@@ -629,7 +549,7 @@
-
{translations[$language].status}
+
{m.status()}
@@ -647,18 +567,18 @@
{$session?.status}
{#if $session?.status === 'individual'}
-
{translations[$language].individual}
+
{m.individual()}
{:else if $session?.status === 'before-group'}
-
{translations[$language].beforeGroup}
+
{m.beforeGroup()}
{:else if $session?.status === 'group'}
-
{translations[$language].group}
+
{m.group()}
{/if}
-
{translations[$language].groupInfo}
+
{m.groupInfo()}
{#if groupDoc}
-
{translations[$language].member}
+
{m.member()}
{#each groupDoc.data.participants as participant, index}
{#if participant === user.uid}
- {translations[$language].you}{index === 0
- ? translations[$language].leader
- : ''}
+ {m.you()}{index === 0 ? m.leader() : ''}
{:else}
{#await getUser(participant)}
- {translations[$language].loadingProfile}
+ {m.loadingProfile()}
{:then profile}
- {profile.displayName}{index === 0 ? translations[$language].leader : ''}
+ {profile.displayName}{index === 0 ? m.leader() : ''}
{:catch}
- {translations[$language].unknownUser}
+ {m.unknownUser()}
{/await}
{/if}
@@ -702,7 +619,7 @@
onclick={() => groupDoc?.id && handleLeaveGroup(groupDoc.id, user.uid)}
>
- {translations[$language].leaveGroup}
+ {m.leaveGroup()}
{:else if $session?.status === 'preparing'}
-
{translations[$language].groupManagement}
+
{m.groupManagement()}
{#if creating}
{:else}
- {isCreatingGroup
- ? translations[$language].creatingGroup
- : translations[$language].createNewGroup}
+ {isCreatingGroup ? m.creatingGroup() : m.createNewGroup()}
{/if}
(creating = !creating)}>
- {creating
- ? translations[$language].cancel
- : translations[$language].joinExistingGroup}
+ {creating ? m.cancel() : m.joinExistingGroup()}
{:else}
- {translations[$language].notInGroup}
+ {m.notInGroup()}
{/if}
@@ -761,8 +674,8 @@
>
{#if $session?.status === 'preparing'}
-
{translations[$language].waitStart}
-
{translations[$language].hostBeginShortly}
+
{m.waitStart()}
+
{m.hostBeginShortly()}
{:else if $session?.status === 'individual'}
diff --git a/src/lib/components/session/StageProgress.svelte b/src/lib/components/session/StageProgress.svelte
index 6e3a048..1f52419 100644
--- a/src/lib/components/session/StageProgress.svelte
+++ b/src/lib/components/session/StageProgress.svelte
@@ -2,7 +2,7 @@
import { ArrowLeft, ArrowRight, Loader2 } from 'lucide-svelte';
import { Button, Modal } from 'flowbite-svelte';
import type { Session } from '$lib/schema/session';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
const stages = [
{ id: 'preparing', name: '準備階段', color: 'bg-yellow-500' },
@@ -25,20 +25,6 @@
$: canGoNext = currentStageIndex < stages.length - 1 && !loadingNext;
$: nextStage = currentStageIndex < stages.length - 1 ? stages[currentStageIndex + 1] : null;
- const translations = {
- en: {
- confirmEndStage:
- 'Entering the Ended Stage is irreversible. Are you sure you want to proceed?',
- confirm: 'Confirm',
- cancel: 'Cancel'
- },
- zh: {
- confirmEndStage: '進入總結階段將無法返回,確定要繼續嗎?',
- confirm: '確定',
- cancel: '取消'
- }
- };
-
async function handlePrevious() {
if (canGoPrevious) {
loadingPrevious = true;
@@ -132,7 +118,7 @@
- {translations[$language].confirmEndStage}
+ {m.confirmEndStage()}
- {translations[$language].confirm}
+ {m.confirm()}
(showEndedConfirmModal = false)}
- >{translations[$language].cancel} {m.cancel()}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 8e76dfe..d00f3e7 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -3,124 +3,10 @@
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 * as m from '$lib/paraglide/messages.js';
let title = $state('Hinagiku');
let highlight = $state(0);
- 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上查看'
- }
- };
onMount(() => {
const interval = setInterval(() => {
@@ -133,9 +19,6 @@
return () => clearInterval(interval);
});
- //for i18n support
- // import * as m from '$lib/paraglide/messages.js'
- // import { languageTag } from '$lib/paraglide/runtime.js'
@@ -161,20 +44,20 @@
- {translations[$lang].intro}
+ {m.intro()}
{#if $user}
- {translations[$lang].dashboard}
+ {m.dashboard()}
{:else}
- {translations[$lang].started}
+ {m.started()}
-
{translations[$lang].learn}
+
{m.learn()}
{/if}
@@ -189,9 +72,9 @@
-
{translations[$lang].whyChoose}
+
{m.whyChoose()}
- {translations[$lang].whyChooseDesc}
+ {m.whyChooseDesc()}
@@ -202,9 +85,9 @@
-
{translations[$lang].transcript}
+
{m.transcript()}
- {translations[$lang].tr_details}
+ {m.tr_details()}
@@ -214,9 +97,9 @@
-
{translations[$lang].Itanalysis}
+
{m.Itanalysis()}
- {translations[$lang].ia_details}
+ {m.ia_details()}
@@ -226,9 +109,9 @@
-
{translations[$lang].educational}
+
{m.educational()}
- {translations[$lang].ef_details}
+ {m.ef_details()}
@@ -239,45 +122,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 +172,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()}
- {translations[$lang].exploreTemplates}
+ {m.exploreTemplates()}
@@ -332,21 +215,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 +239,9 @@
-
{translations[$lang].openSource}
+
{m.openSource()}
- {translations[$lang].openSourceDesc}
+ {m.openSourceDesc()}
- {translations[$lang].viewOnGitHub}
+ {m.viewOnGitHub()}
diff --git a/src/routes/dashboard/+page.svelte b/src/routes/dashboard/+page.svelte
index 7d65a77..3f4dac8 100644
--- a/src/routes/dashboard/+page.svelte
+++ b/src/routes/dashboard/+page.svelte
@@ -27,7 +27,7 @@
import TemplateCard from '$lib/components/TemplateCard.svelte';
import SessionCard from '$lib/components/SessionCard.svelte';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let { data } = $props();
@@ -142,57 +142,6 @@
unsubscribe2();
unsubscribe3();
});
-
- const translations = {
- en: {
- welcome: 'Welcome to Hinagiku!',
- profile: 'Profile',
- dashboard: 'Dashboard',
- signOut: 'Sign out',
- login: 'Login',
- welcomeDashboard: 'Welcome to your dashboard',
- stats: 'Statistics',
- recentActivity: 'Recent Activity',
- createTemplate: 'Create Template',
- createTemplateDesc: 'Create a new discussion template',
- joinSession: 'Join Session',
- joinSessionDesc: 'Join an existing discussion session',
- editProfile: 'Edit Profile',
- editProfileDesc: 'Update your profile settings',
- publicTemplates: 'Public Templates',
- viewAll: 'View All',
- yourTemplates: 'Your Templates',
- noTemplates: 'No templates created yet',
- createFirstTemplate: 'Create your first template to get started',
- createTemplateButton: 'Create Your First Template',
- noSessions: 'No sessions created yet',
- createSession: 'Create a new session with template'
- },
- zh: {
- welcome: '歡迎來到Hinagiku!',
- profile: '個人資料',
- dashboard: '儀表板',
- signOut: '登出',
- login: '登入',
- welcomeDashboard: '歡迎來到您的儀表板',
- stats: '統計數據',
- recentActivity: '最近活動',
- createTemplate: '創建模板',
- createTemplateDesc: '創建一個新的討論模板',
- joinSession: '加入會話',
- joinSessionDesc: '加入現有的討論會話',
- editProfile: '編輯個人資料',
- editProfileDesc: '更新您的個人資料設置',
- publicTemplates: '公開模板',
- viewAll: '查看全部',
- yourTemplates: '您的模板',
- noTemplates: '尚未創建模板',
- createFirstTemplate: '創建您的第一個模板以開始',
- createTemplateButton: '創建您的第一個模板',
- noSessions: '尚未創建會話',
- createSession: '使用模板創建新會話'
- }
- };
@@ -201,9 +150,9 @@
-
{translations[$language].dashboard}
+
{m.dashboard()}
- {translations[$language].welcomeDashboard}, {$profile?.displayName || $user?.displayName}
+ {m.welcomeDashboard()}, {$profile?.displayName || $user?.displayName}
@@ -215,9 +164,9 @@
- {translations[$language].createTemplate}
+ {m.createTemplate()}
-
{translations[$language].createTemplateDesc}
+
{m.createTemplateDesc()}
@@ -227,9 +176,9 @@
- {translations[$language].joinSession}
+ {m.dashjoinSession()}
-
{translations[$language].joinSessionDesc}
+
{m.dashjoinSessionDesc()}
@@ -239,9 +188,9 @@
- {translations[$language].editProfile}
+ {m.editProfile()}
-
{translations[$language].editProfileDesc}
+
{m.editProfileDesc()}
@@ -250,10 +199,9 @@
- {translations[$language].publicTemplates}
+ {m.publicTemplates()}
- {translations[$language].viewAll}
+ {m.viewAll()}
{#if $publicTemplates?.length}
@@ -274,11 +222,9 @@
Example Template
- {translations[$language].createFirstTemplate}
+ {m.createFirstTemplate()}
-
{translations[$language].createTemplateButton}
+
{m.createTemplateButton()}
{/each}
@@ -289,8 +235,8 @@
-
{translations[$language].yourTemplates}
- {translations[$language].viewAll}
+ {m.yourTemplates()}
+ {m.viewAll()}
{#if $templates?.length}
@@ -312,11 +258,11 @@
- {translations[$language].noTemplates}
+ {m.noTemplates()}
-
{translations[$language].createFirstTemplate}
+
{m.createFirstTemplate()}
{translations[$language].createTemplateButton} {m.createTemplateButton()}
@@ -327,10 +273,8 @@
-
{translations[$language].recentActivity}
- {translations[$language].viewAll}
+ {m.recentActivity()}
+ {m.viewAll()}
{#each $availableLabels as label}
@@ -362,9 +306,9 @@
- {translations[$language].noSessions}
+ {m.noSessions()}
-
{translations[$language].createSession}
+
{m.createSession()}
{/if}
@@ -376,11 +320,9 @@
- {translations[$language].recentActivity}
+ {m.recentActivity()}
- {translations[$language].viewAll}
+ {m.viewAll()}
{#each $sessions as [id, session]}
diff --git a/src/routes/join/+page.svelte b/src/routes/join/+page.svelte
index c7ee89a..c0e8ebb 100644
--- a/src/routes/join/+page.svelte
+++ b/src/routes/join/+page.svelte
@@ -4,7 +4,7 @@
import { notifications } from '$lib/stores/notifications';
import { getDoc, doc } from 'firebase/firestore';
import { db } from '$lib/firebase';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
async function handleScan(code: string) {
try {
@@ -41,23 +41,6 @@
console.error(e);
}
}
-
- const translations = {
- en: {
- joinSession: 'Join Discussion Session',
- scanQr: 'Scan the QR code provided by your session host to join the discussion.',
- enterCode: 'Or please enter the 6-digits code to join.',
- joinButton: 'Join Session',
- enterCodePlaceholder: 'Enter code'
- },
- zh: {
- joinSession: '加入討論會話',
- scanQr: '掃描會話主持人提供的QRcode以加入討論。',
- enterCode: '或者請輸入6位數的代碼以加入。',
- joinButton: '加入會話',
- enterCodePlaceholder: '輸入代碼'
- }
- };
@@ -65,21 +48,21 @@
- {translations[$language].joinSession}
+ {m.joinSession()}
- {translations[$language].scanQr}
+ {m.scanQr()}
-
{translations[$language].enterCode}
+
{m.enterCode()}
- {translations[$language].joinButton}
+ {m.joinButton()}
diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte
index b662d28..e038253 100644
--- a/src/routes/login/+page.svelte
+++ b/src/routes/login/+page.svelte
@@ -1,29 +1,14 @@
diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte
index ee5fcc6..75bd135 100644
--- a/src/routes/profile/+page.svelte
+++ b/src/routes/profile/+page.svelte
@@ -3,53 +3,20 @@
import { profile } from '$lib/stores/profile';
import { Button, Label, Input, Textarea, Card, Alert } from 'flowbite-svelte';
import { CheckCircle, XCircle } from 'lucide-svelte';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let { form, data } = $props();
let loading = $state(false);
-
- const translations = {
- en: {
- profileSettings: 'Profile Settings',
- updateInfo: 'Update your personal information and preferences',
- successMessage: 'Profile updated successfully!',
- errorMessage: 'Cannot update profile. Please try again later.',
- displayName: 'Display Name',
- title: 'Title',
- titlePlaceholder: 'e.g. Professor, Student, Teaching Assistant',
- bio: 'Bio',
- bioPlaceholder: 'Tell us about yourself',
- bioHelp: 'Write a short bio to help others know more about you',
- cancel: 'Cancel',
- saveChanges: 'Save Changes',
- saving: 'Saving...'
- },
- zh: {
- profileSettings: '個人資料設置',
- updateInfo: '更新您的個人資料和偏好',
- successMessage: '個人資料更新成功!',
- errorMessage: '無法更新個人資料。請稍後再試。',
- displayName: '顯示名稱',
- title: '職稱',
- titlePlaceholder: '例如:教授、學生、助教',
- bio: '簡介',
- bioPlaceholder: '介紹一下你自己',
- bioHelp: '寫一個簡短的簡介,幫助其他人更好地了解你',
- cancel: '取消',
- saveChanges: '保存更改',
- saving: '保存中...'
- }
- };
- {translations[$language].profileSettings} | Hinagiku
+ {m.profileSettings()} | Hinagiku
-
{translations[$language].profileSettings}
-
{translations[$language].updateInfo}
+
{m.profileSettings()}
+
{m.updateInfo()}
{#if form}
@@ -58,14 +25,14 @@
- {translations[$language].successMessage}
+ {m.successMessage()}
{:else}
- {translations[$language].errorMessage}
+ {m.errorMessage()}
{/if}
{/if}
@@ -84,7 +51,7 @@
class="space-y-6"
>
-
{translations[$language].displayName}
+
{m.displayName()}
- {translations[$language].title}
+ {m.title()}
-
{translations[$language].bio}
+
{m.bio()}
- {translations[$language].bioHelp}
+ {m.bioHelp()}
- {translations[$language].cancel}
+ {m.cancel()}
- {loading ? translations[$language].saving : translations[$language].saveChanges}
+ {loading ? m.saving() : m.saveChanges()}
diff --git a/src/routes/session/[id]/+page.svelte b/src/routes/session/[id]/+page.svelte
index 46d9902..d3248cf 100644
--- a/src/routes/session/[id]/+page.svelte
+++ b/src/routes/session/[id]/+page.svelte
@@ -6,21 +6,12 @@
import ParticipantView from '$lib/components/session/ParticipantView.svelte';
import LabelManager from '$lib/components/session/LabelManager.svelte';
import { page } from '$app/stores';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages.js';
let { data } = $props();
let session = getContext
>('session');
let isHost = $derived($session?.host === data.user.uid);
let sessionId = $page.params.id;
-
- const translations = {
- en: {
- sessionLabels: 'Session Labels'
- },
- zh: {
- sessionLabels: '會話標籤'
- }
- };
@@ -32,7 +23,7 @@
{#if $session.status === 'preparing' && isHost}
-
{translations[$language].sessionLabels}
+ {m.sessionLabels()}
{/if}
diff --git a/src/routes/session/[id]/discussion/[userId]/+page.svelte b/src/routes/session/[id]/discussion/[userId]/+page.svelte
index 8bb555f..a066d24 100644
--- a/src/routes/session/[id]/discussion/[userId]/+page.svelte
+++ b/src/routes/session/[id]/discussion/[userId]/+page.svelte
@@ -1,5 +1,5 @@
@@ -60,15 +47,15 @@
class="inline-block"
type="text"
bind:value={inputText}
- placeholder={translations[$language].typeMessage}
+ placeholder={m.typeMessage()}
onkeyup={(e) => e.key === 'Enter' && sendMessage()}
/>
- {translations[$language].send}
+ {m.send()}
{#if messages[messages.length - 1].sender === 'me'}
- {translations[$language].waitResponse}
+ {m.waitResponse()}
{/if}
diff --git a/src/routes/session/[id]/participant/+page.svelte b/src/routes/session/[id]/participant/+page.svelte
index 5140172..73eaa8b 100644
--- a/src/routes/session/[id]/participant/+page.svelte
+++ b/src/routes/session/[id]/participant/+page.svelte
@@ -1,13 +1,5 @@
-
{translations[$language].waitResponse}
+
{m.PwaitingForParticipants()}
diff --git a/src/routes/session/[id]/status/+page.svelte b/src/routes/session/[id]/status/+page.svelte
index ac39be3..2037f78 100644
--- a/src/routes/session/[id]/status/+page.svelte
+++ b/src/routes/session/[id]/status/+page.svelte
@@ -1,7 +1,6 @@
-
{translations[$language].dashboardTitle}
+
{m.dashboardTitle()}
{#if groups.length === 0}
-
{translations[$language].loadingGroups}
+
{m.loadingGroups()}
{:else}
{#each groups as group, index}
Group #{index + 1}
{#if group.participants.length === 0}
-
{translations[$language].noParticipants}
+
{m.noParticipantsInGroup()}
{:else}
{#each group.participants as participant}
diff --git a/src/routes/template/[id]/+page.svelte b/src/routes/template/[id]/+page.svelte
index d5f4bdc..1ac147a 100644
--- a/src/routes/template/[id]/+page.svelte
+++ b/src/routes/template/[id]/+page.svelte
@@ -10,7 +10,7 @@
import { subscribe } from '$lib/firebase/store';
import { goto } from '$app/navigation';
import { notifications } from '$lib/stores/notifications';
- import { language } from '$lib/stores/language'; // Import the global language store
+ import * as m from '$lib/paraglide/messages';
let title = '';
let task = '';
@@ -128,105 +128,56 @@
notifications.error('Failed to delete template');
}
}
-
- const translations = {
- en: {
- editTemplate: 'Edit Template',
- startSession: 'Start Session',
- saveChanges: 'Save changes before starting a session',
- startDiscussion: 'Start a discussion session with this template',
- title: 'Title',
- templateTitle: 'Template title',
- mainTask: 'Main Task',
- mainTaskDesc: 'Main task description',
- subtasks: 'Subtasks',
- subtaskDesc: 'Subtask description',
- addSubtask: 'Add Subtask',
- makePublic: 'Make template public',
- backToDashboard: 'Back to Dashboard',
- unsavedChanges: 'You have unsaved changes!',
- deleteTemplate: 'Delete this Template',
- saveChangesButton: 'Save Changes',
- allChangesSaved: 'All changes saved',
- deleteConfirmation: 'Are you sure you want to delete this template?',
- yesDelete: 'Yes, delete it',
- noCancel: 'No, cancel',
- loadingTemplate: 'Loading template...'
- },
- zh: {
- editTemplate: '編輯模板',
- startSession: '開始會話',
- saveChanges: '保存更改後再開始會話',
- startDiscussion: '使用此模板開始討論會話',
- title: '標題',
- templateTitle: '模板標題',
- mainTask: '主要任務',
- mainTaskDesc: '主要任務描述',
- subtasks: '子任務',
- subtaskDesc: '子任務描述',
- addSubtask: '添加子任務',
- makePublic: '將模板設為公開',
- backToDashboard: '返回儀表板',
- unsavedChanges: '您有未保存的更改!',
- deleteTemplate: '刪除此模板',
- saveChangesButton: '保存更改',
- allChangesSaved: '所有更改已保存',
- deleteConfirmation: '您確定要刪除此模板嗎?',
- yesDelete: '是的,刪除它',
- noCancel: '不,取消',
- loadingTemplate: '加載模板...'
- }
- };
- {translations[$language].editTemplate} | Hinagiku
+ {m.editTemplate()} | Hinagiku
{#if template}
-
{translations[$language].editTemplate}
+
{m.editTemplate()}
- {translations[$language].startSession}
+ {m.startSession()}
{#if unsavedChanges}
- {translations[$language].saveChanges}
+ {m.saveChanges()}
{:else}
- {translations[$language].startDiscussion}
+ {m.startDiscussion()}
{/if}