feat: Change translation keys to fallback strings

This commit is contained in:
Ased Mammad 2024-03-02 14:42:33 +03:30
parent fab89a76b1
commit 7a77f3c2c0
12 changed files with 136 additions and 42 deletions

94
package-lock.json generated
View file

@ -13,6 +13,9 @@
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"highlight.js": "^11.9.0", "highlight.js": "^11.9.0",
"i18next": "^23.10.0",
"i18next-browser-languagedetector": "^7.2.0",
"i18next-resources-to-backend": "^1.2.0",
"idb": "^7.1.1", "idb": "^7.1.1",
"js-sha256": "^0.10.1", "js-sha256": "^0.10.1",
"katex": "^0.16.9", "katex": "^0.16.9",
@ -78,6 +81,17 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.24.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz",
"integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@esbuild/darwin-arm64": { "node_modules/@esbuild/darwin-arm64": {
"version": "0.18.20", "version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz",
@ -1898,6 +1912,44 @@
"node": ">=12.0.0" "node": ">=12.0.0"
} }
}, },
"node_modules/i18next": {
"version": "23.10.0",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.10.0.tgz",
"integrity": "sha512-/TgHOqsa7/9abUKJjdPeydoyDc0oTi/7u9F8lMSj6ufg4cbC1Oj3f/Jja7zj7WRIhEQKB7Q4eN6y68I9RDxxGQ==",
"funding": [
{
"type": "individual",
"url": "https://locize.com"
},
{
"type": "individual",
"url": "https://locize.com/i18next.html"
},
{
"type": "individual",
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
}
],
"dependencies": {
"@babel/runtime": "^7.23.2"
}
},
"node_modules/i18next-browser-languagedetector": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz",
"integrity": "sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==",
"dependencies": {
"@babel/runtime": "^7.23.2"
}
},
"node_modules/i18next-resources-to-backend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/i18next-resources-to-backend/-/i18next-resources-to-backend-1.2.0.tgz",
"integrity": "sha512-8f1l03s+QxDmCfpSXCh9V+AFcxAwIp0UaroWuyOx+hmmv8484GcELHs+lnu54FrNij8cDBEXvEwhzZoXsKcVpg==",
"dependencies": {
"@babel/runtime": "^7.23.2"
}
},
"node_modules/idb": { "node_modules/idb": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz",
@ -2820,6 +2872,11 @@
"node": ">=8.10.0" "node": ">=8.10.0"
} }
}, },
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"node_modules/resolve": { "node_modules/resolve": {
"version": "1.22.6", "version": "1.22.6",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz",
@ -3709,6 +3766,14 @@
"@jridgewell/trace-mapping": "^0.3.9" "@jridgewell/trace-mapping": "^0.3.9"
} }
}, },
"@babel/runtime": {
"version": "7.24.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz",
"integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==",
"requires": {
"regenerator-runtime": "^0.14.0"
}
},
"@esbuild/darwin-arm64": { "@esbuild/darwin-arm64": {
"version": "0.18.20", "version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz",
@ -4979,6 +5044,30 @@
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz",
"integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==" "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="
}, },
"i18next": {
"version": "23.10.0",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.10.0.tgz",
"integrity": "sha512-/TgHOqsa7/9abUKJjdPeydoyDc0oTi/7u9F8lMSj6ufg4cbC1Oj3f/Jja7zj7WRIhEQKB7Q4eN6y68I9RDxxGQ==",
"requires": {
"@babel/runtime": "^7.23.2"
}
},
"i18next-browser-languagedetector": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz",
"integrity": "sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==",
"requires": {
"@babel/runtime": "^7.23.2"
}
},
"i18next-resources-to-backend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/i18next-resources-to-backend/-/i18next-resources-to-backend-1.2.0.tgz",
"integrity": "sha512-8f1l03s+QxDmCfpSXCh9V+AFcxAwIp0UaroWuyOx+hmmv8484GcELHs+lnu54FrNij8cDBEXvEwhzZoXsKcVpg==",
"requires": {
"@babel/runtime": "^7.23.2"
}
},
"idb": { "idb": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz",
@ -5602,6 +5691,11 @@
"picomatch": "^2.2.1" "picomatch": "^2.2.1"
} }
}, },
"regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"resolve": { "resolve": {
"version": "1.22.6", "version": "1.22.6",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz",

