Parcourir la source

fix: add missed translations

Ased Mammad il y a 1 an
Parent
commit
6d2f462090

+ 1 - 1
src/lib/components/chat/MessageInput.svelte

@@ -216,7 +216,7 @@
 					// Event triggered when an error occurs
 					speechRecognition.onerror = function (event) {
 						console.log(event);
-						toast.error(`Speech recognition error: ${event.error}`);
+						toast.error($i18n.t(`Speech recognition error: {{error}}`, { error: event.error }));
 						isRecording = false;
 					};
 				} else {

+ 3 - 1
src/lib/components/chat/MessageInput/Models.svelte

@@ -111,7 +111,9 @@
 					toast.error(error.error);
 				}
 			} else {
-				toast.error($i18n.t('Uh-oh! There was an issue connecting to llama.'));
+				toast.error(
+					$i18n.t('Uh-oh! There was an issue connecting to {{provider}}.', { provider: 'llama' })
+				);
 			}
 		}
 

+ 5 - 1
src/lib/components/chat/Settings/Audio.svelte

@@ -115,7 +115,11 @@
 						on:change={(e) => {
 							if (e.target.value !== '') {
 								navigator.mediaDevices.getUserMedia({ audio: true }).catch(function (err) {
-									toast.error(`Permission denied when accessing microphone: ${err}`);
+									toast.error(
+										$i18n.t(`Permission denied when accessing microphone: {{error}}`, {
+											error: err
+										})
+									);
 									STTEngine = '';
 								});
 							}

+ 1 - 1
src/lib/components/chat/Settings/Images.svelte

@@ -79,7 +79,7 @@
 			}
 		} else {
 			enableImageGeneration = false;
-			toast.error('AUTOMATIC1111_BASE_URL not provided');
+			toast.error($i18n.t('{{item}} not provided', { item: 'AUTOMATIC1111_BASE_URL' }));
 		}
 	};
 

+ 12 - 6
src/lib/components/chat/Settings/Models.svelte

@@ -56,11 +56,17 @@
 	const pullModelHandler = async () => {
 		const sanitizedModelTag = modelTag.trim();
 		if (modelDownloadStatus[sanitizedModelTag]) {
-			toast.error(`Model '${sanitizedModelTag}' is already in queue for downloading.`);
+			toast.error(
+				$i18n.t(`Model '{{modelTag}}' is already in queue for downloading.`, {
+					modelTag: sanitizedModelTag
+				})
+			);
 			return;
 		}
 		if (Object.keys(modelDownloadStatus).length === 3) {
-			toast.error('Maximum of 3 models can be downloaded simultaneously. Please try again later.');
+			toast.error(
+				$i18n.t('Maximum of 3 models can be downloaded simultaneously. Please try again later.')
+			);
 			return;
 		}
 
@@ -78,10 +84,10 @@
 				if (!data.success) {
 					toast.error(data.error);
 				} else {
-					toast.success($i18n.t(`Model '${modelName}' has been successfully downloaded.`));
+					toast.success($i18n.t(`Model '{{modelName}}' has been successfully downloaded.`, {modelName}));
 
 					const notification = new Notification($WEBUI_NAME, {
-						body: `Model '${modelName}' has been successfully downloaded.`,
+						body: $i18n.t(`Model '{{modelName}}' has been successfully downloaded.`, {modelName}),
 						icon: `${WEBUI_BASE_URL}/static/favicon.png`
 					});
 
@@ -243,7 +249,7 @@
 		});
 
 		if (res) {
-			toast.success($i18n.t(`Deleted ${deleteModelTag}`));
+			toast.success($i18n.t(`Deleted {{deleteModelTag}}`, {deleteModelTag}));
 		}
 
 		deleteModelTag = '';
@@ -327,7 +333,7 @@
 				}
 			}
 		} else {
-			toast.error(`Model ${liteLLMModelName} already exists.`);
+			toast.error($i18n.t(`Model {{modelName}} already exists.`, { modelName: liteLLMModelName }));
 		}
 
 		liteLLMModelName = '';

