forked from open-webui/open-webui
feat: Migrate hardcoded strings to i18n calls
This commit is contained in:
parent
7a77f3c2c0
commit
3c471ee2ca
46 changed files with 492 additions and 381 deletions
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue