From 26121c5d881b2d34ed90eb0cca0abb4edabe07ff Mon Sep 17 00:00:00 2001 From: Ased Mammad Date: Sun, 24 Mar 2024 06:46:18 +0330 Subject: [PATCH 1/3] wip: Set default language from config --- backend/data/config.json | 1 + backend/main.py | 6 ++--- src/lib/i18n/index.ts | 54 ++++++++++++++++++++++----------------- src/routes/+layout.svelte | 7 ++++- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/backend/data/config.json b/backend/data/config.json index cd6687d7..7d15c9e6 100644 --- a/backend/data/config.json +++ b/backend/data/config.json @@ -1,6 +1,7 @@ { "version": 0, "ui": { + "locale": "en-US", "prompt_suggestions": [ { "title": [ diff --git a/backend/main.py b/backend/main.py index d4b67079..6a520621 100644 --- a/backend/main.py +++ b/backend/main.py @@ -32,6 +32,7 @@ from utils.utils import get_admin_user from apps.rag.utils import rag_messages from config import ( + CONFIG_DATA, WEBUI_NAME, ENV, VERSION, @@ -88,7 +89,6 @@ class RAGMiddleware(BaseHTTPMiddleware): # Example: Add a new key-value pair or modify existing ones # data["modified"] = True # Example modification if "docs" in data: - data = {**data} data["messages"] = rag_messages( data["docs"], @@ -163,11 +163,11 @@ app.mount("/rag/api/v1", rag_app) @app.get("/api/config") async def get_app_config(): - return { "status": True, "name": WEBUI_NAME, "version": VERSION, + "locale": CONFIG_DATA["ui"]["locale"], "images": images_app.state.ENABLED, "default_models": webui_app.state.DEFAULT_MODELS, "default_prompt_suggestions": webui_app.state.DEFAULT_PROMPT_SUGGESTIONS, @@ -191,7 +191,6 @@ class ModelFilterConfigForm(BaseModel): async def update_model_filter_config( form_data: ModelFilterConfigForm, user=Depends(get_admin_user) ): - app.state.MODEL_FILTER_ENABLED = form_data.enabled app.state.MODEL_FILTER_LIST = form_data.models @@ -231,7 +230,6 @@ async def update_webhook_url(form_data: UrlForm, user=Depends(get_admin_user)): @app.get("/api/version") async def get_app_config(): - return { "version": VERSION, } diff --git a/src/lib/i18n/index.ts b/src/lib/i18n/index.ts index 23edb2e1..b0580345 100644 --- a/src/lib/i18n/index.ts +++ b/src/lib/i18n/index.ts @@ -37,30 +37,36 @@ const createIsLoadingStore = (i18n: i18nType) => { return isLoading; }; -i18next - .use( - resourcesToBackend( - (language: string, namespace: string) => import(`./locales/${language}/${namespace}.json`) - ) - ) - .use(LanguageDetector) - .init({ - debug: false, - detection: { - order: ['querystring', 'localStorage', 'navigator'], - caches: ['localStorage'], - lookupQuerystring: 'lang', - lookupLocalStorage: 'locale' - }, - fallbackLng: { - default: ['en-US'] - }, - ns: 'translation', - returnEmptyString: false, - interpolation: { - escapeValue: false // not needed for svelte as it escapes by default - } - }); +export const initI18n = (defaultLocale: string) => { + let detectionOrder = defaultLocale + ? ['querystring', 'localStorage'] + : ['querystring', 'localStorage', 'navigator']; + let fallbackDefaultLocale = defaultLocale ? [defaultLocale] : ['en-US']; + + const loadResource = (language: string, namespace: string) => + import(`./locales/${language}/${namespace}.json`); + + i18next + .use(resourcesToBackend(loadResource)) + .use(LanguageDetector) + .init({ + debug: false, + detection: { + order: detectionOrder, + caches: ['localStorage'], + lookupQuerystring: 'lang', + lookupLocalStorage: 'locale' + }, + fallbackLng: { + default: fallbackDefaultLocale + }, + ns: 'translation', + returnEmptyString: false, + interpolation: { + escapeValue: false // not needed for svelte as it escapes by default + } + }); +}; const i18n = createI18nStore(i18next); const isLoadingStore = createIsLoadingStore(i18next); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 865155ee..3334e0d2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -11,7 +11,7 @@ import '../tailwind.css'; import 'tippy.js/dist/tippy.css'; import { WEBUI_BASE_URL } from '$lib/constants'; - import i18n from '$lib/i18n'; + import i18n, { initI18n } from '$lib/i18n'; setContext('i18n', i18n); @@ -25,6 +25,11 @@ if (backendConfig) { // Save Backend Status to Store await config.set(backendConfig); + if ($config.locale) { + initI18n($config.locale); + } else { + initI18n(); + } await WEBUI_NAME.set(backendConfig.name); console.log(backendConfig); From 64e60036275a5200faeade6112c62bc91e30389f Mon Sep 17 00:00:00 2001 From: Ased Mammad Date: Tue, 26 Mar 2024 23:04:01 +0330 Subject: [PATCH 2/3] refac: Remove translation values for en-US Translation values for en-US are not necessary, the keys will be used as fallback. --- src/lib/i18n/locales/en-US/translation.json | 662 ++++++++++---------- 1 file changed, 331 insertions(+), 331 deletions(-) diff --git a/src/lib/i18n/locales/en-US/translation.json b/src/lib/i18n/locales/en-US/translation.json index 57f3d432..251834e0 100644 --- a/src/lib/i18n/locales/en-US/translation.json +++ b/src/lib/i18n/locales/en-US/translation.json @@ -1,128 +1,128 @@ { - "'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.": "'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.", - "(Beta)": "(Beta)", - "(e.g. `sh webui.sh --api`)": "(e.g. `sh webui.sh --api`)", - "(latest)": "(latest)", - "{{modelName}} is thinking...": "{{modelName}} is thinking...", - "{{webUIName}} Backend Required": "{{webUIName}} Backend Required", + "'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.": "", + "(Beta)": "", + "(e.g. `sh webui.sh --api`)": "", + "(latest)": "", + "{{modelName}} is thinking...": "", + "{{webUIName}} Backend Required": "", "a user": "", - "About": "About", - "Account": "Account", - "Action": "Action", - "Add a model": "Add a model", - "Add a model tag name": "Add a model tag name", - "Add a short description about what this modelfile does": "Add a short description about what this modelfile does", - "Add a short title for this prompt": "Add a short title for this prompt", - "Add a tag": "Add a tag", - "Add Docs": "Add Docs", - "Add Files": "Add Files", - "Add message": "Add message", - "add tags": "add tags", - "Adjusting these settings will apply changes universally to all users.": "Adjusting these settings will apply changes universally to all users.", - "admin": "admin", - "Admin Panel": "Admin Panel", - "Admin Settings": "Admin Settings", - "Advanced Parameters": "Advanced Parameters", - "all": "all", - "All Users": "All Users", - "Allow": "Allow", - "Allow Chat Deletion": "Allow Chat Deletion", - "alphanumeric characters and hyphens": "alphanumeric characters and hyphens", - "Already have an account?": "Already have an account?", + "About": "", + "Account": "", + "Action": "", + "Add a model": "", + "Add a model tag name": "", + "Add a short description about what this modelfile does": "", + "Add a short title for this prompt": "", + "Add a tag": "", + "Add Docs": "", + "Add Files": "", + "Add message": "", + "add tags": "", + "Adjusting these settings will apply changes universally to all users.": "", + "admin": "", + "Admin Panel": "", + "Admin Settings": "", + "Advanced Parameters": "", + "all": "", + "All Users": "", + "Allow": "", + "Allow Chat Deletion": "", + "alphanumeric characters and hyphens": "", + "Already have an account?": "", "an assistant": "", - "and": "and", - "API Base URL": "API Base URL", - "API Key": "API Key", - "API RPM": "API RPM", - "are allowed - Activate this command by typing": "are allowed - Activate this command by typing", + "and": "", + "API Base URL": "", + "API Key": "", + "API RPM": "", + "are allowed - Activate this command by typing": "", "Are you sure?": "", - "Audio": "Audio", - "Auto-playback response": "Auto-playback response", - "Auto-send input after 3 sec.": "Auto-send input after 3 sec.", - "AUTOMATIC1111 Base URL": "AUTOMATIC1111 Base URL", + "Audio": "", + "Auto-playback response": "", + "Auto-send input after 3 sec.": "", + "AUTOMATIC1111 Base URL": "", "AUTOMATIC1111 Base URL is required.": "", - "available!": "available!", - "Back": "Back", - "Builder Mode": "Builder Mode", - "Cancel": "Cancel", - "Categories": "Categories", - "Change Password": "Change Password", - "Chat": "Chat", - "Chat History": "Chat History", - "Chat History is off for this browser.": "Chat History is off for this browser.", - "Chats": "Chats", - "Check Again": "Check Again", - "Check for updates": "Check for updates", - "Checking for updates...": "Checking for updates...", - "Choose a model before saving...": "Choose a model before saving...", - "Chunk Overlap": "Chunk Overlap", - "Chunk Params": "Chunk Params", - "Chunk Size": "Chunk Size", - "Click here for help.": "Click here for help.", - "Click here to check other modelfiles.": "Click here to check other modelfiles.", + "available!": "", + "Back": "", + "Builder Mode": "", + "Cancel": "", + "Categories": "", + "Change Password": "", + "Chat": "", + "Chat History": "", + "Chat History is off for this browser.": "", + "Chats": "", + "Check Again": "", + "Check for updates": "", + "Checking for updates...": "", + "Choose a model before saving...": "", + "Chunk Overlap": "", + "Chunk Params": "", + "Chunk Size": "", + "Click here for help.": "", + "Click here to check other modelfiles.": "", "Click here to select": "", "Click here to select documents.": "", - "click here.": "click here.", - "Click on the user role button to change a user's role.": "Click on the user role button to change a user's role.", - "Close": "Close", - "Collection": "Collection", - "Command": "Command", - "Confirm Password": "Confirm Password", - "Connections": "Connections", - "Content": "Content", - "Context Length": "Context Length", - "Conversation Mode": "Conversation Mode", - "Copy last code block": "Copy last code block", - "Copy last response": "Copy last response", - "Copying to clipboard was successful!": "Copying to clipboard was successful!", - "Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':": "Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':", - "Create a modelfile": "Create a modelfile", - "Create Account": "Create Account", - "Created at": "Created at", - "Created by": "Created by", - "Current Model": "Current Model", - "Current Password": "Current Password", - "Custom": "Custom", - "Customize Ollama models for a specific purpose": "Customize Ollama models for a specific purpose", - "Dark": "Dark", - "Database": "Database", - "DD/MM/YYYY HH:mm": "DD/MM/YYYY HH:mm", - "Default": "Default", + "click here.": "", + "Click on the user role button to change a user's role.": "", + "Close": "", + "Collection": "", + "Command": "", + "Confirm Password": "", + "Connections": "", + "Content": "", + "Context Length": "", + "Conversation Mode": "", + "Copy last code block": "", + "Copy last response": "", + "Copying to clipboard was successful!": "", + "Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title':": "", + "Create a modelfile": "", + "Create Account": "", + "Created at": "", + "Created by": "", + "Current Model": "", + "Current Password": "", + "Custom": "", + "Customize Ollama models for a specific purpose": "", + "Dark": "", + "Database": "", + "DD/MM/YYYY HH:mm": "", + "Default": "", "Default (Automatic1111)": "", - "Default (Web API)": "Default (Web API)", - "Default model updated": "Default model updated", - "Default Prompt Suggestions": "Default Prompt Suggestions", - "Default User Role": "Default User Role", - "delete": "delete", - "Delete a model": "Delete a model", - "Delete chat": "Delete chat", - "Delete Chats": "Delete Chats", - "Deleted {{deleteModelTag}}": "Deleted {{deleteModelTag}}", - "Deleted {tagName}": "Deleted {tagName}", - "Description": "Description", - "Desktop Notifications": "Notification", - "Disabled": "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", - "Display the username instead of You in the Chat": "Display the username instead of 'You' in the Chat", - "Document": "Document", - "Document Settings": "Document Settings", - "Documents": "Documents", - "does not make any external connections, and your data stays securely on your locally hosted server.": "does not make any external connections, and your data stays securely on your locally hosted server.", - "Don't Allow": "Don't Allow", - "Don't have an account?": "Don't have an account?", - "Download as a File": "Download as a File", - "Download Database": "Download Database", - "Drop any files here to add to the conversation": "Drop any files here to add to the conversation", - "e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.": "e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.", - "Edit Doc": "Edit Doc", - "Edit User": "Edit User", - "Email": "Email", - "Enable Chat History": "Enable Chat History", - "Enable New Sign Ups": "Enable New Sign Ups", - "Enabled": "Enabled", + "Default (Web API)": "", + "Default model updated": "", + "Default Prompt Suggestions": "", + "Default User Role": "", + "delete": "", + "Delete a model": "", + "Delete chat": "", + "Delete Chats": "", + "Deleted {{deleteModelTag}}": "", + "Deleted {tagName}": "", + "Description": "", + "Desktop Notifications": "", + "Disabled": "", + "Discover a modelfile": "", + "Discover a prompt": "", + "Discover, download, and explore custom prompts": "", + "Discover, download, and explore model presets": "", + "Display the username instead of You in the Chat": "", + "Document": "", + "Document Settings": "", + "Documents": "", + "does not make any external connections, and your data stays securely on your locally hosted server.": "", + "Don't Allow": "", + "Don't have an account?": "", + "Download as a File": "", + "Download Database": "", + "Drop any files here to add to the conversation": "", + "e.g. '30s','10m'. Valid time units are 's', 'm', 'h'.": "", + "Edit Doc": "", + "Edit User": "", + "Email": "", + "Enable Chat History": "", + "Enable New Sign Ups": "", + "Enabled": "", "Enter {{role}} message here": "", "Enter API Key": "", "Enter Chunk Overlap": "", @@ -135,229 +135,229 @@ "Enter Max Tokens (litellm_params.max_tokens)": "", "Enter model tag (e.g. {{modelTag}})": "", "Enter Number of Steps (e.g. 50)": "", - "Enter stop sequence": "Enter stop sequence", + "Enter stop sequence": "", "Enter Top K": "", "Enter URL (e.g. http://127.0.0.1:7860/)": "", - "Enter Your Email": "Enter Your Email", - "Enter Your Full Name": "Enter Your Full Name", - "Enter Your Password": "Enter Your Password", - "Experimental": "Experimental", - "Export All Chats (All Users)": "Export All Chats (All Users)", - "Export Chats": "Export Chats", - "Export Documents Mapping": "Export Documents Mapping", - "Export Modelfiles": "Export Modelfiles", - "Export Prompts": "Export Prompts", - "Failed to read clipboard contents": "Failed to read clipboard contents", - "File Mode": "File Mode", - "File not found.": "File not found.", - "Focus chat input": "Focus chat input", - "Format your variables using square brackets like this:": "Format your variables using square brackets like this:", - "From (Base Model)": "From (Base Model)", - "Full Screen Mode": "Full Screen Mode", - "General": "General", - "General Settings": "General Settings", - "Hello, {{name}}": "Hello, {{name}}", - "Hide": "Hide", - "Hide Additional Params": "Hide Additional Params", - "How can I help you today?": "How can I help you today?", - "Image Generation (Experimental)": "Image Generation (Experimental)", + "Enter Your Email": "", + "Enter Your Full Name": "", + "Enter Your Password": "", + "Experimental": "", + "Export All Chats (All Users)": "", + "Export Chats": "", + "Export Documents Mapping": "", + "Export Modelfiles": "", + "Export Prompts": "", + "Failed to read clipboard contents": "", + "File Mode": "", + "File not found.": "", + "Focus chat input": "", + "Format your variables using square brackets like this:": "", + "From (Base Model)": "", + "Full Screen Mode": "", + "General": "", + "General Settings": "", + "Hello, {{name}}": "", + "Hide": "", + "Hide Additional Params": "", + "How can I help you today?": "", + "Image Generation (Experimental)": "", "Image Generation Engine": "", - "Image Settings": "Image Settings", - "Images": "Images", - "Import Chats": "Import Chats", - "Import Documents Mapping": "Import Documents Mapping", - "Import Modelfiles": "Import Modelfiles", - "Import Prompts": "Import Prompts", - "Include `--api` flag when running stable-diffusion-webui": "Include `--api` flag when running stable-diffusion-webui", - "Interface": "Interface", - "join our Discord for help.": "join our Discord for help.", - "JSON": "JSON", - "JWT Expiration": "JWT Expiration", - "JWT Token": "JWT Token", - "Keep Alive": "Keep Alive", - "Keyboard shortcuts": "Keyboard shortcuts", - "Language": "Language", - "Light": "Light", - "Listening...": "Listening...", - "LLMs can make mistakes. Verify important information.": "LLMs can make mistakes. Verify important information.", - "Made by OpenWebUI Community": "Made by OpenWebUI Community", - "Make sure to enclose them with": "Make sure to enclose them with", - "Manage LiteLLM Models": "Manage LiteLLM Models", - "Manage Models": "Manage Models", - "Manage Ollama Models": "Manage Ollama Models", - "Max Tokens": "Max Tokens", - "Maximum of 3 models can be downloaded simultaneously. Please try again later.": "Maximum of 3 models can be downloaded simultaneously. Please try again later.", - "Mirostat": "Mirostat", - "Mirostat Eta": "Mirostat Eta", - "Mirostat Tau": "Mirostat Tau", - "MMMM DD, YYYY": "MMMM DD, YYYY", - "Model '{{modelName}}' has been successfully downloaded.": "Model '{{modelName}}' has been successfully downloaded.", - "Model '{{modelTag}}' is already in queue for downloading.": "Model '{{modelTag}}' is already in queue for downloading.", - "Model {{modelId}} not found": "Model {{modelId}} not found", - "Model {{modelName}} already exists.": "Model {{modelName}} already exists.", - "Model Name": "Model Name", - "Model not selected": "Model not selected", - "Model Tag Name": "Model Tag Name", - "Model Whitelisting": "Model Whitelisting", - "Model(s) Whitelisted": "Model(s) Whitelisted", - "Modelfile": "Modelfile", - "Modelfile Advanced Settings": "Modelfile Advanced Settings", - "Modelfile Content": "Modelfile Content", - "Modelfiles": "Modelfiles", - "Models": "Models", - "My Documents": "My Documents", - "My Modelfiles": "My Modelfiles", - "My Prompts": "My Prompts", - "Name": "Name", - "Name Tag": "Name Tag", - "Name your modelfile": "Name your modelfile", - "New Chat": "New Chat", - "New Password": "New Password", - "Not sure what to add?": "Not sure what to add?", - "Not sure what to write? Switch to": "Not sure what to write? Switch to", - "Off": "Off", - "Okay, Let's Go!": "Okay, Let's Go!", + "Image Settings": "", + "Images": "", + "Import Chats": "", + "Import Documents Mapping": "", + "Import Modelfiles": "", + "Import Prompts": "", + "Include `--api` flag when running stable-diffusion-webui": "", + "Interface": "", + "join our Discord for help.": "", + "JSON": "", + "JWT Expiration": "", + "JWT Token": "", + "Keep Alive": "", + "Keyboard shortcuts": "", + "Language": "", + "Light": "", + "Listening...": "", + "LLMs can make mistakes. Verify important information.": "", + "Made by OpenWebUI Community": "", + "Make sure to enclose them with": "", + "Manage LiteLLM Models": "", + "Manage Models": "", + "Manage Ollama Models": "", + "Max Tokens": "", + "Maximum of 3 models can be downloaded simultaneously. Please try again later.": "", + "Mirostat": "", + "Mirostat Eta": "", + "Mirostat Tau": "", + "MMMM DD, YYYY": "", + "Model '{{modelName}}' has been successfully downloaded.": "", + "Model '{{modelTag}}' is already in queue for downloading.": "", + "Model {{modelId}} not found": "", + "Model {{modelName}} already exists.": "", + "Model Name": "", + "Model not selected": "", + "Model Tag Name": "", + "Model Whitelisting": "", + "Model(s) Whitelisted": "", + "Modelfile": "", + "Modelfile Advanced Settings": "", + "Modelfile Content": "", + "Modelfiles": "", + "Models": "", + "My Documents": "", + "My Modelfiles": "", + "My Prompts": "", + "Name": "", + "Name Tag": "", + "Name your modelfile": "", + "New Chat": "", + "New Password": "", + "Not sure what to add?": "", + "Not sure what to write? Switch to": "", + "Off": "", + "Okay, Let's Go!": "", "Ollama Base URL": "", - "Ollama Version": "Ollama Version", - "On": "On", - "Only": "Only", - "Only alphanumeric characters and hyphens are allowed in the command string.": "Only alphanumeric characters and hyphens are allowed in the command string.", - "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.", - "Oops! Looks like the URL is invalid. Please double-check and try again.": "Oops! Looks like the URL is invalid. Please double-check and try again.", - "Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend.": "Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend.", - "Open": "Open", - "Open AI": "Open AI", + "Ollama Version": "", + "On": "", + "Only": "", + "Only alphanumeric characters and hyphens are allowed in the command string.": "", + "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! Looks like the URL is invalid. Please double-check and try again.": "", + "Oops! You're using an unsupported method (frontend only). Please serve the WebUI from the backend.": "", + "Open": "", + "Open AI": "", "Open AI (Dall-E)": "", - "Open new chat": "Open new chat", - "OpenAI API": "OpenAI API", + "Open new chat": "", + "OpenAI API": "", "OpenAI API Key": "", "OpenAI API Key is required.": "", - "or": "or", - "Parameters": "Parameters", - "Password": "Password", - "PDF Extract Images (OCR)": "PDF Extract Images (OCR)", - "pending": "pending", - "Permission denied when accessing microphone: {{error}}": "Permission denied when accessing microphone: {{error}}", - "Playground": "Playground", - "Profile": "Profile", - "Prompt Content": "Prompt Content", - "Prompt suggestions": "Prompt suggestions", - "Prompts": "Prompts", - "Pull a model from Ollama.com": "Pull a model from Ollama.com", - "Pull Progress": "Pull Progress", - "Query Params": "Query Params", - "RAG Template": "RAG Template", - "Raw Format": "Raw Format", - "Record voice": "Record voice", - "Redirecting you to OpenWebUI Community": "Redirecting you to OpenWebUI Community", - "Release Notes": "Release Notes", - "Repeat Last N": "Repeat Last N", - "Repeat Penalty": "Repeat Penalty", - "Request Mode": "Request Mode", - "Reset Vector Storage": "Reset Vector Storage", - "Response AutoCopy to Clipboard": "Response AutoCopy to Clipboard", - "Role": "Role", - "Rosé Pine": "Rosé Pine", - "Rosé Pine Dawn": "Rosé Pine Dawn", - "Save": "Save", - "Save & Create": "Save & Create", - "Save & Submit": "Save & Submit", - "Save & Update": "Save & Update", - "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": "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", - "Scan": "Scan", - "Scan complete!": "Scan complete!", - "Scan for documents from {{path}}": "Scan for documents from {{path}}", - "Search": "Search", - "Search Documents": "Search Documents", - "Search Prompts": "Search Prompts", - "See readme.md for instructions": "See readme.md for instructions", - "See what's new": "See what's new", - "Seed": "Seed", + "or": "", + "Parameters": "", + "Password": "", + "PDF Extract Images (OCR)": "", + "pending": "", + "Permission denied when accessing microphone: {{error}}": "", + "Playground": "", + "Profile": "", + "Prompt Content": "", + "Prompt suggestions": "", + "Prompts": "", + "Pull a model from Ollama.com": "", + "Pull Progress": "", + "Query Params": "", + "RAG Template": "", + "Raw Format": "", + "Record voice": "", + "Redirecting you to OpenWebUI Community": "", + "Release Notes": "", + "Repeat Last N": "", + "Repeat Penalty": "", + "Request Mode": "", + "Reset Vector Storage": "", + "Response AutoCopy to Clipboard": "", + "Role": "", + "Rosé Pine": "", + "Rosé Pine Dawn": "", + "Save": "", + "Save & Create": "", + "Save & Submit": "", + "Save & Update": "", + "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": "", + "Scan": "", + "Scan complete!": "", + "Scan for documents from {{path}}": "", + "Search": "", + "Search Documents": "", + "Search Prompts": "", + "See readme.md for instructions": "", + "See what's new": "", + "Seed": "", "Select a mode": "", - "Select a model": "Select a model", + "Select a model": "", "Select an Ollama instance": "", - "Send a Message": "Send a Message", - "Send message": "Send message", - "Server connection verified": "Server connection verified", - "Set as default": "Set as default", - "Set Default Model": "Set Default Model", - "Set Image Size": "Set Image Size", - "Set Steps": "Set Steps", - "Set Title Auto-Generation Model": "Set Title Auto-Generation Model", - "Set Voice": "Set Voice", - "Settings": "Settings", - "Settings saved successfully!": "Settings saved successfully!", - "Share to OpenWebUI Community": "Share to OpenWebUI Community", - "short-summary": "short-summary", - "Show": "Show", - "Show Additional Params": "Show Additional Params", - "Show shortcuts": "Show shortcuts", - "sidebar": "sidebar", - "Sign in": "Sign in", - "Sign Out": "Sign Out", - "Sign up": "Sign up", - "Speech recognition error: {{error}}": "Speech recognition error: {{error}}", - "Speech-to-Text Engine": "Speech-to-Text Engine", - "SpeechRecognition API is not supported in this browser.": "SpeechRecognition API is not supported in this browser.", - "Stop Sequence": "Stop Sequence", - "STT Settings": "STT Settings", - "Submit": "Submit", - "Success": "Success", - "Successfully updated.": "Successfully updated.", - "Sync All": "Sync All", - "System": "System", - "System Prompt": "System Prompt", - "Tags": "Tags", - "Temperature": "Temperature", - "Template": "Template", - "Text Completion": "Text Completion", - "Text-to-Speech Engine": "Text-to-Speech Engine", - "Tfs Z": "Tfs Z", - "Theme": "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!", - "This setting does not sync across browsers or devices.": "This setting does not sync across browsers or devices.", - "Tip: Update multiple variable slots consecutively by pressing the tab key in the chat input after each replacement.": "Tip: Update multiple variable slots consecutively by pressing the tab key in the chat input after each replacement.", - "Title": "Title", - "Title Auto-Generation": "Title Auto-Generation", - "Title Generation Prompt": "Title Generation Prompt", - "to": "to", - "To access the available model names for downloading,": "To access the available model names for downloading,", - "To access the GGUF models available for downloading,": "To access the GGUF models available for downloading,", - "to chat input.": "to chat input.", - "Toggle settings": "Toggle settings", - "Toggle sidebar": "Toggle sidebar", - "Top K": "Top K", - "Top P": "Top P", - "Trouble accessing Ollama?": "Trouble accessing Ollama?", - "TTS Settings": "TTS Settings", + "Send a Message": "", + "Send message": "", + "Server connection verified": "", + "Set as default": "", + "Set Default Model": "", + "Set Image Size": "", + "Set Steps": "", + "Set Title Auto-Generation Model": "", + "Set Voice": "", + "Settings": "", + "Settings saved successfully!": "", + "Share to OpenWebUI Community": "", + "short-summary": "", + "Show": "", + "Show Additional Params": "", + "Show shortcuts": "", + "sidebar": "", + "Sign in": "", + "Sign Out": "", + "Sign up": "", + "Speech recognition error: {{error}}": "", + "Speech-to-Text Engine": "", + "SpeechRecognition API is not supported in this browser.": "", + "Stop Sequence": "", + "STT Settings": "", + "Submit": "", + "Success": "", + "Successfully updated.": "", + "Sync All": "", + "System": "", + "System Prompt": "", + "Tags": "", + "Temperature": "", + "Template": "", + "Text Completion": "", + "Text-to-Speech Engine": "", + "Tfs Z": "", + "Theme": "", + "This ensures that your valuable conversations are securely saved to your backend database. Thank you!": "", + "This setting does not sync across browsers or devices.": "", + "Tip: Update multiple variable slots consecutively by pressing the tab key in the chat input after each replacement.": "", + "Title": "", + "Title Auto-Generation": "", + "Title Generation Prompt": "", + "to": "", + "To access the available model names for downloading,": "", + "To access the GGUF models available for downloading,": "", + "to chat input.": "", + "Toggle settings": "", + "Toggle sidebar": "", + "Top K": "", + "Top P": "", + "Trouble accessing Ollama?": "", + "TTS Settings": "", "Type Hugging Face Resolve (Download) URL": "", - "Uh-oh! There was an issue connecting to {{provider}}.": "Uh-oh! There was an issue connecting to {{provider}}.", - "Unknown File Type '{{file_type}}', but accepting and treating as plain text": "Unknown File Type '{{file_type}}', but accepting and treating as plain text", - "Update password": "Update password", - "Upload a GGUF model": "Upload a GGUF model", - "Upload files": "Upload files", - "Upload Progress": "Upload Progress", - "URL Mode": "URL Mode", - "Use '#' in the prompt input to load and select your documents.": "Use '#' in the prompt input to load and select your documents.", + "Uh-oh! There was an issue connecting to {{provider}}.": "", + "Unknown File Type '{{file_type}}', but accepting and treating as plain text": "", + "Update password": "", + "Upload a GGUF model": "", + "Upload files": "", + "Upload Progress": "", + "URL Mode": "", + "Use '#' in the prompt input to load and select your documents.": "", "Use Gravatar": "", - "user": "user", - "User Permissions": "User Permissions", - "Users": "Users", - "Utilize": "Utilize", - "Valid time units:": "Valid time units:", - "variable": "variable", - "variable to have them replaced with clipboard content.": "variable to have them replaced with clipboard content.", - "Version": "Version", - "Web": "Web", - "WebUI Add-ons": "WebUI Add-ons", - "WebUI Settings": "WebUI Settings", - "WebUI will make requests to": "WebUI will make requests to", - "What’s New in": "What’s New in", - "When history is turned off, new chats on this browser won't appear in your history on any of your devices.": "When history is turned off, new chats on this browser won't appear in your history on any of your devices.", - "Whisper (Local)": "Whisper (Local)", - "Write a prompt suggestion (e.g. Who are you?)": "Write a prompt suggestion (e.g. Who are you?)", - "Write a summary in 50 words that summarizes [topic or keyword].": "Write a summary in 50 words that summarizes [topic or keyword].", - "You": "You", - "You're a helpful assistant.": "You're a helpful assistant.", - "You're now logged in.": "You're now logged in." + "user": "", + "User Permissions": "", + "Users": "", + "Utilize": "", + "Valid time units:": "", + "variable": "", + "variable to have them replaced with clipboard content.": "", + "Version": "", + "Web": "", + "WebUI Add-ons": "", + "WebUI Settings": "", + "WebUI will make requests to": "", + "What’s New in": "", + "When history is turned off, new chats on this browser won't appear in your history on any of your devices.": "", + "Whisper (Local)": "", + "Write a prompt suggestion (e.g. Who are you?)": "", + "Write a summary in 50 words that summarizes [topic or keyword].": "", + "You": "", + "You're a helpful assistant.": "", + "You're now logged in.": "" } From 0c021e42f5c4f50444d6223221a884c5c7501ddf Mon Sep 17 00:00:00 2001 From: Ased Mammad Date: Tue, 26 Mar 2024 23:15:51 +0330 Subject: [PATCH 3/3] rename config key to default_locale --- backend/data/config.json | 2 +- backend/main.py | 2 +- src/routes/+layout.svelte | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/data/config.json b/backend/data/config.json index 7d15c9e6..91259c3f 100644 --- a/backend/data/config.json +++ b/backend/data/config.json @@ -1,7 +1,7 @@ { "version": 0, "ui": { - "locale": "en-US", + "default_locale": "en-US", "prompt_suggestions": [ { "title": [ diff --git a/backend/main.py b/backend/main.py index 6a520621..b118c673 100644 --- a/backend/main.py +++ b/backend/main.py @@ -167,7 +167,7 @@ async def get_app_config(): "status": True, "name": WEBUI_NAME, "version": VERSION, - "locale": CONFIG_DATA["ui"]["locale"], + "default_locale": CONFIG_DATA["ui"]["default_locale"], "images": images_app.state.ENABLED, "default_models": webui_app.state.DEFAULT_MODELS, "default_prompt_suggestions": webui_app.state.DEFAULT_PROMPT_SUGGESTIONS, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 3334e0d2..4ab2a62e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -25,8 +25,8 @@ if (backendConfig) { // Save Backend Status to Store await config.set(backendConfig); - if ($config.locale) { - initI18n($config.locale); + if ($config.default_locale) { + initI18n($config.default_locale); } else { initI18n(); }