+ 1 - 1
src/lib/components/documents/AddDocModal.svelte

@@ -73,7 +73,7 @@
 			inputFiles = null;
 			document.getElementById('upload-doc-input').value = '';
 		} else {
-			toast.error(`File not found.`);
+			toast.error($i18n.t(`File not found.`));
 		}
 
 		show = false;

+ 13 - 3
src/lib/i18n/locales/en/common.json

@@ -61,7 +61,7 @@
 	"Delete a model": "Delete a model",
 	"Delete chat": "Delete chat",
 	"Delete Chats": "Delete Chats",
-	"Deleted ${deleteModelTag}`": "Deleted ${deleteModelTag}`",
+	"Deleted {{deleteModelTag}}": "Deleted {{deleteModelTag}}",
 	"delete": "delete",
 	"Deleted {tagName}": "Deleted {tagName}",
 	"Description": "Description",
@@ -105,6 +105,7 @@
 	"Import Modelfiles": "Import Modelfiles",
 	"Import Prompts": "Import Prompts",
 	"Interface": "Interface",
+	"{{item}} not provided": "{{item}} not provided",
 	"join our Discord for help.": "join our Discord for help.",
 	"JSON": "JSON",
 	"JWT Expiration": "JWT Expiration",
@@ -120,17 +121,22 @@
 	"LLMs can make mistakes. Verify important information.": "LLMs can make mistakes. Verify important information.",
 	"Made by OpenWebUI Community": "Made by OpenWebUI Community",
 	"Manage LiteLLM Models": "Manage LiteLLM Models",
+	"Maximum of 3 models can be downloaded simultaneously. Please try again later.": "Maximum of 3 models can be downloaded simultaneously. Please try again later.",
 	"Max Tokens": "Max Tokens",
 	"Mirostat Eta": "Mirostat Eta",
 	"Mirostat": "Mirostat",
 	"Mirostat Tau": "Mirostat Tau",
-	"Model '${modelName}' has been successfully downloaded.`": "Model '${modelName}' has been successfully downloaded.`",
+	"Model '{{modelName}}' has been successfully downloaded.`": "Model '{{modelName}}' has been successfully downloaded.`",
 	"Modelfile Advanced Settings": "Modelfile Advanced Settings",
 	"Modelfile Content": "Modelfile Content",
 	"Modelfile": "Modelfile",
 	"Modelfiles": "Modelfiles",
+	"Model {{modelId}} not found": "Model {{modelId}} not found",
+	"Model {{modelName}} already exists.": "Model {{modelName}} already exists.",
+	"Model '{{modelTag}}' is already in queue for downloading.": "Model '{{modelTag}}' is already in queue for downloading.",
 	"{{modelName}} is thinking...": "{{modelName}} is thinking...",
 	"Model Name": "Model Name",
+	"Model not selected": "Model not selected",
 	"Models": "Models",
 	"Model Tag Name": "Model Tag Name",
 	"My Documents": "My Documents",
@@ -146,7 +152,9 @@
 	"Okay, Let's Go!": "Okay, Let's Go!",
 	"Ollama API URL": "Ollama API URL",
 	"Ollama Version": "Ollama Version",
+	"Only alphanumeric characters and hyphens are allowed in the command string.": "Only alphanumeric characters and hyphens are allowed in the command string.",
 	"On": "On",
+	"Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.": "Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.",
 	"OpenAI API": "OpenAI API",
 	"Open AI": "Open AI",
 	"Open new chat": "Open new chat",
@@ -154,6 +162,7 @@
 	"Parameters": "Parameters",
 	"Password": "Password",
 	"Pending": "Pending",
+	"Permission denied when accessing microphone: {{error}}": "Permission denied when accessing microphone: {{error}}",
 	"Profile": "Profile",
 	"Prompt Content": "Prompt Content",
 	"Prompts": "Prompts",
