feat: Migrate hardcoded strings to i18n calls

This commit is contained in:
Ased Mammad 2024-03-03 00:08:51 +03:30
parent 7a77f3c2c0
commit 3c471ee2ca
46 changed files with 492 additions and 381 deletions

View file

@ -1,10 +1,10 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import { onMount, tick, getContext } from 'svelte';
import { openDB, deleteDB } from 'idb';
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
import { getOllamaModels, getOllamaVersion } from '$lib/apis/ollama';
@ -35,6 +35,8 @@
import ShortcutsModal from '$lib/components/chat/ShortcutsModal.svelte';
import ChangelogModal from '$lib/components/ChangelogModal.svelte';
const i18n = getContext('i18n');
let ollamaVersion = '';
let loaded = false;
@ -266,12 +268,14 @@
</div>
<div class=" mt-4 text-center text-sm dark:text-gray-200 w-full">
Saving chat logs directly to your browser's storage is no longer supported. Please
take a moment to download and delete your chat logs by clicking the button below.
Don't worry, you can easily re-import your chat logs to the backend through <span
class="font-semibold dark:text-white">Settings > Chats > Import Chats</span
>. This ensures that your valuable conversations are securely saved to your backend
database. Thank you!
{$i18n.t(
"Saving chat logs directly to your browser's storage is no longer supported. Please take a moment to download and delete your chat logs by clicking the button below. Don't worry, you can easily re-import your chat logs to the backend through"
)}
<span class="font-semibold dark:text-white"
>{$i18n.t('Settings')} > {$i18n.t('Chats')} > {$i18n.t('Import Chats')}</span
>. {$i18n.t(
'This ensures that your valuable conversations are securely saved to your backend database. Thank you!'
)}
</div>
<div class=" mt-6 mx-auto relative group w-fit">

View file

@ -2,7 +2,7 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { toast } from 'svelte-sonner';
@ -11,6 +11,8 @@
import EditUserModal from '$lib/components/admin/EditUserModal.svelte';
import SettingsModal from '$lib/components/admin/SettingsModal.svelte';
const i18n = getContext('i18n');
let loaded = false;
let users = [];
@ -37,7 +39,7 @@
});
if (res) {
users = await getUsers(localStorage.token);
toast.success('Successfully updated');
toast.success($i18n.t('Successfully updated'));
}
};
@ -115,7 +117,7 @@
/>
</svg>
<div class=" text-xs">Admin Settings</div>
<div class=" text-xs">{$i18n.t('Admin Settings')}</div>
</button>
</div>
</div>
@ -131,10 +133,10 @@
class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
>
<tr>
<th scope="col" class="px-3 py-2"> Role </th>
<th scope="col" class="px-3 py-2"> Name </th>
<th scope="col" class="px-3 py-2"> Email </th>
<th scope="col" class="px-3 py-2"> Action </th>
<th scope="col" class="px-3 py-2"> {$i18n.t('Role')} </th>
<th scope="col" class="px-3 py-2"> {$i18n.t('Name')} </th>
<th scope="col" class="px-3 py-2"> {$i18n.t('Email')} </th>
<th scope="col" class="px-3 py-2"> {$i18n.t('Action')} </th>
</tr>
</thead>
<tbody>

View file

