Skip to content

Commit

Permalink
feat: I18npackage support for whole project (#148)
Browse files Browse the repository at this point in the history
* initial commit for i18n package support

* fix: language switcher in navbar

* add i18n support for 7 components and 2 pages

* feat: add i18n support for whole project

* chore: update translations with Fink 🐦

* fix: fix pnpm styling issue
  • Loading branch information
Buffett111 authored Feb 20, 2025
1 parent f7f30d6 commit 7f68d92
Show file tree
Hide file tree
Showing 20 changed files with 485 additions and 808 deletions.
135 changes: 134 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
139 changes: 138 additions & 1 deletion messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "此群組中沒有參與者"
}
33 changes: 5 additions & 28 deletions src/lib/components/Chatroom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -167,7 +148,7 @@
<Card class="w-fit max-w-[80%]">
<div class="-my-2">
<p class="prose prose-hina text-gray-600">
{#await renderMarkdown(`${translations[$language].thinking}${dots}`)}
{#await renderMarkdown(`${m.thinking()}${dots}`)}
Loading ...
{:then content}
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
Expand All @@ -187,7 +168,7 @@
<div class="flex min-w-[200px] flex-1 flex-col">
<Textarea
class="max-h-32 min-h-14 flex-1"
placeholder={translations[$language].placeholder}
placeholder={m.placeholder()}
rows={1}
bind:value={text}
disabled={operating}
Expand All @@ -210,11 +191,7 @@
{:else}
<Mic />
{/if}
{recording
? operating
? translations[$language].waiting
: translations[$language].stop
: translations[$language].record}
{recording ? (operating ? m.waiting() : m.stop()) : m.record()}
</Button>
<Button
color="primary"
Expand All @@ -223,7 +200,7 @@
on:click={handleSend}
>
<Send class={operating ? 'animate-pulse' : ''} />
{translations[$language].send}
{m.send()}
</Button>
</div>
</div>
Expand Down
Loading

0 comments on commit 7f68d92

Please sign in to comment.