@@ -198,6 +207,7 @@
 	"Show shortcuts": "Show shortcuts",
 	"Sign Out": "Sign Out",
 	"SpeechRecognition API is not supported in this browser.": "SpeechRecognition API is not supported in this browser.",
+	"Speech recognition error: {{error}}": "Speech recognition error: {{error}}",
 	"Speech-to-Text Engine": "Speech-to-Text Engine",
 	"Stop Sequence": "Stop Sequence",
 	"STT Settings": "STT Settings",
@@ -222,7 +232,7 @@
 	"Top K": "Top K",
 	"Top P": "Top P",
 	"TTS Settings": "TTS Settings",
-	"Uh-oh! There was an issue connecting to llama.": "Uh-oh! There was an issue connecting to llama.",
+	"Uh-oh! There was an issue connecting to {{provider}}.": "Uh-oh! There was an issue connecting to {{provider}}.",
 	"Upload a GGUF model": "Upload a GGUF model",
 	"Upload files": "Upload files",
 	"Upload Progress": "Upload Progress",

+ 48 - 38
src/lib/i18n/locales/fa/common.json

@@ -6,7 +6,7 @@
 	"Add Docs": "اضافه کردن اسناد",
 	"Add Files": "اضافه کردن فایل‌ها",
 	"Add LiteLLM Model": "اضافه کردن مدل LiteLLM",
-	"add tags": "add tags",
+	"add tags": "اضافه کردن تگ‌ها",
 	"Admin": "مدیریت",
 	"Admin Panel": "پنل مدیریت",
 	"Admin Settings": "تنظیمات مدیریت",
@@ -14,12 +14,12 @@
 	"Advanced Parameters": "پارامترهای پیشرفته",
 	"all": "همه",
 	"Allow": "اجازه دادن",
-	"Allow Chat Deletion": "اجازه حذف چت",
+	"Allow Chat Deletion": "اجازه حذف گپ",
 	"API Base URL": "API Base URL",
 	"API Key": "API Key",
 	"API RPM": "API RPM",
 	"Audio": "صدا",
-	"AUTOMATIC1111 Base URL": "AUTOMATIC1111 Base URL",
+	"AUTOMATIC1111 Base URL": "پایه URL AUTOMATIC1111 ",
 	"Auto-playback response": "پخش خودکار پاسخ ",
 	"Auto-send input after 3 sec.": "به طور خودکار ورودی را پس از 3 ثانیه ارسال کن.",
 	"Back": "بازگشت",
@@ -28,15 +28,15 @@
 	"Categories": "دسته‌بندی‌ها",
 	"Change Password": "تغییر رمز عبور",
 	"Chat History": "تاریخچه‌ی گفتگو",
-	"Chat History is off for this browser.": "سابقه چت برای این مرورگر خاموش است.",
-	"Chats": "چت‌ها",
-	"Check Again": "Check Again",
+	"Chat History is off for this browser.": "سابقه گپ برای این مرورگر خاموش است.",
+	"Chats": "گپ‌ها",
+	"Check Again": "چک مجدد",
 	"Choose a model before saving...": "قبل از ذخیره یک مدل را انتخاب کنید...",
 	"Chunk Overlap": "همپوشانی تکه",
 	"Chunk Params": "پارامترهای تکه",
 	"Chunk Size": "اندازه تکه",
 	"click here.": "اینجا کلیک کنید.",
-	"Click here to check other modelfiles.": "Click here to check other modelfiles.",
+	"Click here to check other modelfiles.": "برای بررسی سایر فایل‌های مدل اینجا را کلیک کنید.",
 	"Collection": "مجموعه",
 	"Command": "دستور",
 	"Confirm Password": "تایید رمز عبور",
@@ -47,7 +47,7 @@
 	"Copying to clipboard was successful!": "کپی کردن در کلیپ بورد با موفقیت انجام شد!",
 	"Copy last code block": "کپی آخرین بلوک کد",
 	"Copy last response": "کپی آخرین پاسخ",