View file

@ -671,8 +671,8 @@
placeholder={chatInputPlaceholder !== '' placeholder={chatInputPlaceholder !== ''
? chatInputPlaceholder ? chatInputPlaceholder
: isRecording : isRecording
? $i18n.t('ChatInputPlaceholderListening') ? $i18n.t('Listening...')
: $i18n.t('ChatInputPlaceholder')} : $i18n.t('Send a Messsage')}
bind:value={prompt} bind:value={prompt}
on:keypress={(e) => { on:keypress={(e) => {
if (e.keyCode == 13 && !e.shiftKey) { if (e.keyCode == 13 && !e.shiftKey) {

View file

@ -66,9 +66,9 @@
</div> </div>
{/if} {/if}
{:else} {:else}
<div class=" line-clamp-1">{$i18n.t('Hello', { name: $user.name })}</div> <div class=" line-clamp-1">{$i18n.t('Hello, {{name}}', { name: $user.name })}</div>
<div>{$i18n.t('GreetingPlaceholder')}</div> <div>{$i18n.t('How can I help you today?')}</div>
{/if} {/if}
</div> </div>
</div> </div>

View file

@ -42,7 +42,7 @@
{disabled} {disabled}
> >
<option class=" text-gray-700" value="" selected disabled <option class=" text-gray-700" value="" selected disabled
>{$i18n.t('ModelSelectorPlaceholder')}</option >{$i18n.t('Select a model')}</option
> >
{#each $models as model} {#each $models as model}
@ -137,5 +137,5 @@
</div> </div>
<div class="text-left mt-1.5 text-xs text-gray-500"> <div class="text-left mt-1.5 text-xs text-gray-500">
<button on:click={saveDefaultModel}> {$i18n.t('SetAsDefault')}</button> <button on:click={saveDefaultModel}> {$i18n.t('Set as default')}</button>
</div> </div>

View file

@ -195,10 +195,10 @@
<select <select
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none" class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
bind:value={selectedModel} bind:value={selectedModel}
placeholder={$i18n.t('ModelSelectorPlaceholder')} placeholder={$i18n.t('Select a Model')}
> >
{#if !selectedModel} {#if !selectedModel}
<option value="" disabled selected>{$i18n.t('ModelSelectorPlaceholder')}</option> <option value="" disabled selected>{$i18n.t('Select a Model')}</option>
{/if} {/if}
{#each models ?? [] as model} {#each models ?? [] as model}
<option value={model.title} class="bg-gray-100 dark:bg-gray-700" <option value={model.title} class="bg-gray-100 dark:bg-gray-700"

View file

@ -190,7 +190,7 @@
<select <select
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none" class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
bind:value={titleAutoGenerateModel} bind:value={titleAutoGenerateModel}
placeholder={$i18n.t('ModelSelectorPlaceholder')} placeholder={$i18n.t('Select a Model')}
> >
<option value="" selected>Current Model</option> <option value="" selected>Current Model</option>
{#each $models as model} {#each $models as model}

View file

@ -467,10 +467,10 @@
<select <select
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none" class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={deleteModelTag} bind:value={deleteModelTag}
placeholder={$i18n.t('ModelSelectorPlaceholder')} placeholder={$i18n.t('Select a model')}
> >
{#if !deleteModelTag} {#if !deleteModelTag}
<option value="" disabled selected>{$i18n.t('ModelSelectorPlaceholder')}</option> <option value="" disabled selected>{$i18n.t('Select a model')}</option>
{/if} {/if}
{#each $models.filter((m) => m.size != null) as model} {#each $models.filter((m) => m.size != null) as model}
<option value={model.name} class="bg-gray-100 dark:bg-gray-700" <option value={model.name} class="bg-gray-100 dark:bg-gray-700"
@ -807,10 +807,10 @@
<select <select
class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none" class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={deleteLiteLLMModelId} bind:value={deleteLiteLLMModelId}
placeholder={$i18n.t('ModelSelectorPlaceholder')} placeholder={$i18n.t('Select a model')}
> >
{#if !deleteLiteLLMModelId} {#if !deleteLiteLLMModelId}
<option value="" disabled selected>{$i18n.t('ModelSelectorPlaceholder')}</option <option value="" disabled selected>{$i18n.t('Select a model')}</option
> >
{/if} {/if}
{#each liteLLMModelInfo as model} {#each liteLLMModelInfo as model}

View file

@ -128,7 +128,7 @@
/> />
</div> </div>
<div class=" self-center font-medium text-sm">{$i18n.t('NewChat')}</div> <div class=" self-center font-medium text-sm">{$i18n.t('New Chat')}</div>
</div> </div>
<div class="self-center"> <div class="self-center">

View file

@ -1,10 +1,10 @@
{ {
"NewChat": "Neuer Chat", "New Chat": "Neuer Chat",
"Modelfiles": "Modelfiles", "Modelfiles": "Modelfiles",
"GreetingPlaceholder": "Wie kann ich dir heute behilflich sein?", "How can I help you today?": "Wie kann ich dir heute behilflich sein?",
"Hello": "Hallo, {{name}}", "Hello, {{name}}": "Hallo, {{name}}",
"ChatInputPlaceholderListening": "nimmt auf...", "Listening...": "nimmt auf...",
"ChatInputPlaceholder": "Sende eine Nachricht", "Send a Message": "Sende eine Nachricht",
"ModelSelectorPlaceholder": "Wähle ein Modell", "Select a model": "Wähle ein Modell",
"SetAsDefault": "Als Standard festlegen" "Set as default": "Als Standard festlegen"
} }

View file

@ -1,10 +1,10 @@
{ {
"NewChat": "New Chat", "New Chat": "New Chat",
"Modelfiles": "Modelfiles", "Modelfiles": "Modelfiles",
"GreetingPlaceholder": "How can I help you today?", "How can I help you today?": "How can I help you today?",
"Hello": "Hello, {{name}}", "Hello, {{name}}": "Hello, {{name}}",
"ChatInputPlaceholderListening": "Listening...", "Listenin...": "Listening...",
"ChatInputPlaceholder": "Send a Message", "Send a Message": "Send a Message",
"ModelSelectorPlaceholder": "Select a model", "Select a model": "Select a model",
"SetAsDefault": "Set as default" "Set as default": "Set as default"
} }

View file

@ -1,10 +1,10 @@
{ {
"NewChat": "چت جدید", "New Chat": "چت جدید",
"Modelfiles": "فایل‌های مدل", "Modelfiles": "فایل‌های مدل",
"GreetingPlaceholder": "امروز چطور می توانم کمک تان کنم؟", "How can I help you today?": "امروز چطور می توانم کمک تان کنم؟",
"Hello": "سلام، {{name}}", "Hello, {{name}}": "سلام، {{name}}",
"ChatInputPlaceholderListening": "در حال گوش دادن...", "Listening...": "در حال گوش دادن...",
"ChatInputPlaceholder": "یک پیام ارسال کنید", "Send a Message": "یک پیام ارسال کنید",
"ModelSelectorPlaceholder": "یک مدل انتخاب کنید", "Select a model": "یک مدل انتخاب کنید",
"SetAsDefault": "تنظیم به عنوان پیشفرض" "Set as default": "تنظیم به عنوان پیشفرض"
} }

View file

@ -1,10 +1,10 @@
{ {
"NewChat": "New Chat", "New Chat": "New Chat",
"Modelfiles": "Modelfiles", "Modelfiles": "Modelfiles",
"GreetingPlaceholder": "How can I help you today?", "How can I help you today?": "How can I help you today?",
"Hello": "Hello, {{name}}", "Hello, {{name}}": "Hello, {{name}}",
"ChatInputPlaceholderListening": "Listening...", "Listening...": "Listening...",
"ChatInputPlaceholder": "Send a Message", "Send a Message": "Send a Message",
"ModelSelectorPlaceholder": "Select a model", "Select a model": "Select a model",
"SetAsDefault": "Set as default" "Set as default": "Set as default"
} }