@ -3,7 +3,7 @@
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { WEBUI_NAME, documents } from '$lib/stores';
import { createNewDoc, deleteDocByName, getDocs } from '$lib/apis/documents';
@ -17,6 +17,9 @@
import AddFilesPlaceholder from '$lib/components/AddFilesPlaceholder.svelte';
import SettingsModal from '$lib/components/documents/SettingsModal.svelte';
import AddDocModal from '$lib/components/documents/AddDocModal.svelte';
const i18n = getContext('i18n');
let importFiles = '';
let inputFiles = '';
@ -188,7 +191,7 @@
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class="mb-6">
<div class="flex justify-between items-center">
<div class=" text-2xl font-semibold self-center">My Documents</div>
<div class=" text-2xl font-semibold self-center">{$i18n.t('My Documents')}</div>
<div>
<button
@ -211,7 +214,7 @@
/>
</svg>
<div class=" text-xs">Document Settings</div>
<div class=" text-xs">{$i18n.t('Document Settings')}</div>
</button>
</div>
</div>
@ -274,7 +277,7 @@
on:dragleave={onDragLeave}
>
<div class=" pointer-events-none">
<div class="text-center dark:text-white text-2xl font-semibold z-50">Add Files</div>
<div class="text-center dark:text-white text-2xl font-semibold z-50">{$i18n.t('Add Files')}</div>
<div class=" mt-2 text-center text-sm dark:text-gray-200 w-full">
Drop any files here to add to my documents
@ -314,7 +317,7 @@
// await chats.set(await getChatListByTagName(localStorage.token, tag.name));
}}
>
<div class=" text-xs font-medium self-center line-clamp-1">all</div>
<div class=" text-xs font-medium self-center line-clamp-1">{$i18n.t('all')}</div>
</button>
{#each tags as tag}
@ -344,7 +347,7 @@
// await chats.set(await getChatListByTagName(localStorage.token, tag.name));
}}
>
<div class=" text-xs font-medium self-center line-clamp-1">add tags</div>
<div class=" text-xs font-medium self-center line-clamp-1">{$i18n.t('add tags')}</div>
</button> -->
<button
@ -354,7 +357,9 @@
// await chats.set(await getChatListByTagName(localStorage.token, tag.name));
}}
>
<div class=" text-xs font-medium self-center line-clamp-1">delete</div>
<div class=" text-xs font-medium self-center line-clamp-1">
{$i18n.t('delete')}
</div>
</button>
</div>
</div>
@ -562,7 +567,7 @@
document.getElementById('documents-import-input')?.click();
}}
>
<div class=" self-center mr-2 font-medium">Import Documents Mapping</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Import Documents Mapping')}</div>
<div class=" self-center">
<svg
@ -589,7 +594,7 @@
saveAs(blob, `documents-mapping-export-${Date.now()}.json`);
}}
>
<div class=" self-center mr-2 font-medium">Export Documents Mapping</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Export Documents Mapping')}</div>
<div class=" self-center">
<svg

View file

@ -3,7 +3,7 @@
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { WEBUI_NAME, modelfiles, settings, user } from '$lib/stores';
import { createModel, deleteModel } from '$lib/apis/ollama';
@ -14,6 +14,8 @@
} from '$lib/apis/modelfiles';
import { goto } from '$app/navigation';
const i18n = getContext('i18n');
let localModelfiles = [];
let importFiles;
@ -23,7 +25,7 @@
success = await deleteModel(localStorage.token, tagName);
if (success) {
toast.success(`Deleted ${tagName}`);
toast.success($i18n.t(`Deleted {tagName}`, { tagName }));
}
return success;
@ -36,7 +38,7 @@
};
const shareModelfile = async (modelfile) => {
toast.success('Redirecting you to OpenWebUI Community');
toast.success($i18n.t('Redirecting you to OpenWebUI Community'));
const url = 'https://openwebui.com';
@ -78,7 +80,7 @@
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-3">My Modelfiles</div>
<div class=" text-2xl font-semibold mb-3">{$i18n.t('My Modelfiles')}</div>
<a class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2" href="/modelfiles/create">
<div class=" self-center w-10">
@ -101,8 +103,8 @@
</div>
<div class=" self-center">
<div class=" font-bold">Create a modelfile</div>
<div class=" text-sm">Customize Ollama models for a specific purpose</div>
<div class=" font-bold">{$i18n.t('Create a modelfile')}</div>
<div class=" text-sm">{$i18n.t('Customize Ollama models for a specific purpose')}</div>
</div>
</a>
@ -266,7 +268,7 @@
document.getElementById('modelfiles-import-input')?.click();
}}
>
<div class=" self-center mr-2 font-medium">Import Modelfiles</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Import Modelfiles')}</div>
<div class=" self-center">
<svg
@ -290,7 +292,7 @@
saveModelfiles($modelfiles);
}}
>
<div class=" self-center mr-2 font-medium">Export Modelfiles</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Export Modelfiles')}</div>
<div class=" self-center">
<svg
@ -331,7 +333,7 @@
await modelfiles.set(await getModelfiles(localStorage.token));
}}
>
<div class=" self-center mr-2 font-medium">Sync All</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Sync All')}</div>
<div class=" self-center">
<svg
@ -382,7 +384,7 @@
</div>
<div class=" my-16">
<div class=" text-2xl font-semibold mb-3">Made by OpenWebUI Community</div>
<div class=" text-2xl font-semibold mb-3">{$i18n.t('Made by OpenWebUI Community')}</div>
<a
class=" flex space-x-4 cursor-pointer w-full mb-2 px-3 py-2"
@ -409,8 +411,8 @@
</div>
<div class=" self-center">
<div class=" font-bold">Discover a modelfile</div>
<div class=" text-sm">Discover, download, and explore model presets</div>
<div class=" font-bold">{$i18n.t('Discover a modelfile')}</div>
<div class=" text-sm">{$i18n.t('Discover, download, and explore model presets')}</div>
</div>
</a>
</div>

View file

@ -6,10 +6,12 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
import { splitStream } from '$lib/utils';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
import { createModel } from '$lib/apis/ollama';
import { createNewModelfile, getModelfileByTagName, getModelfiles } from '$lib/apis/modelfiles';
const i18n = getContext('i18n');
let loading = false;
let filesInputElement;
@ -349,7 +351,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
/>
<div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Modelfiles')}</div>
<button
class="flex space-x-1"
@ -371,7 +373,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
@ -418,7 +420,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2 flex space-x-2">
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Name*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Name')}*</div>
<div>
<input
@ -431,7 +433,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Model Tag Name')}*</div>
<div>
<input
@ -445,7 +447,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Description*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Description')}*</div>
<div>
<input
@ -459,7 +461,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Modelfile')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
@ -469,9 +471,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
>
{#if raw}
<span class="ml-2 self-center"> Raw Format </span>
<span class="ml-2 self-center"> {$i18n.t('Raw Format')} </span>
{:else}
<span class="ml-2 self-center"> Builder Mode </span>
<span class="ml-2 self-center"> {$i18n.t('Builder Mode')} </span>
{/if}
</button>
</div>
@ -480,7 +482,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if raw}
<div class="mt-2">
<div class=" text-xs font-semibold mb-2">Content*</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('Content')}*</div>
<div>
<textarea
@ -493,12 +495,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Not sure what to write? Switch to <button
{$i18n.t('Not sure what to write? Switch to')}
<button
class="text-gray-500 dark:text-gray-300 font-medium cursor-pointer"
type="button"
on:click={() => {
raw = !raw;
}}>Builder Mode</button
}}>{$i18n.t('Builder Mode')}</button
>
or
<a
@ -506,13 +509,13 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
href="https://openwebui.com"
target="_blank"
>
Click here to check other modelfiles.
{$i18n.t('Click here to check other modelfiles.')}
</a>
</div>
</div>
{:else}
<div class="my-2">
<div class=" text-xs font-semibold mb-2">From (Base Model)*</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('From (Base Model)')}*</div>
<div>
<input
@ -524,16 +527,17 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
To access the available model names for downloading, <a
{$i18n.t('To access the available model names for downloading,')}
<a
class=" text-gray-500 dark:text-gray-300 font-medium"
href="https://ollama.com/library"
target="_blank">click here.</a
target="_blank">{$i18n.t('click here.')}</a
>
</div>
</div>
<div class="my-1">
<div class=" text-xs font-semibold mb-2">System Prompt</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('System Prompt')}</div>
<div>
<textarea
@ -546,7 +550,9 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile Advanced Settings</div>
<div class=" self-center text-sm font-semibold">
{$i18n.t('Modelfile Advanced Settings')}
</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
@ -556,16 +562,16 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
}}
>
{#if advanced}
<span class="ml-2 self-center"> Custom </span>
<span class="ml-2 self-center">{$i18n.t(' Custom ')}</span>
{:else}
<span class="ml-2 self-center"> Default </span>
<span class="ml-2 self-center">{$i18n.t(' Default ')}</span>
{/if}
</button>
</div>
{#if advanced}
<div class="my-2">
<div class=" text-xs font-semibold mb-2">Template</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('Template')}</div>
<div>
<textarea
@ -578,7 +584,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-xs font-semibold mb-2">Parameters</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('Parameters')}</div>
<div>
<AdvancedParams bind:options />
@ -590,7 +596,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
<div class="my-2">
<div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
@ -647,7 +653,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Categories</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Categories')}</div>
<div class="grid grid-cols-4">
{#each Object.keys(categories) as category}
@ -661,7 +667,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
{#if pullProgress !== null}
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Pull Progress')}</div>
<div class="w-full rounded-full dark:bg-gray-800">
<div
class="dark:bg-gray-600 bg-gray-500 text-xs font-medium text-gray-100 text-center p-0.5 leading-none rounded-full"
@ -684,7 +690,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Create</div>
<div class=" self-center font-medium">{$i18n.t('Save & Create')}</div>
{#if loading}
<div class="ml-1.5 self-center">

View file

@ -3,7 +3,7 @@
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { page } from '$app/stores';
import { settings, user, config, modelfiles } from '$lib/stores';
@ -14,6 +14,8 @@
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
const i18n = getContext('i18n');
let loading = false;
let filesInputElement;
@ -248,7 +250,7 @@
}}
/>
<div class=" text-2xl font-semibold mb-6">My Modelfiles</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Modelfiles')}</div>
<button
class="flex space-x-1"
@ -270,7 +272,7 @@
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
@ -317,7 +319,7 @@
<div class="my-2 flex space-x-2">
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Name*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Name')}*</div>
<div>
<input
@ -330,7 +332,7 @@
</div>
<div class="flex-1">
<div class=" text-sm font-semibold mb-2">Model Tag Name*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Model Tag Name')}*</div>
<div>
<input
@ -345,7 +347,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Description*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Description')}*</div>
<div>
<input
@ -359,13 +361,13 @@
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Modelfile</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Modelfile')}</div>
</div>
<!-- <div class=" text-sm font-semibold mb-2"></div> -->
<div class="mt-2">
<div class=" text-xs font-semibold mb-2">Content*</div>
<div class=" text-xs font-semibold mb-2">{$i18n.t('Content')}*</div>
<div>
<textarea
@ -381,7 +383,7 @@
<div class="my-2">
<div class="flex w-full justify-between mb-2">
<div class=" self-center text-sm font-semibold">Prompt suggestions</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
@ -438,7 +440,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Categories</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Categories')}</div>
<div class="grid grid-cols-4">
{#each Object.keys(categories) as category}
@ -453,7 +455,7 @@
{#if pullProgress !== null}
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Pull Progress</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Pull Progress')}</div>
<div class="w-full rounded-full dark:bg-gray-800">
<div
class="dark:bg-gray-600 text-xs font-medium text-blue-100 text-center p-0.5 leading-none rounded-full"
@ -476,7 +478,7 @@
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Update</div>
<div class=" self-center font-medium">{$i18n.t('Save & Update')}</div>
{#if loading}
<div class="ml-1.5 self-center">

View file

@ -3,17 +3,19 @@
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { WEBUI_NAME, prompts } from '$lib/stores';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { error } from '@sveltejs/kit';
import { goto } from '$app/navigation';
const i18n = getContext('i18n');
let importFiles = '';
let query = '';
const sharePrompt = async (prompt) => {
toast.success('Redirecting you to OpenWebUI Community');
toast.success($i18n.t('Redirecting you to OpenWebUI Community'));
const url = 'https://openwebui.com';
@ -46,7 +48,7 @@
<div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class="mb-6 flex justify-between items-center">
<div class=" text-2xl font-semibold self-center">My Prompts</div>
<div class=" text-2xl font-semibold self-center">{$i18n.t('My Prompts')}</div>
</div>
<div class=" flex w-full space-x-2">
@ -245,7 +247,7 @@
document.getElementById('prompts-import-input')?.click();
}}
>
<div class=" self-center mr-2 font-medium">Import Prompts</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Import Prompts')}</div>
<div class=" self-center">
<svg
@ -273,7 +275,7 @@
saveAs(blob, `prompts-export-${Date.now()}.json`);
}}
>
<div class=" self-center mr-2 font-medium">Export Prompts</div>
<div class=" self-center mr-2 font-medium">{$i18n.t('Export Prompts')}</div>
<div class=" self-center">
<svg
@ -302,7 +304,7 @@
</div>
<div class=" my-16">
<div class=" text-2xl font-semibold mb-3">Made by OpenWebUI Community</div>
<div class=" text-2xl font-semibold mb-3">{$i18n.t('Made by OpenWebUI Community')}</div>
<a
class=" flex space-x-4 cursor-pointer w-full mb-3 px-3 py-2"
@ -329,8 +331,8 @@
</div>
<div class=" self-center">
<div class=" font-bold">Discover a prompt</div>
<div class=" text-sm">Discover, download, and explore custom prompts</div>
<div class=" font-bold">{$i18n.t('Discover a prompt')}</div>
<div class=" text-sm">{$i18n.t('Discover, download, and explore custom prompts')}</div>
</div>
</a>
</div>

View file

@ -3,10 +3,12 @@
import { goto } from '$app/navigation';
import { prompts } from '$lib/stores';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
const i18n = getContext('i18n');
let loading = false;
// ///////////
@ -92,7 +94,7 @@
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class=" flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-6">My Prompts</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div>
<button
class="flex space-x-1"
@ -114,7 +116,7 @@
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
@ -125,7 +127,7 @@
}}
>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Title*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div>
<div>
<input
@ -138,7 +140,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Command*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div>
<div class="flex items-center mb-1">
<div
@ -168,7 +170,7 @@
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Prompt Content*</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div>
</div>
<div class="mt-2">
@ -207,7 +209,7 @@
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Create</div>
<div class=" self-center font-medium">{$i18n.t('Save & Create')}</div>
{#if loading}
<div class="ml-1.5 self-center">

View file

@ -3,7 +3,9 @@
import { goto } from '$app/navigation';
import { prompts } from '$lib/stores';
import { onMount, tick } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
const i18n = getContext('i18n');
import { getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
import { page } from '$app/stores';
@ -74,7 +76,7 @@
<div class="min-h-screen max-h-[100dvh] w-full flex justify-center dark:text-white">
<div class="flex flex-col justify-between w-full overflow-y-auto">
<div class="max-w-2xl mx-auto w-full px-3 md:px-0 my-10">
<div class=" text-2xl font-semibold mb-6">My Prompts</div>
<div class=" text-2xl font-semibold mb-6">{$i18n.t('My Prompts')}</div>
<button
class="flex space-x-1"
@ -96,7 +98,7 @@
/>
</svg>
</div>
<div class=" self-center font-medium text-sm">Back</div>
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
</button>
<hr class="my-3 dark:border-gray-700" />
@ -107,7 +109,7 @@
}}
>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Title*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Title')}*</div>
<div>
<input
@ -120,7 +122,7 @@
</div>
<div class="my-2">
<div class=" text-sm font-semibold mb-2">Command*</div>
<div class=" text-sm font-semibold mb-2">{$i18n.t('Command')}*</div>
<div class="flex items-center mb-1">
<div
@ -151,7 +153,7 @@
<div class="my-2">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-semibold">Prompt Content*</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt Content')}*</div>
</div>
<div class="mt-2">
@ -184,7 +186,7 @@
type="submit"
disabled={loading}
>
<div class=" self-center font-medium">Save & Update</div>
<div class=" self-center font-medium">{$i18n.t('Save & Update')}</div>
{#if loading}
<div class="ml-1.5 self-center">

View file

@ -3,9 +3,11 @@
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
import { toast } from 'svelte-sonner';
const i18n = getContext('i18n');
let loaded = false;
let mode = 'signin';
@ -16,7 +18,7 @@
const setSessionUser = async (sessionUser) => {
if (sessionUser) {
console.log(sessionUser);
toast.success(`You're now logged in.`);
toast.success($i18n.t(`You're now logged in.`));
localStorage.token = sessionUser.token;
await user.set(sessionUser);
goto('/');
@ -109,7 +111,7 @@
<div class="flex flex-col mt-4">
{#if mode === 'signup'}
<div>
<div class=" text-sm font-semibold text-left mb-1">Name</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Name')}</div>
<input
bind:value={name}
type="text"
@ -124,7 +126,7 @@
{/if}
<div class="mb-2">
<div class=" text-sm font-semibold text-left mb-1">Email</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Email')}</div>
<input
bind:value={email}
type="email"
@ -136,7 +138,7 @@
</div>
<div>
<div class=" text-sm font-semibold text-left mb-1">Password</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<input
bind:value={password}
type="password"

View file

@ -1,7 +1,9 @@
<script>
import { goto } from '$app/navigation';
import { WEBUI_NAME, config } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
let loaded = false;
@ -19,22 +21,25 @@
<div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center">
<div class="m-auto pb-44 flex flex-col justify-center">
<div class="max-w-md">
<div class="text-center text-2xl font-medium z-50">{$WEBUI_NAME} Backend Required</div>
<div class="text-center text-2xl font-medium z-50">
{$i18n.t('{{webui_name}} Backend Required', { webui_name: $WEBUI_NAME })}
</div>
<div class=" mt-4 text-center text-sm w-full">
Oops! You're using an unsupported method (frontend only). Please serve the WebUI from
the backend.
{$i18n.t(
"Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend."
)}
<br class=" " />
<br class=" " />
<a
class=" font-semibold underline"
href="https://github.com/open-webui/open-webui#how-to-install-"
target="_blank">See readme.md for instructions</a
target="_blank">{$i18n.t('See readme.md for instructions')}</a
>
or
{$i18n.t('or')}
<a class=" font-semibold underline" href="https://discord.gg/5rJgQTnV4s" target="_blank"
>join our Discord for help.</a
>{$i18n.t('join our Discord for help.')}</a
>
</div>
@ -45,7 +50,7 @@
location.href = '/';
}}
>
Check Again
{$i18n.t('Check Again')}
</button>
</div>
</div>