-	"Create a modelfile": "Create a modelfile",
+	"Create a modelfile": "ایجاد یک فایل مدل",
 	"Current Password": "رمز عبور فعلی",
 	"Custom": "دلخواه",
 	"Customize Ollama models for a specific purpose": "Customize Ollama models for a specific purpose",
@@ -59,26 +59,26 @@
 	"Default User Role": "Default User Role",
 	"Default (Web API)": "Default (Web API)",
 	"Delete a model": "حذف یک مدل",
-	"Delete chat": "حذف چت",
-	"Delete Chats": "حذف چت‌ها",
-	"Deleted ${deleteModelTag}`": "Deleted ${deleteModelTag}`",
+	"Delete chat": "حذف گپ",
+	"Delete Chats": "حذف گپ‌ها",
+	"Deleted {{deleteModelTag}}": "{{deleteModelTag}} پاک شد",
 	"delete": "حذف",
 	"Deleted {tagName}": "{tagName} حذف شد",
 	"Description": "توضیحات",
 	"Disabled": "غیرفعال",
-	"Discover a modelfile": "Discover a modelfile",
-	"Discover a prompt": "Discover a prompt",
-	"Discover, download, and explore custom prompts": "Discover, download, and explore custom prompts",
-	"Discover, download, and explore model presets": "Discover, download, and explore model presets",
+	"Discover a modelfile": "فایل مدل را کشف کنید",
+	"Discover a prompt": "یک اعلان را کشف کنید",
+	"Discover, download, and explore custom prompts": "درخواست‌های سفارشی را کشف، دانلود و کاوش کنید",
+	"Discover, download, and explore model presets": "پیش تنظیمات مدل را کشف، دانلود و کاوش کنید",
 	"Document": "سند",
 	"Documents": "اسناد",
 	"Document Settings": "تنظیمات سند",
-	"Don't Allow": "Don't Allow",
+	"Don't Allow": "اجازه نده",
 	"Download as a File": "دانلود به صورت فایل",
 	"Download Database": "دانلود پایگاه داده",
 	"Edit Doc": "ویرایش سند",
 	"Edit User": "ویرایش کاربر",
-	"Email": "Email",
+	"Email": "ایمیل",
 	"Enabled": "فعال",
 	"Enable New Sign Ups": "Enable New Sign Ups",
 	"Experimental": "Experimental",
@@ -105,6 +105,7 @@
 	"Import Modelfiles": "Import Modelfiles",
 	"Import Prompts": "Import Prompts",
 	"Interface": "رابط",
+	"{{item}} not provided": "{{item}} not provided",
 	"join our Discord for help.": "برای کمک به Discord ما بپیوندید.",
 	"JSON": "JSON",
 	"JWT Expiration": "JWT Expiration",
@@ -118,19 +119,24 @@
 	"LiteLLM API Key": "LiteLLM API Key",
 	"LiteLLM API RPM": "LiteLLM API RPM",
 	"LLMs can make mistakes. Verify important information.": "مدل‌های زبانی بزرگ می‌توانند اشتباه کنند. اطلاعات مهم را راستی‌آزمایی کنید.",
-	"Made by OpenWebUI Community": "Made by OpenWebUI Community",
+	"Made by OpenWebUI Community": "ساخته شده توسط OpenWebUI Community",
 	"Manage LiteLLM Models": "Manage LiteLLM Models",
-	"Max Tokens": "Max Tokens",
+	"Maximum of 3 models can be downloaded simultaneously. Please try again later.": "حداکثر 3 مدل را می توان به طور همزمان دانلود کرد. لطفاً بعداً دوباره امتحان کنید.",
+	"Max Tokens": "حداکثر توکن",
 	"Mirostat Eta": "Mirostat Eta",
 	"Mirostat": "Mirostat",
 	"Mirostat Tau": "Mirostat Tau",
-	"Model '${modelName}' has been successfully downloaded.`": "Model '${modelName}' has been successfully downloaded.`",
-	"Modelfile Advanced Settings": "Modelfile Advanced Settings",
-	"Modelfile Content": "Modelfile Content",
+	"Model '{{modelName}}' has been successfully downloaded.`": "Model '{{modelName}}' has been successfully downloaded.`",
+	"Modelfile Advanced Settings": "تنظیمات پیشرفته فایل‌مدل",
+	"Modelfile Content": "محتویات فایل‌مدل",
 	"Modelfile": "فایل مدل",
 	"Modelfiles": "فایل‌های مدل",
+	"Model {{modelId}} not found": "Model {{modelId}} not found",
+	"Model {{modelName}} already exists.": "Model {{modelName}} already exists.",
+	"Model '{{modelTag}}' is already in queue for downloading.": "Model '{{modelTag}}' is already in queue for downloading.",
 	"{{modelName}} is thinking...": "{{modelName}} در حال فکر کردن است...",
 	"Model Name": "نام مدل",
+	"Model not selected": "Model not selected",
 	"Models": "مدل‌ها",
 	"Model Tag Name": "Model Tag Name",
 	"My Documents": "اسناد من",
@@ -138,22 +144,25 @@
 	"My Prompts": "درخواست‌های من",
 	"Name": "نام",
 	"Name Tag": "Name Tag",
-	"New Chat": "چت جدید",
+	"New Chat": "گپ جدید",
 	"New Password": "رمز عبور جدید",
 	"Notification": "اعلان",
-	"Not sure what to write? Switch to": "Not sure what to write? Switch to",
+	"Not sure what to write? Switch to": "مطمئن نیستید چه بنویسید؟ تغییر به",
 	"Off": "خاموش",
 	"Okay, Let's Go!": "Okay, Let's Go!",
 	"Ollama API URL": "Ollama API URL",
 	"Ollama Version": "نسخه Ollama",
+	"Only alphanumeric characters and hyphens are allowed in the command string.": "فقط کاراکترهای الفبایی و خط فاصله در رشته فرمان مجاز هستند.",
 	"On": "روشن",
+	"Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.": "اوه! فایل های شما هنوز در فر پردازش هستند. ما آنها را کامل می پزیم. لطفا صبور باشید، به محض آماده شدن به شما اطلاع خواهیم داد.",
 	"OpenAI API": "OpenAI API",
 	"Open AI": "Open AI",
-	"Open new chat": "Open new chat",
+	"Open new chat": "باز کردن گپ جدید",
 	"or": "روشن",
 	"Parameters": "پارامترها",
 	"Password": "رمز عبور",
 	"Pending": "Pending",
+	"Permission denied when accessing microphone: {{error}}": "Permission denied when accessing microphone: {{error}}",
 	"Profile": "پروفایل",
 	"Prompt Content": "محتویات درخواست",
 	"Prompts": "درخواست‌ها",
@@ -195,9 +204,10 @@
 	"Set Title Auto-Generation Model": "Set Title Auto-Generation Model",
 	"Set Voice": "Set Voice",
 	"Share to OpenWebUI Community": "Share to OpenWebUI Community",
-	"Show shortcuts": "Show shortcuts",
+	"Show shortcuts": "نمایش میانبرها",
 	"Sign Out": "خروج",
 	"SpeechRecognition API is not supported in this browser.": "SpeechRecognition API is not supported in this browser.",
+	"Speech recognition error: {{error}}": "Speech recognition error: {{error}}",
 	"Speech-to-Text Engine": "Speech-to-Text Engine",
 	"Stop Sequence": "Stop Sequence",
 	"STT Settings": "STT Settings",
@@ -212,28 +222,28 @@
 	"Text-to-Speech Engine": "Text-to-Speech Engine",
 	"Tfs Z": "Tfs Z",
 	"Theme": "قالب",
-	"This ensures that your valuable conversations are securely saved to your backend database. Thank you!": "This ensures that your valuable conversations are securely saved to your backend database. Thank you!",
-	"Title Auto-Generation": "Title Auto-Generation",
-	"Title Generation Prompt": "Title Generation Prompt",
+	"This ensures that your valuable conversations are securely saved to your backend database. Thank you!": "این تضمین می کند که مکالمات ارزشمند شما به طور ایمن در پایگاه داده بکند ذخیره می شود. تشکر!",
+	"Title Auto-Generation": "تولید خودکار عنوان",
+	"Title Generation Prompt": "درخواست تولید عنوان",
 	"Title": "عنوان",
-	"To access the available model names for downloading,": "To access the available model names for downloading,",
+	"To access the available model names for downloading,": "برای دسترسی به نام مدل های موجود برای دانلود،",
 	"Toggle settings": "Toggle settings",
 	"Toggle sidebar": "Toggle sidebar",
 	"Top K": "Top K",
 	"Top P": "Top P",
-	"TTS Settings": "TTS Settings",
-	"Uh-oh! There was an issue connecting to llama.": "Uh-oh! There was an issue connecting to llama.",
-	"Upload a GGUF model": "Upload a GGUF model",
-	"Upload files": "Upload files",
-	"Upload Progress": "Upload Progress",
+	"TTS Settings": "تنظیمات TTS",
+	"Uh-oh! There was an issue connecting to {{provider}}.": "اوه اوه! مشکلی در اتصال به {{provider}} وجود داشت.",
+	"Upload a GGUF model": "بارگذاری یک مدل GGUF",
+	"Upload files": "بارگذاری فایل‌ها",
+	"Upload Progress": "میزان پیشرفت بارگذاری",
 	"URL Mode": "URL Mode",
-	"User Permissions": "User Permissions",
+	"User Permissions": "مجوزهای کاربر",
 	"Users": "کاربران",
 	"User": "کاربر",
 	"WebUI Add-ons": "WebUI Add-ons",
 	"{{webui_name}} Backend Required": "{{webui_name}} Backend Required",
-	"WebUI Settings": "WebUI Settings",
-	"Web": "Web",
+	"WebUI Settings": "تنظیمات WebUI",
+	"Web": "وب",
 	"Whisper (Local)": "Whisper (Local)",
 	"You're now logged in.": "شما اکنون وارد شده‌اید."
 }

+ 1 - 1
src/routes/(app)/+layout.svelte

@@ -241,7 +241,7 @@
 										location.href = '/';
 									}}
 								>
-									Check Again
+									{$i18n.t('Check Again')}
 								</button>
 
 								<button

+ 10 - 10
src/routes/(app)/+page.svelte

@@ -156,7 +156,7 @@
 		);
 
 		if (selectedModels.includes('')) {
-			toast.error('Model not selected');
+			toast.error($i18n.t('Model not selected'));
 		} else if (messages.length != 0 && messages.at(-1).done != true) {
 			// Response not done
 			console.log('wait');
@@ -166,7 +166,7 @@
 		) {
 			// Upload not done
 			toast.error(
-				`Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.`
+				$i18n.t(`Oops! Hold tight! Your files are still in the processing oven. We're cooking them up to perfection. Please be patient and we'll let you know once they're ready.`)
 			);
 		} else {
 			// Reset chat message textarea height
@@ -317,7 +317,7 @@
 						await sendPromptOllama(model, prompt, responseMessageId, _chatId);
 					}
 				} else {
-					toast.error(`Model ${modelId} not found`);
+					toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
 				}
 			})
 		);
@@ -511,12 +511,12 @@
 					responseMessage.content = error.error;
 				}
 			} else {
-				toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
-				responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
+				toast.error($i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'}));
+				responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'});
 			}
 
 			responseMessage.error = true;
-			responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
+			responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: 'Ollama'});
 			responseMessage.done = true;
 			messages = messages;
 		}
@@ -678,12 +678,12 @@
 					}
 				}
 			} else {
-				toast.error(`Uh-oh! There was an issue connecting to ${model}.`);
-				responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
+				toast.error($i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model}));
+				responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model}});
 			}
 
 			responseMessage.error = true;
-			responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
+			responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {provider: model});
 			responseMessage.done = true;
 			messages = messages;
 		}
@@ -747,7 +747,7 @@
 					);
 			}
 		} else {
-			toast.error(`Model ${modelId} not found`);
+			toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
 		}
 	};
 

+ 24 - 10
src/routes/(app)/c/[id]/+page.svelte

@@ -2,7 +2,7 @@
 	import { v4 as uuidv4 } from 'uuid';
 	import { toast } from 'svelte-sonner';
 
-	import { onMount, tick } from 'svelte';
+	import { onMount, tick, getContext } from 'svelte';
 	import { goto } from '$app/navigation';
 	import { page } from '$app/stores';
 
@@ -40,6 +40,8 @@
 	import { RAGTemplate } from '$lib/utils/rag';
 	import { LITELLM_API_BASE_URL, OPENAI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
 
+	const i18n = getContext('i18n');
+
 	let loaded = false;
 
 	let stopResponseFlag = false;
@@ -172,7 +174,7 @@
 		console.log('submitPrompt', $chatId);
 
 		if (selectedModels.includes('')) {
-			toast.error('Model not selected');
+			toast.error($i18n.t('Model not selected'));
 		} else if (messages.length != 0 && messages.at(-1).done != true) {
 			// Response not done
 			console.log('wait');
@@ -330,7 +332,7 @@
 						await sendPromptOllama(model, prompt, responseMessageId, _chatId);
 					}
 				} else {
-					toast.error(`Model ${modelId} not found`);
+					toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
 				}
 			})
 		);
@@ -524,12 +526,18 @@
 					responseMessage.content = error.error;
 				}
 			} else {
-				toast.error(`Uh-oh! There was an issue connecting to Ollama.`);
-				responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
+				toast.error(
+					$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { provider: 'Ollama' })
+				);
+				responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
+					provider: 'Ollama'
+				});
 			}
 
 			responseMessage.error = true;
-			responseMessage.content = `Uh-oh! There was an issue connecting to Ollama.`;
+			responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
+				provider: 'Ollama'
+			});
 			responseMessage.done = true;
 			messages = messages;
 		}
@@ -691,12 +699,18 @@
 					}
 				}
 			} else {
-				toast.error(`Uh-oh! There was an issue connecting to ${model}.`);
-				responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
+				toast.error(
+					$i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { provider: model })
+				);
+				responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
+					provider: model
+				});
 			}
 
 			responseMessage.error = true;
-			responseMessage.content = `Uh-oh! There was an issue connecting to ${model}.`;
+			responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, {
+				provider: model
+			});
 			responseMessage.done = true;
 			messages = messages;
 		}
@@ -746,7 +760,7 @@
 					);
 			}
 		} else {
-			toast.error(`Model ${modelId} not found`);
+			toast.error($i18n.t(`Model {{modelId}} not found`, { modelId }));
 		}
 	};
 

+ 1 - 1
src/routes/(app)/documents/+page.svelte

@@ -123,7 +123,7 @@
 						}
 					}
 				} else {
-					toast.error(`File not found.`);
+					toast.error($i18n.t(`File not found.`));
 				}
 			}
 

+ 3 - 1
src/routes/(app)/prompts/create/+page.svelte

@@ -38,7 +38,9 @@
 				await goto('/prompts');
 			}
 		} else {
-			toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
+			toast.error(
+				$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
+			);
 		}
 
 		loading = false;

+ 3 - 1
src/routes/(app)/prompts/edit/+page.svelte

@@ -36,7 +36,9 @@
 				await goto('/prompts');
 			}
 		} else {
-			toast.error('Only alphanumeric characters and hyphens are allowed in the command string.');
+			toast.error(
+				$i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
+			);
 		}
 
 		loading = false;