import { signal } from "@preact/signals";

export type Locale = "en" | "zh";

function detectLocale(): Locale {
  const lang = navigator.language || "";
  return lang.startsWith("zh") ? "zh" : "en";
}

export const locale = signal<Locale>(detectLocale());

export function setLocale(l: Locale) {
  locale.value = l;
  localStorage.setItem("csghub-locale", l);
}

const saved = localStorage.getItem("csghub-locale");
if (saved === "en" || saved === "zh") locale.value = saved;

const en: Record<string, string> = {
  // Nav
  "nav.dashboard": "Dashboard",
  "nav.marketplace": "Marketplace",
  "nav.library": "Models",
  "nav.chat": "Chat",
  "nav.images": "Images",
  "nav.aiApps": "AI Apps",
  "nav.aiGateway": "AI Gateway",

  // Dashboard
  "dash.resource": "RESOURCE UTILIZATION",
  "dash.updates": "Updates every 3s",
  "dash.cpu": "CPU USAGE",
  "dash.ram": "RAM USAGE",
  "dash.gpu": "GPU Memory",
  "dash.na": "N/A",
  "dash.totalOnly": "{0} GB total",
  "dash.unifiedMemory": "Unified memory",
  "dash.usageUnavailable": "Live usage unavailable",
  "dash.active": "ACTIVE INFERENCE MODELS",
  "dash.noModels": "No models currently running.",
  "dash.modelName": "MODEL NAME",
  "dash.expiresAt": "Expires At",
  "dash.actions": "Actions",
  "dash.format": "Format",
  "dash.apiInfo": "API Info",
  "dash.unload": "Unload",
  "dash.logs": "LIVE LOGS",
  "dash.streaming": "Streaming",
  "dash.paused": "Paused",
  "dash.clear": "Clear",
  "dash.waitLogs": "Waiting for logs...",
  "dash.apiTitle": "API Usage Examples",
  "dash.apiModel": "Model",
  "dash.apiCurl": "cURL",
  "dash.apiPython": "Python",
  "dash.apiJs": "JavaScript",
  "dash.close": "Close",
  "dash.copied": "Copied!",
  "dash.copy": "Copy",

  // Marketplace
  "mp.title": "Marketplace",
  "mp.subtitle": "The model application market allows for quick loading and usage.",
  "mp.models": "Models",
  "mp.datasets": "Datasets",
  "mp.search": "Search...",
  "mp.trending": "Trending",
  "mp.recentlyUpdated": "Recently Updated",
  "mp.mostDownloads": "Most Downloads",
  "mp.mostLikes": "Most Likes",
  "mp.loading": "Loading...",
  "mp.noModels": "No models found.",
  "mp.noDatasets": "No datasets found.",
  "mp.prev": "Previous",
  "mp.next": "Next",
  "mp.page": "Page {0} of {1}",
  "mp.done": "Done!",
  "mp.downloaded": "Downloaded",
  "mp.failed": "Failed",
  "mp.pulling": "Pulling...",
  "mp.download": "Download",
  "mp.format": "Format",
  "mp.viewDetails": "View details",
  "mp.detailSubtitle": "View model metadata, runtime tags, and GGUF quantization variants.",
  "mp.loadingDetail": "Loading model details...",
  "mp.failedLoadDetail": "Failed to load model details.",
  "mp.modelParams": "Parameters",
  "mp.architecture": "Architecture",
  "mp.tensorType": "Tensor Type",
  "mp.downloads": "Downloads",
  "mp.updated": "Updated",
  "mp.runtimeFrameworks": "Runtime Frameworks",
  "mp.tasks": "Tasks",
  "mp.quantizations": "GGUF Quantizations",
  "mp.quantizationsHint": "Available GGUF variants detected from the repository files.",
  "mp.sortBy": "Sort by",
  "mp.filter": "Filter",
  "mp.activeFilters": "Filtering results",
  "mp.noActiveFilters": "No filters applied",
  "mp.clearFilters": "Clear filters",
  "mp.modelType": "Model Type",
  "mp.allModelTypes": "All Types",
  "mp.modelTypeGGUF": "GGUF",
  "mp.modelTypeSafeTensors": "SafeTensors",
  "mp.taskType": "Task Type",
  "mp.allTaskTypes": "All Tasks",
  "mp.taskTextGeneration": "Text Generation",
  "mp.taskFeatureExtraction": "Feature Extraction",
  "mp.taskSentenceSimilarity": "Sentence Similarity",
  "mp.taskASR": "Automatic Speech Recognition",
  "mp.taskTextToImage": "Text to Image",
  "mp.taskImageToImage": "Image to Image",
  "mp.modelSize": "Model Size",
  "mp.allModelSizes": "All Sizes",
  "mp.modelSizeB": "{0}B",
  "mp.modelSizeRange": "Parameter Range",
  "mp.modelSizeAny": "Any size",
  "mp.modelSizeRangeValue": "{0}B - {1}B",
  "mp.modelSizeMax": "Max {0}B",
  "mp.modelSizeSliderHint": "Slider {0}B - {1}B",
  "mp.modelSizeUnder1B": "< 1B",
  "mp.modelSizeOver100B": "> 100B",
  "mp.quickSizes": "Quick sizes",
  "mp.minimum": "Min",
  "mp.maximum": "Max",
  "mp.updatedAt": "Updated: {0}",
  "mp.viewer": "Viewer",
  "mp.localInference": "Local Inference",
  "mp.localInferenceSupported": "Local inference",
  "mp.localInferenceNotSupported": "No local inference",
  "mp.localInferenceDirect": "Supported (GGUF, ready after download)",
  "mp.localInferenceConvert": "Supported (auto-converts on first run)",
  "mp.localInferenceImage": "Supported (text-to-image runtime)",
  "mp.localInferenceASR": "Supported (ASR runtime)",
  "mp.localInferenceNone": "Not supported yet",

  // Downloads
  "downloads.model": "Model",
  "downloads.dataset": "Dataset",
  "downloads.progress": "Download Progress",
  "downloads.none": "—",
  "downloads.downloading": "Downloading",
  "downloads.downloadingPercent": "Downloading {0}%",
  "downloads.interrupted": "Interrupted",
  "downloads.failed": "Failed",
  "downloads.done": "Done",
  "downloads.resume": "Continue",
  "downloads.pause": "Pause",
  "downloads.clear": "Clear",

  // AI Apps
  "aiApps.title": "AI Apps",
  "aiApps.subtitle": "Discover and integrate powerful AI applications into your CSGHub-Lite environment.",
  "aiApps.search": "Search apps...",
  "aiApps.results": "{0} apps",
  "aiApps.loading": "Loading apps...",
  "aiApps.noResults": "No apps match the current search.",
  "aiApps.installed": "Installed",
  "aiApps.details": "Details",
  "aiApps.chat": "Chat",
  "aiApps.open": "Open",
  "aiApps.launch": "Launch",
  "aiApps.start": "Start",
  "aiApps.stop": "Stop",
  "aiApps.starting": "Starting...",
  "aiApps.stopping": "Stopping...",
  "aiApps.model": "Model",
  "aiApps.modelHint": "Choose the local or OpenCSG model to launch this app with.",
  "aiApps.modelLoading": "Loading models...",
  "aiApps.modelDefault": "Use app default",
  "aiApps.modelSourceCloud": "OpenCSG",
  "aiApps.modelSourceLocal": "Local",
  "aiApps.liveLogs": "Live logs",
  "aiApps.install": "Install",
  "aiApps.installLatest": "Install latest",
  "aiApps.reinstallLatest": "Reinstall latest",
  "aiApps.retryInstall": "Retry install",
  "aiApps.uninstall": "Uninstall",
  "aiApps.disabled": "Disabled",
  "aiApps.installPreview": "Install Preview",
  "aiApps.setupDetails": "Setup Details",
  "aiApps.loadFailed": "Failed to load AI Apps state.",
  "aiApps.openFailed": "Failed to open app.",
  "aiApps.startFailed": "Failed to start app.",
  "aiApps.stopFailed": "Failed to stop app.",
  "aiApps.installFailed": "Installation failed",
  "aiApps.installRunning": "Installation in progress",
  "aiApps.uninstallFailed": "Uninstallation failed",
  "aiApps.uninstallRunning": "Uninstallation in progress",
  "aiApps.installedReady": "The app is installed and can be updated to the latest version from this panel.",
  "aiApps.installedExternalReady": "An existing local installation was detected. You can open it here, but updates and uninstall should stay with the original installer.",
  "aiApps.updateAvailableNotice": "A newer mirrored version is available: {0}. Reinstall to upgrade from this panel.",
  "aiApps.readyToInstall": "The app is ready for installation.",
  "aiApps.disabledDockerNotice": "Docker-based apps are currently disabled in AI Apps. Install them manually for now.",
  "aiApps.disabledLinuxNotice": "This desktop app is not available on Linux.",
  "aiApps.disabledWindowsNotice": "This app is not available on Windows.",
  "aiApps.installMode": "Install Mode",
  "aiApps.progressMode": "Progress",
  "aiApps.currentStatus": "Status",
  "aiApps.runtimeStatus": "Runtime",
  "aiApps.runtime.running": "Running",
  "aiApps.runtime.stopped": "Stopped",
  "aiApps.version": "Version",
  "aiApps.currentVersion": "Current Version",
  "aiApps.latestVersion": "Latest Version",
  "aiApps.updateStatus": "Update",
  "aiApps.updateAvailable": "Update available",
  "aiApps.updateAvailableShort": "Latest: {0}",
  "aiApps.upToDate": "Up to date",
  "aiApps.latestKnown": "Latest resolved",
  "aiApps.latestUnknown": "Unknown",
  "aiApps.installPath": "Install Path",
  "aiApps.logFile": "Log File",
  "aiApps.lastError": "Last Error",
  "aiApps.commandPreview": "Command Preview",
  "aiApps.installCommand": "Install Command",
  "aiApps.cnHint": "Mirror & Network Notes",
  "aiApps.cliLaunch": "CLI Launch",
  "aiApps.cliLaunchHint": "Use the managed CLI to open this app. `--model` selects the model, and any arguments after `--` are passed through to the app itself.",
  "aiApps.currentModelId": "Current Model ID",
  "aiApps.currentModelHint": "Select the model ID to use for launch, then copy it for `csghub-lite launch --model` if needed.",
  "aiApps.desktopLaunch": "Launch Desktop App",
  "aiApps.desktopLaunchHint": "Opens the local Codex App on this machine. Model settings are written to ~/.codex/config.toml, shared with Codex CLI.",
  "aiApps.codexConfigPath": "Codex Config",
  "aiApps.openDocs": "Open docs",
  "aiApps.openSettings": "Open Settings",
  "aiApps.error.noLocalModelsOpenCSG": "No local models are available yet. Pull a model first, or open Settings to sign in to OpenCSG or save an API Key.",
  "aiApps.error.noLocalOrCloudModels": "No local or OpenCSG models are available yet. Pull a model first, or check OpenCSG model access in Settings.",
  "aiApps.error.noModelsFound": "No available models were found. Pull a model first and then open the app.",
  "aiApps.error.modelUnavailableWithCloudHint": "Model \"{0}\" isn't available for AI Apps. If you want to use an OpenCSG model, open Settings to sign in to OpenCSG or save an API Key first.",
  "aiApps.error.modelUnavailableCloudHint": "This model isn't available for AI Apps. If you want to use an OpenCSG model, open Settings to sign in to OpenCSG or save an API Key first.",
  "aiApps.error.modelUnavailable": "Model \"{0}\" isn't available for AI Apps.",
  "aiApps.error.localhostRequired": "Codex App can only be opened when browsing csghub-lite on localhost.",
  "aiApps.plannedSteps": "Planned Steps",
  "aiApps.taskLogs": "Task Logs",
  "aiApps.streaming": "Streaming",
  "aiApps.opening": "Opening...",
  "aiApps.launching": "Launching...",
  "aiApps.openingWindowHint": "Preparing the local app entry. This window will continue automatically.",
  "aiApps.shellTitle": "AI App Shell",
  "aiApps.shellConnecting": "Connecting terminal",
  "aiApps.shellConnected": "Connected",
  "aiApps.shellDisconnected": "Disconnected",
  "aiApps.shellExited": "Exited",
  "aiApps.shellReconnect": "Reconnect",
  "aiApps.shellApplyModel": "Switch model",
  "aiApps.shellApplyingModel": "Switching...",
  "aiApps.shellModel": "Model",
  "aiApps.shellDirectory": "Directory",
  "aiApps.shellDirectoryPlaceholder": "Project directory path",
  "aiApps.shellApplyLaunch": "Apply",
  "aiApps.shellApplyingLaunch": "Applying...",
  "aiApps.shellExitCode": "Exit code: {0}",
  "aiApps.shellExitNotice": "process exited with code {0}",
  "aiApps.shellSessionMissing": "Shell session is missing or has expired.",
  "aiApps.shellConnectionFailed": "Failed to connect to the local terminal session.",
  "aiApps.paused": "Paused",
  "aiApps.waitLogs": "Waiting for logs...",
  "aiApps.logsScope": "These are live install or uninstall logs for the selected app.",
  "aiApps.visitWebsite": "Visit website",
  "aiApps.close": "Close",
  "aiApps.indeterminate": "Indeterminate progress",
  "aiApps.modeNpm": "npm",
  "aiApps.modeDocker": "Docker",
  "aiApps.modeScript": "Shell script",
  "aiApps.status.idle": "Ready to install",
  "aiApps.status.installing": "Installing",
  "aiApps.status.uninstalling": "Uninstalling",
  "aiApps.status.installed": "Installed",
  "aiApps.status.failed": "Failed",
  "aiApps.status.disabled": "Disabled",
  "aiApps.phase.ready": "Ready to install",
  "aiApps.phase.starting": "Starting installer",
  "aiApps.phase.preflight": "Checking prerequisites",
  "aiApps.phase.ensuring_node": "Ensuring Node.js",
  "aiApps.phase.detecting_platform": "Detecting platform",
  "aiApps.phase.resolving_latest": "Resolving latest version",
  "aiApps.phase.downloading_binary": "Downloading binary",
  "aiApps.phase.downloading_archive": "Downloading archive",
  "aiApps.phase.verifying_checksum": "Verifying checksum",
  "aiApps.phase.installing_runtime": "Installing runtime",
  "aiApps.phase.extracting_archive": "Extracting archive",
  "aiApps.phase.stopping_services": "Stopping services",
  "aiApps.phase.removing_runtime": "Removing runtime",
  "aiApps.phase.checking_node": "Checking Node.js",
  "aiApps.phase.ensuring_search_tools": "Ensuring search tools",
  "aiApps.phase.installing_pi": "Installing Pi",
  "aiApps.phase.verifying_pi": "Verifying Pi",
  "aiApps.phase.uninstalling_pi": "Uninstalling Pi",
  "aiApps.phase.prewarming_runtime": "Prewarming runtime",
  "aiApps.phase.prewarming_gateway": "Prewarming gateway",
  "aiApps.phase.platform_unsupported": "Not available on this platform",
  "aiApps.phase.installing": "Installing package",
  "aiApps.phase.running_installer": "Running installer",
  "aiApps.phase.removing_package": "Removing package",
  "aiApps.phase.removing_binary": "Removing binary",
  "aiApps.phase.removing_files": "Removing runtime files",
  "aiApps.phase.cleaning_up": "Cleaning up",
  "aiApps.phase.verifying": "Verifying installation",
  "aiApps.phase.verifying_uninstall": "Verifying uninstallation",
  "aiApps.phase.installed": "Installed",
  "aiApps.phase.failed": "Installation failed",
  "aiApps.phase.uninstall_failed": "Uninstallation failed",
  "aiApps.phase.complete": "Complete",
  "aiApps.phase.docker_disabled": "Disabled in AI Apps",
  "aiApps.phase.windows_unsupported": "Not available on Windows",
  "aiApps.phase.linux_unsupported": "Not available on Linux",

  // Settings
  "nav.settings": "Settings",
  "nav.apiDocs": "API",
  "nav.help": "Help",
  "nav.upgrade": "Upgrade",
  "upgrade.title": "Upgrade CSGHub Lite",
  "upgrade.subtitle": "Update to the latest version",
  "upgrade.currentVersion": "Current Version",
  "upgrade.latestVersion": "Latest Version",
  "upgrade.upgrade": "Upgrade",
  "upgrade.available": "{0} available",
  "upgrade.upToDate": "You are running the latest version.",
  "upgrade.confirm": "Upgrade Now",
  "upgrade.cancel": "Later",
  "upgrade.upgrading": "Upgrading...",
  "upgrade.starting": "Starting upgrade...",
  "upgrade.success": "Success",
  "upgrade.successMessage": "Upgrade completed. CSGHub Lite is restarting and this page will refresh automatically.",
  "upgrade.refresh": "Refresh",
  "upgrade.failed": "Upgrade failed",
  "upgrade.connectionError": "Connection error. Please try again.",
  "settings.title": "Settings",
  "settings.subtitle": "This page offers a unified settings hub for the product.",
  "settings.tabSystem": "System Settings",
  "settings.tabAPIKeys": "API Key Management",
  "settings.tabUsage": "Usage Statistics",
  "settings.never": "Never",
  "settings.copy": "Copy",
  "settings.copied": "Copied",
  "settings.modelLocation": "Storage location",
  "settings.modelLocationDesc": "Base folder shared by models and datasets. csghub-lite stores them under `models/` and `datasets/` inside this location.",
  "settings.browse": "Browse",
  "settings.directoryBrowserTitle": "Choose a folder",
  "settings.directoryBrowserDesc": "Select a shared local folder for storing model and dataset files.",
  "settings.currentFolder": "Current folder",
  "settings.upOneLevel": "Up one level",
  "settings.loadingDirectories": "Loading directories...",
  "settings.noDirectories": "No subdirectories found.",
  "settings.useCurrentFolder": "Use this folder",
  "settings.home": "Home",
  "settings.cancel": "Cancel",
  "settings.storageDirSaveFailed": "Failed to save the storage directory.",
  "settings.directoryBrowseFailed": "Failed to browse local directories.",
  "settings.modelsPath": "Models: {0}",
  "settings.datasetsPath": "Datasets: {0}",
  "settings.contextLength": "Context length",
  "settings.contextLengthDesc": "Context length determines how much of your conversation local LLMs can remember and use to generate responses.",
  "settings.parallelSlots": "Parallel slots",
  "settings.parallelSlotsDesc": "Number of concurrent inference requests the local LLM server can handle simultaneously. Higher values use more memory.",
  "settings.versionInfo": "Version Information",
  "settings.save": "Save",
  "settings.resetDefaults": "Reset to defaults",
  "settings.resettingDefaults": "Resetting...",
  "settings.resetDefaultsSuccess": "Default settings restored.",
  "settings.resetDefaultsFailed": "Failed to restore default settings.",
  "settings.language": "Language",
  "settings.languageDesc": "Select the display language for the interface.",
  "settings.serviceUrls": "Cloud Service",
  "settings.serviceUrlsDesc": "Configure the built-in cloud model service, AI Gateway endpoint, and provider display name. Leave blank or reset defaults to use the built-in values.",
  "settings.serverUrl": "CSGHub Server URL",
  "settings.aiGatewayUrl": "AI Gateway URL",
  "settings.cloudProviderName": "Cloud Provider Name",
  "settings.cloudProviderNameHint": "Used as the provider name for built-in cloud models. Default: {0}",
  "settings.serviceUrlDefault": "Default: {0}",
  "settings.serviceUrlsSaveSuccess": "Cloud service settings saved.",
  "settings.serviceUrlsResetSuccess": "Default cloud service settings restored.",
  "settings.serviceUrlsSaveFailed": "Failed to save cloud service settings.",
  "settings.cloudModelsRefresh": "Refresh models",
  "settings.cloudModelsRefreshing": "Refreshing...",
  "settings.cloudModelsRefreshSuccess": "Cloud model list refreshed.",
  "settings.cloudModelsRefreshFailed": "Failed to refresh cloud models.",
  "settings.webSearch": "Web Search",
  "settings.webSearchDesc": "Use built-in free internet search engines for Lite Chat, following SearXNG-style provider fallback and result normalization.",
  "settings.webSearchOn": "Enabled",
  "settings.webSearchOff": "Disabled",
  "settings.webSearchEngines": "Built-in engines: Sogou, Baidu, Quark, Bing, DuckDuckGo. No local search server is required.",
  "settings.webSearchMaxResults": "Max results",
  "settings.webSearchTimeout": "Timeout (seconds)",
  "settings.webSearchLanguage": "Language",
  "settings.webSearchSafeSearch": "Safe search",
  "settings.webSearchSafeOff": "Off",
  "settings.webSearchSafeModerate": "Moderate",
  "settings.webSearchSafeStrict": "Strict",
  "settings.webSearchSaveFailed": "Failed to save web search settings.",
  "settings.diffuser": "Diffuser",
  "settings.diffuserDesc": "Manage the local Diffuser runtime used by text-to-image models.",
  "settings.diffuserUpgradeTitle": "Upgrade Diffuser",
  "settings.diffuserUpgradeHint": "Reinstall and upgrade Diffuser-related Python packages. Use this when a text-to-image model needs newer runtime dependencies.",
  "settings.diffuserUpgrade": "Upgrade Diffuser",
  "settings.diffuserUpgrading": "Upgrading...",
  "settings.diffuserUpgradeSuccess": "Diffuser upgraded successfully.",
  "settings.diffuserUpgradeFailed": "Failed to upgrade Diffuser.",
  "settings.autostart": "Start on boot",
  "settings.autostartDesc": "Automatically start csghub-lite when you log in to your computer.",
  "settings.autostartOn": "Enabled",
  "settings.autostartOff": "Disabled",
  "settings.account": "Account",
  "settings.accountDesc": "View your current OpenCSG login and sign out if needed.",
  "settings.cloudAPIKey": "{0} API Key",
  "settings.cloudAPIKeyDesc": "Manage the API Key used for {0} cloud model requests.",
  "settings.cloudAPIKeyStatusHint": "Manual keys override the built-in key loaded from your OpenCSG login.",
  "settings.cloudAPIKeyBuiltinStatus": "Using built-in API Key{0}",
  "settings.cloudAPIKeyManualStatus": "Using manual API Key{0}",
  "settings.cloudAPIKeyMissingStatus": "No API Key available",
  "settings.cloudAPIKeyInputHint": "Paste an OpenCSG API Key here to override the built-in key.",
  "settings.openAPIKeyPage": "Open API Key Page",
  "settings.clearAPIKey": "Clear API Key",
  "settings.clearingAPIKey": "Clearing...",
  "settings.providers": "Third-party Providers",
  "settings.providersDesc": "Add OpenAI-compatible providers so their models appear in Chat alongside local and OpenCSG models.",
  "settings.providersConfigured": "{0} providers configured",
  "settings.providersHint": "API keys are stored locally in your csghub-lite config directory.",
  "settings.providersEmpty": "No third-party providers configured.",
  "settings.providersLoadFailed": "Failed to load third-party providers.",
  "settings.providerAdd": "Add Provider",
  "settings.providerEdit": "Edit",
  "settings.providerDelete": "Delete",
  "settings.providerAddTitle": "Add Provider",
  "settings.providerEditTitle": "Edit Provider",
  "settings.providerDialogDesc": "Use an OpenAI-compatible base URL, such as https://api.openai.com/v1.",
  "settings.providerType": "Provider Type",
  "settings.providerName": "Name",
  "settings.providerBaseURL": "Base URL",
  "settings.providerAPIKey": "API Key",
  "settings.providerAPIKeyUnchanged": "Leave blank to keep the current key",
  "settings.providerSave": "Save Provider",
  "settings.providerSaveNext": "Save and Select Models",
  "settings.providerModelsTitle": "Select Provider Models",
  "settings.providerModelsDesc": "Choose which models from {0} should appear in csghub-lite.",
  "settings.providerModelsEmpty": "No models returned by this provider.",
  "settings.providerModelsLoadFailed": "Failed to load provider models.",
  "settings.providerModelsSaveFailed": "Failed to save selected models.",
  "settings.providerModelsSave": "Save Models",
  "settings.providerModelsNoneSelected": "No models selected",
  "settings.providerModelsMore": "+{0} more",
  "settings.providerModelDisplayNamePlaceholder": "Optional display name",
  "settings.providerModelEdit": "Edit",
  "settings.providerModelEditTitle": "Edit Provider Model",
  "settings.providerModelEditDesc": "Change the client-facing model ID. Upstream requests still use the original provider model ID.",
  "settings.providerModelID": "Model ID",
  "settings.providerModelDisplayName": "Display Name",
  "settings.providerModelDescription": "Description",
  "settings.providerModelDescriptionPlaceholder": "Optional description",
  "settings.providerModelOptionalFieldHint": "Leave blank to keep the existing value.",
  "settings.providerModelSave": "Save Model",
  "settings.providerModelIDRequired": "Model ID is required.",
  "settings.providerModelUpdateFailed": "Failed to update provider model.",
  "gateway.eyebrow": "AI Gateway",
  "gateway.title": "AI Gateway",
  "gateway.subtitle": "Manage local inference API keys, remote access protocols, and token usage from one dedicated gateway page.",
  "gateway.tabProviders": "Providers",
  "gateway.snapshotAuth": "Auth",
  "gateway.snapshotKeys": "Keys",
  "gateway.snapshotProtocols": "Protocols",
  "gateway.authStatus": "Current status",
  "gateway.cloudKeyBadge": "{0} Cloud",
  "gateway.createKeyTitle": "Create a new API key",
  "gateway.keyListTitle": "API key list",
  "gateway.keyListDesc": "Use these keys for trusted clients that call the local inference gateway.",
  "gateway.keyCount": "{0} keys",
  "gateway.providerModels": "Selected models",
  "pipeline.languageModel": "Language",
  "pipeline.imageGeneration": "Image",
  "pipeline.imageToImage": "Image edit",
  "pipeline.textToVideo": "Video",
  "pipeline.imageToVideo": "Image to video",
  "pipeline.videoUnderstanding": "Video input",
  "pipeline.textToSpeech": "TTS",
  "pipeline.speechRecognition": "ASR",
  "pipeline.modalityImage": "image",
  "pipeline.modalityVideo": "video",
  "pipeline.modalityAudio": "audio",
  "pipeline.modalityFile": "file",
  "pipeline.modalityText": "text",
  "pipeline.inputCapability": "{0} input",
  "pipeline.outputCapability": "{0} output",
  "settings.providerNameURLRequired": "Name and Base URL are required.",
  "settings.providerAPIKeyRequired": "API key is required.",
  "settings.providerSaveFailed": "Failed to save provider.",
  "settings.providerDeleteFailed": "Failed to delete provider.",
  "settings.providerDeleteConfirm": "Delete provider \"{0}\"?",
  "settings.providerEnabled": "Enabled",
  "settings.providerDisabled": "Disabled",
  "settings.apiDocs": "API Docs",
  "settings.apiDocsDesc": "Open the local REST and compatibility API reference.",
  "settings.apiDocsTitle": "Local API reference",
  "settings.apiDocsHint": "Swagger UI for `/api/*`, OpenAI-compatible, and Anthropic-compatible endpoints.",
  "settings.openApiDocs": "Open API Docs",
  "settings.feedback": "Feedback",
  "settings.feedbackDesc": "Report bugs or share suggestions on GitHub.",
  "settings.feedbackTitle": "Feedback and issues",
  "settings.feedbackHint": "Open the project homepage on GitHub.",
  "settings.openFeedback": "Open GitHub",
  "settings.loggedOut": "Not logged in",
  "settings.loggedOutDesc": "Sign in to OpenCSG and save an Access Token to use the built-in API Key for OpenCSG models.",
  "settings.login": "Open Login",
  "settings.openTokenPage": "Open Access Token Page",
  "settings.tokenSaved": "Access Token saved",
  "settings.tokenSavedDesc": "We couldn't load profile details right now. You can sign in again or log out.",
  "settings.tokenInputHint": "Paste an OpenCSG Access Token here to sign in or replace the saved token.",
  "settings.logout": "Log out",
  "settings.loggingOut": "Logging out...",
  "settings.localAPIKeys": "Local Inference API Keys",
  "settings.localAPIKeysDesc": "Manage API keys for remote access to this local inference server.",
  "settings.localAPIAuth": "Remote access authorization",
  "settings.localAPIAuthDesc": "When enabled, remote inference API requests require an API key. Localhost remains passwordless.",
  "settings.localAPIAuthOn": "API key required",
  "settings.localAPIAuthOff": "Disabled",
  "settings.localAPIBaseURL": "Dedicated Base URL",
  "settings.localAPIBaseURLDesc": "Use these base URLs with the generated API key from remote clients.",
  "settings.localAPIBaseURLOpenAI": "OpenAI-compatible protocol",
  "settings.localAPIBaseURLAnthropic": "Anthropic-compatible protocol",
  "settings.localAPIAccessMethod": "Access Method",
  "settings.localAPIKeyName": "Key name",
  "settings.localAPIKeyNamePlaceholder": "Notebook, LAN client, or service name",
  "settings.localAPIKeyAdd": "Add API Key",
  "settings.localAPIKeyCreate": "Create API Key",
  "settings.localAPIKeyCreated": "API Key created",
  "settings.localAPIKeyCreatedHint": "Copy this key now. It will not be shown again.",
  "settings.localAPIKeysEmpty": "No local inference API keys created.",
  "settings.localAPIKeyPrefix": "Prefix: {0}",
  "settings.localAPIKeyLastUsed": "Last used: {0}",
  "settings.localAPIKeyDelete": "Delete",
  "settings.localAPIKeyDeleteConfirm": "Delete this API key?",
  "settings.localAPIKeysLoadFailed": "Failed to load local inference API keys.",
  "settings.localAPIAuthSaveFailed": "Failed to save authorization setting.",
  "settings.localAPIKeyCreateFailed": "Failed to create API key.",
  "settings.localAPIKeyDeleteFailed": "Failed to delete API key.",
  "settings.apiUsage": "Usage Statistics",
  "settings.apiUsageDesc": "Track cumulative token consumption across local and cloud models.",
  "settings.apiUsageRefresh": "Refresh",
  "settings.apiUsageEmpty": "No API usage recorded yet.",
  "settings.apiUsageLoadFailed": "Failed to load API usage.",
  "settings.apiUsagePeriodWeek": "Last 7 days",
  "settings.apiUsagePeriodMonth": "Last 30 days",
  "settings.apiUsagePeriodYear": "Last 12 months",
  "settings.apiUsageRequests": "Requests",
  "settings.apiUsageInput": "Input Tokens",
  "settings.apiUsageOutput": "Output Tokens",
  "settings.apiUsageTotal": "Total Tokens",
  "settings.apiUsageKey": "Client",
  "settings.apiUsageSource": "Source",
  "settings.apiUsageSourceLocal": "Local",
  "settings.apiUsageSourceCloud": "OpenCSG",
  "settings.apiUsageSourceProvider": "Third-party Providers",
  "settings.apiUsageSourceUnknown": "Unknown",
  "settings.apiUsageSourceAll": "All Sources",
  "settings.apiUsageSourceRequests": "{0} requests",
  "settings.apiUsageModel": "Model",
  "settings.apiUsageTokens": "Tokens",
  "settings.apiUsageLastUsed": "Last Used",
  "settings.apiUsageCumulative": "Cumulative Consumption",
  "settings.apiUsageLocalModels": "Local Models",
  "settings.apiUsageCloudModels": "Cloud Models",
  "settings.apiUsageTotalHistory": "Historical Total",
  "settings.apiUsageBreakdown": "Model Breakdown",
  "settings.apiUsageProviderFilter": "Provider",
  "settings.apiUsageProviderAll": "All Providers",

  // Library
  "lib.title": "Models",
  "lib.subtitle": "Existing model management",
  "lib.all": "All",
  "lib.search": "Search local models...",
  "lib.results": "{0} models",
  "lib.searching": "Searching...",
  "lib.modelName": "Model Name",
  "lib.format": "Format",
  "lib.fileSize": "File size",
  "lib.dateTime": "Date & Time",
  "lib.operation": "Operation",
  "lib.noModels": "No models found. Pull models from the Marketplace.",
  "lib.noSearchResults": "No models match the current search.",
  "lib.upload": "Upload model",
  "lib.uploadTitle": "Upload local model",
  "lib.uploadDesc": "Import a model archive, GGUF/SafeTensors file, or full model folder into the local model library.",
  "lib.uploadModelID": "Model ID",
  "lib.uploadModelIDHint": "Use namespace/name, for example local/qwen-gguf.",
  "lib.uploadDropTitle": "Drop model files or folders here",
  "lib.uploadDropDesc": "Supports .zip, .tar, .tar.gz, .tgz, .gguf, .safetensors, .bin, and model folders.",
  "lib.uploadPickFiles": "Choose files/archive",
  "lib.uploadPickFolder": "Choose folder",
  "lib.uploadNoFiles": "No files selected.",
  "lib.uploadSelected": "{0} files selected, {1}",
  "lib.uploadMoreFiles": "+{0} more files",
  "lib.uploadOverwrite": "Overwrite existing model with the same ID",
  "lib.uploadSubmit": "Upload",
  "lib.uploading": "Uploading...",
  "lib.uploadProgress": "Uploading {0}%",
  "lib.uploadFailed": "Failed to upload model",
  "lib.uploadReadFailed": "Failed to read dropped files.",
  "lib.uploadModeArchive": "Archive",
  "lib.uploadModeDirectory": "Folder",
  "lib.uploadModeFiles": "Files",
  "lib.delete": "Delete",
  "lib.api": "API",
  "lib.deleteConfirm": "Delete model \"{0}\"?",
  "lib.details": "Details",
  "lib.back": "Back",
  "lib.running": "Running",
  "lib.converting": "Converting...",
  "lib.loadingImageRuntime": "Loading image runtime...",
  "lib.loadingASRRuntime": "Loading ASR runtime...",
  "lib.loadingModel": "Loading...",
  "lib.run": "Run",
  "lib.runParamsTitle": "Run Parameters",
  "lib.runParamsDesc": "Choose runtime options for {0}. These match `csghub-lite run` flags and will be remembered for next time.",
  "lib.runParamsDescImage": "Choose image runtime options for {0}. Diffusers selects device and dtype automatically.",
  "lib.runParamsDescASR": "Choose ASR runtime options for {0}. The Python ASR runtime selects device and dtype automatically.",
  "lib.runParamsDescEmbedding": "Choose embedding runtime options for {0}. Chat-only cache and parallel settings are hidden.",
  "lib.runParamDefault": "Default",
  "lib.runParamNumCtx": "Context length",
  "lib.runParamNumCtxHint": "`--num-ctx`; leave empty to use the model/server default.",
  "lib.runParamNumParallel": "Parallel slots",
  "lib.runParamNumParallelHint": "`--num-parallel`; use 1 to maximize single-session context.",
  "lib.runParamNGPULayers": "GPU layers",
  "lib.runParamNGPULayersHint": "`--n-gpu-layers`; use 0 to disable GPU offload.",
  "lib.runParamCacheTypeK": "K cache type",
  "lib.runParamCacheTypeV": "V cache type",
  "lib.runParamCacheTypeHint": "`--cache-type-*`; KV cache dtype for llama-server.",
  "lib.runParamDType": "Conversion dtype",
  "lib.runParamDTypeHint": "`--dtype`; used when SafeTensors needs GGUF conversion.",
  "lib.runParamKeepAlive": "Keep alive",
  "lib.runParamKeepAliveHint": "`--keep-alive`; examples: 5m, 1h, -1 to keep loaded until stopped.",
  "lib.runParamImageRuntimeHint": "This image model will prepare the required runtime automatically. In most cases, you only need to choose how long to keep it loaded.",
  "lib.runParamASRRuntimeHint": "This ASR model will prepare the Python ASR runtime automatically. Context, cache, GPU layer, and dtype options do not apply.",
  "lib.runParamCancel": "Cancel",
  "lib.runParamSubmit": "Run",
  "lib.runParamInteger": "{0} must be an integer.",
  "lib.runParamMin": "{0} must be at least {1}.",
  "lib.runParamInvalid": "Invalid run parameters.",
  "lib.failedLoad": "Failed to load model",
  "lib.failedLoadModels": "Failed to load models",
  "lib.loadingDetail": "Loading model details...",
  "lib.detailSubtitle": "View file list and download commands for this local model.",
  "lib.localInference": "Local Inference",
  "lib.localInferenceSupported": "Local inference",
  "lib.localInferenceNotSupported": "No local inference",
  "lib.localInferenceDirect": "Supported (GGUF, ready after download)",
  "lib.localInferenceConvert": "Supported (auto-converts on first run)",
  "lib.localInferenceImage": "Supported (text-to-image runtime)",
  "lib.localInferenceASR": "Supported (ASR runtime)",
  "lib.localInferenceNone": "Not supported yet",
  "lib.downloadMethods": "Download Methods",
  "lib.downloadHint": "Fetch the manifest first, then download each file using its download_url. File endpoints support HEAD and Range for resumable downloads.",
  "lib.manifestUrl": "Manifest URL",
  "lib.manifestCurl": "Fetch manifest with curl",
  "lib.fileCurl": "Example file download",
  "lib.copyUrl": "Copy URL",
  "lib.copyCurl": "Copy curl",
  "lib.copyCommand": "Copy command",
  "lib.files": "Files",
  "lib.path": "Path",
  "lib.sha256": "SHA256",
  "lib.noFiles": "No files found.",
  "lib.fileCount": "Files",
  "lib.updated": "Updated",
  "lib.pipeline": "Pipeline",
  "lib.description": "Description",
  "lib.licenseLabel": "License",
  "lib.notAvailable": "N/A",

  // Datasets
  "nav.datasets": "Datasets",
  "ds.title": "Datasets",
  "ds.subtitle": "Existing Dataset management",
  "ds.datasetName": "Dataset Name",
  "ds.fileSize": "File size",
  "ds.dateTime": "Date & Time",
  "ds.operation": "Operation",
  "ds.noDatasets": "No datasets found. Pull datasets from the Marketplace.",
  "ds.delete": "Delete",
  "ds.deleteConfirm": "Delete dataset \"{0}\"?",
  "ds.name": "Name",
  "ds.size": "Size",
  "ds.dateModified": "Date Modified",
  "ds.loadingFiles": "Loading files...",
  "ds.noFiles": "No files found.",
  "ds.lessThanMinute": "less than a minute ago",
  "ds.minutesAgo": "{0} minutes ago",
  "ds.hoursAgo": "{0} hours ago",
  "ds.daysAgo": "{0} days ago",
  "ds.search": "Search datasets...",
  "ds.searching": "Searching...",
  "ds.results": "{0} results",
  "ds.downloadMethods": "Download Methods",
  "ds.downloadHint": "Fetch the manifest first, then download each file using its download_url. File endpoints support HEAD and Range for resumable downloads.",
  "ds.manifestUrl": "Manifest URL",
  "ds.manifestCurl": "Fetch manifest with curl",
  "ds.fileCurl": "Example file download",
  "ds.copyUrl": "Copy URL",
  "ds.copyCurl": "Copy curl",
  "ds.copyCommand": "Copy command",
  "ds.fileCount": "Files",
  "ds.updated": "Updated",
  "ds.description": "Description",
  "ds.licenseLabel": "License",
  "ds.path": "Path",
  "ds.sha256": "SHA256",
  "ds.notAvailable": "N/A",
  "ds.failedLoadDetail": "Failed to load dataset details",
  "ds.detailSubtitle": "View file list and download commands for this local dataset.",
  "ds.back": "Back",

  // Chat
  "chat.newChat": "New Chat",
  "chat.chat": "Chat",
  "chat.settings": "Settings",
  "chat.clearHistory": "Clear history",
  "chat.clearConfirm": "Clear all messages in this session?",
  "chat.suggestion": "Make a Suggestion",
  "chat.systemPrompt": "System Prompt",
  "chat.placeholder": "Placeholder text...",
  "chat.resetDefaults": "Reset Defaults",
  "chat.startConv": "Start a conversation...",
  "chat.askImage": "Ask about an image...",
  "chat.askImageEdit": "Describe how to edit the uploaded image...",
  "chat.askImageGenerate": "Describe the image you want to generate...",
  "chat.askAudio": "Upload an audio file or record audio, then optionally add a prompt...",
  "chat.askHelp": "How can I help you?",
  "chat.thinking": "Thinking",
  "chat.thinkingLive": "Thinking...",
  "chat.uploadImage": "Upload image",
  "chat.uploadAudio": "Upload audio",
  "chat.audioFile": "Audio file",
  "chat.recordedAudio": "Recorded audio",
  "chat.audioPrompt": "Prompt",
  "chat.audioReadyHint": "Transcription starts automatically after upload or recording.",
  "chat.removeAudio": "Remove audio",
  "chat.transcribe": "Transcribe",
  "chat.startRecording": "Start recording",
  "chat.stopRecording": "Stop recording",
  "chat.recordingUnsupported": "Audio recording is not supported in this browser.",
  "chat.recordingFailed": "Failed to record audio.",
  "chat.transcribingAudio": "Transcribing audio...",
  "chat.preparingASRRuntime": "Preparing the ASR runtime. First use may take a few minutes...",
  "chat.emptyTranscription": "No transcription text was returned.",
  "chat.send": "Send",
  "chat.stop": "Stop",
  "chat.failedResp": "Failed to get response. Is the model loaded?",
  "chat.noMmproj": "This vision model requires a multimodal projector (mmproj) file to process images. Images will be ignored.",
  "chat.cloud": "OpenCSG",
  "chat.local": "Local",
  "chat.provider": "Provider",

  // Image generation
  "image.title": "Image Generation",
  "image.subtitle": "Run local text-to-image and image-to-image models through the lazy Diffusers runtime.",
  "image.runtimeRequired": "Image runtime required",
  "image.runtimeMissing": "Install the local Diffusers runtime before generating images.",
  "image.installRuntime": "Install runtime",
  "image.installing": "Installing...",
  "image.model": "Model",
  "image.prompt": "Prompt",
  "image.promptPlaceholder": "Describe the image you want to generate or how to edit the input image...",
  "image.negativePrompt": "Negative prompt",
  "image.negativePlaceholder": "Try: low quality, blurry, watermark, extra fingers...",
  "image.negativeHint": "Use this to tell the model what to avoid.",
  "image.negativeSuggestions": "Common negative terms",
  "image.negativeLowQuality": "low quality",
  "image.negativeBlurry": "blurry",
  "image.negativeBadHands": "bad hands",
  "image.negativeWatermark": "watermark",
  "image.negativeDistorted": "distorted face",
  "image.negativeExtraLimbs": "extra limbs",
  "image.size": "Size",
  "image.sizeHint": "Common ratios or custom dimensions",
  "image.sizeSquare": "Square",
  "image.sizeLandscape": "16:9",
  "image.sizePortrait": "9:16",
  "image.sizeClassicLandscape": "4:3",
  "image.sizeClassicPortrait": "3:4",
  "image.width": "Width",
  "image.height": "Height",
  "image.steps": "Steps",
  "image.stepsHint": "Recommended 1-80. More steps may improve quality but take longer.",
  "image.stepsHintEdit": "Default 50 for edit models. More steps may improve quality but take longer.",
  "image.seed": "Seed",
  "image.seedHint": "Leave empty for random output, or set a seed to reproduce results.",
  "image.randomSeed": "Randomize seed",
  "image.cfgScale": "CFG scale",
  "image.cfgScaleEdit": "True CFG scale",
  "image.cfgHint": "Prompt adherence. Recommended 1-20; higher values follow the prompt more strongly.",
  "image.cfgHintEdit": "True CFG scale for edit models (default 4.0). Higher values follow the prompt more strongly.",
  "image.advancedSettings": "Advanced settings",
  "image.presets": "Parameter presets",
  "image.presetsHint": "Scene presets fill a positive prompt template plus matching parameters.",
  "image.presetDefault": "Default",
  "image.presetPortrait": "Portrait",
  "image.presetLandscape": "Landscape",
  "image.presetDraft": "Fast draft",
  "image.presetPortraitPrompt": "A cinematic portrait of a person, natural skin texture, soft studio lighting, shallow depth of field, highly detailed, realistic photography",
  "image.presetLandscapePrompt": "A breathtaking landscape, golden hour light, rich atmosphere, detailed foreground, dramatic sky, ultra wide angle, high quality photography",
  "image.presetDraftPrompt": "A clean concept sketch of the subject, simple composition, clear shapes, balanced lighting",
  "image.presetFillsPrompt": "fills prompt",
  "image.presetKeepsPrompt": "keeps prompt",
  "image.reset": "Reset",
  "image.generate": "Generate",
  "image.edit": "Edit",
  "image.generating": "Generating...",
  "image.editing": "Editing...",
  "image.jobRunningEdit": "Editing...",
  "image.jobQueued": "Queued...",
  "image.jobRunning": "Generating...",
  "image.sizeFollowsInput": "Follows input",
  "image.cancel": "Cancel generation",
  "image.cancelled": "Image generation cancelled.",
  "image.failed": "Image generation failed.",
  "image.succeeded": "Succeeded",
  "image.invalidSize": "Width and height must be whole numbers between {0} and {1}.",
  "image.jobs": "Image jobs",
  "image.jobsHint": "Running jobs and persisted history stay available after navigation.",
  "image.refreshJobs": "Refresh",
  "image.refreshingJobs": "Refreshing...",
  "image.runningJobs": "Running",
  "image.runningJobsHint": "Jobs continue in the background.",
  "image.noRunningJobs": "No image jobs are running.",
  "image.latestResult": "Latest result",
  "image.history": "History",
  "image.hideHistory": "Hide history",
  "image.historyHint": "Completed, failed, and cancelled jobs are saved here.",
  "image.backToImages": "Back to image generation",
  "image.emptyHistory": "No image history yet.",
  "image.openCloudAuth": "Login / Token",
  "image.cloudAuthRequired": "Cloud login required. Please sign in to {0} and save an Access Token.",
  "image.cloudBuiltinAPIKeyFailed": "Failed to load the {0} built-in API Key. Please sign in again and save an Access Token.",
  "image.results": "Results",
  "image.resultsHint": "Recent generations are kept here for comparison.",
  "image.clearHistory": "Clear history",
  "image.elapsed": "Elapsed {0}",
  "image.progressHint": "Progress is estimated from the current stage and settings.",
  "image.inputImage": "Input image",
  "image.inputImageHint": "Required for image-to-image and editing models. Output size follows the input image.",
  "image.inputImagePlaceholder": "Upload a PNG or JPEG to edit",
  "image.inputImageRequired": "Upload an input image for this model.",
  "image.removeInputImage": "Remove",
  "image.modelTypeEdit": "Edit",
  "image.modelTypeGenerate": "Generate",
  "image.negativeLabel": "Negative",
  "image.random": "Random",
  "image.download": "Download PNG",
  "image.closePreview": "Close",
  "image.empty": "Generated images will appear here.",

  "chat.cloudLoginTitle": "Login required for {0} models",
  "chat.cloudLoginDesc": "{0} models use the configured AI Gateway. Sign in with an Access Token; csghub-lite will load your built-in API Key for model requests.",
  "chat.cloudOpenLogin": "Open Login",
  "chat.cloudOpenTokenPage": "Open Access Token Page",
  "chat.cloudTokenLabel": "Access Token",
  "chat.cloudTokenPlaceholder": "Paste your OpenCSG access token",
  "chat.cloudTokenHint": "Create or copy an Access Token from your OpenCSG account settings, then paste it here.",
  "chat.cloudSaveToken": "Save Token",
  "chat.cloudSavingToken": "Saving...",
  "chat.cloudCancel": "Not now",
  "chat.cloudApiKeyTitle": "OpenCSG AI Gateway API Key",
  "chat.cloudApiKeyDesc": "OpenCSG models use the OpenCSG AI Gateway. Enter your API Key here to enable cloud model requests from csghub-lite.",
  "chat.cloudGatewayLabel": "AI Gateway URL",
  "chat.cloudGatewayValue": "https://ai.space.opencsg.com",
  "chat.cloudApiKeyLabel": "API Key",
  "chat.cloudApiKeyPlaceholder": "Paste your OpenCSG API Key",
  "chat.cloudApiKeyHint": "Create or copy an API Key from your OpenCSG account settings, then paste it here.",
  "chat.cloudApiKeyHelp": "Get API Key",
  "chat.cloudApiKeyRequired": "OpenCSG cloud models require an AI Gateway API Key.",
  "chat.cloudApiKeyInvalid": "The API Key is invalid or has expired. Please create a new API Key and save it again.",
  "chat.cloudApiKeyEmpty": "Please paste an API Key.",
  "chat.cloudApiKeySave": "Save API Key",
  "chat.cloudApiKeySaving": "Saving...",
  "chat.cloudLoginRequired": "{0} models require a cloud login.",
  "chat.cloudAuthRequired": "Cloud login required. Please sign in to {0} or save an API Key.",
  "chat.cloudBuiltinAPIKeyFailed": "Failed to load the {0} built-in API Key. Please sign in again or save an API Key.",
  "chat.cloudLoginExpired": "{0} login expired or token is invalid. Please log in again and update your Access Token.",
  "chat.cloudTokenEmpty": "Please paste an Access Token.",
  "chat.copyModel": "Copy model name",
  "chat.conversations": "Conversations",
  "chat.conversationHistory": "Conversation History",
  "chat.noConversations": "No conversations yet",
  "chat.searchConversations": "Search conversations",
  "chat.clearConversationSearch": "Clear search",
  "chat.noConversationSearchResults": "No matching conversations",
  "chat.deleteChat": "Delete",
  "chat.deleteChatConfirm": "Delete this conversation?",
  "chat.renameChat": "Rename",
  "chat.renameChatPrompt": "Rename conversation",
  "chat.renameChatFailed": "Failed to rename conversation.",
  "chat.moreActions": "More actions",
  "chat.searching": "Searching...",
  "chat.imageQueued": "Image generation queued...",
  "chat.imageGenerating": "Generating image...",
  "chat.imageGenerated": "Generated image",
  "chat.searchingFor": "Searching: {0}",
  "chat.progressPreparing": "Preparing",
  "chat.progressDecidingSearch": "Thinking...",
  "chat.progressSkippedSearch": "Skipped web search",
  "chat.progressSkippedReason": "Reason: {0}",
  "chat.progressSearching": "Searching: {0}",
  "chat.progressSearched": "Search complete",
  "chat.progressFindingSources": "Finding sources",
  "chat.progressFoundSources": "Found {0} sources",
  "chat.progressThinking": "Thinking",
  "chat.progressThought": "Thought through",
  "chat.progressWaitingAnswer": "Preparing answer",
  "chat.progressAnswering": "Answering",
  "chat.webSearch": "Web",
  "chat.webSearchToggle": "Toggle fast web search before answering",
  "chat.webSearchUnavailableForASR": "Web search is not available for ASR transcription",
  "chat.webSearchNotConfigured": "Configure Web Search in Settings first",
  "chat.webSearchFailed": "Web search failed: {0}",
  "chat.sources": "Sources",
  "chat.moreSources": "{0} more sources",
  "chat.showSidebar": "Show sidebar",
  "chat.hideSidebar": "Hide sidebar",
  "chat.messages": "{0} messages",
  "chat.selectModel": "Select a model",
  "chat.copyResponse": "Copy response",
  "chat.likeResponse": "Like response",
  "chat.dislikeResponse": "Dislike response",
  "chat.embeddingData": "Embedding data",
  "chat.embeddingUsage": "Prompt tokens {0} · Total tokens {1}",
  "chat.embeddingIndex": "Index",
  "chat.embeddingObject": "Object",
  "chat.embeddingDimensions": "Dimensions",
  "chat.embeddingDimension": "Dimension",
  "chat.embeddingVector": "Vector",
  "chat.embeddingFormat": "Format",
  "chat.embeddingValue": "Value",
  "chat.embeddingEncoded": "encoded",
  "chat.responseMeta": "Tokens {0} · Speed {1}/s · Time {2}",
  "chat.responseMetaPending": "Tokens -- · Speed -- · Time --",
  "chat.justNow": "Just now",
  "chat.minutesAgo": "{0}m ago",
  "chat.hoursAgo": "{0}h ago",
  "chat.daysAgo": "{0}d ago",

  // Pricing
  "nav.pricing": "Pricing",
  "pricing.title": "Pricing",
  "pricing.subtitle": "Compare local, OpenCSG AI Gateway, and third-party model cost at a glance.",
  "pricing.loadFailed": "Failed to load pricing information.",
  "pricing.loading": "Loading pricing information...",
  "pricing.refresh": "Refresh",
  "pricing.refreshing": "Refreshing...",
  "pricing.gateway": "AI Gateway",
  "pricing.gatewayHint": "priced cloud models",
  "pricing.gatewaySubtitle": "Prices come from OpenCSG AI Gateway model metadata.",
  "pricing.localHint": "runs on this device",
  "pricing.thirdPartyHint": "managed by providers",
  "pricing.local": "Local Models",
  "pricing.noLocal": "No local models available.",
  "pricing.localDescription": "Local inference uses your own hardware, so csghub-lite does not charge per token.",
  "pricing.free": "Free",
  "pricing.cloud": "Cloud Models",
  "pricing.noCloud": "No cloud models available.",
  "pricing.cloudPricing": "See OpenCSG pricing",
  "pricing.thirdParty": "Third-party Providers",
  "pricing.noThirdParty": "No third-party providers configured.",
  "pricing.thirdPartyDescription": "Third-party provider prices are billed outside csghub-lite.",
  "pricing.thirdPartyNote": "Contact provider for pricing",
  "pricing.perMillion": "Price per 1M tokens",
  "pricing.perMillionShort": "/ 1M tokens",
  "pricing.model": "Model",
  "pricing.type": "Type",
  "pricing.input": "Input",
  "pricing.output": "Output",
  "pricing.context": "Context",
  "pricing.unknownOwner": "Unknown owner",
  "pricing.notAvailable": "N/A",
  "pricing.moreModels": "+{0} more models",
  "pricing.typeServerless": "Serverless",
  "pricing.typeExternal": "External",
  "pricing.typeInference": "Dedicated",
  "pricing.typeCloud": "Cloud",
};

const zh: Record<string, string> = {
  // Nav
  "nav.dashboard": "仪表盘",
  "nav.marketplace": "市场",
  "nav.library": "模型库",
  "nav.chat": "对话",
  "nav.images": "图像生成",
  "nav.aiApps": "应用",
  "nav.aiGateway": "AI 网关",

  // Dashboard
  "dash.resource": "资源使用情况",
  "dash.updates": "每 3 秒更新",
  "dash.cpu": "CPU 使用率",
  "dash.ram": "内存使用率",
  "dash.gpu": "GPU 内存",
  "dash.na": "N/A",
  "dash.totalOnly": "总量 {0} GB",
  "dash.unifiedMemory": "统一内存",
  "dash.usageUnavailable": "暂不支持实时占用",
  "dash.active": "运行中的推理模型",
  "dash.noModels": "当前没有运行中的模型。",
  "dash.modelName": "模型名称",
  "dash.expiresAt": "过期时间",
  "dash.actions": "操作",
  "dash.format": "格式",
  "dash.apiInfo": "API 调用",
  "dash.unload": "卸载",
  "dash.logs": "实时日志",
  "dash.streaming": "传输中",
  "dash.paused": "已暂停",
  "dash.clear": "清除",
  "dash.waitLogs": "等待日志...",
  "dash.apiTitle": "API 调用示例",
  "dash.apiModel": "模型",
  "dash.apiCurl": "cURL",
  "dash.apiPython": "Python",
  "dash.apiJs": "JavaScript",
  "dash.close": "关闭",
  "dash.copied": "已复制!",
  "dash.copy": "复制",

  // Marketplace
  "mp.title": "市场",
  "mp.subtitle": "模型应用市场，支持快速加载和使用。",
  "mp.models": "模型",
  "mp.datasets": "数据集",
  "mp.search": "搜索...",
  "mp.trending": "热门",
  "mp.recentlyUpdated": "最近更新",
  "mp.mostDownloads": "下载最多",
  "mp.mostLikes": "最多收藏",
  "mp.loading": "加载中...",
  "mp.noModels": "未找到模型。",
  "mp.noDatasets": "未找到数据集。",
  "mp.prev": "上一页",
  "mp.next": "下一页",
  "mp.page": "第 {0} 页 / 共 {1} 页",
  "mp.done": "完成！",
  "mp.downloaded": "已下载",
  "mp.failed": "失败",
  "mp.pulling": "拉取中...",
  "mp.download": "下载",
  "mp.format": "格式",
  "mp.viewDetails": "查看详情",
  "mp.detailSubtitle": "查看模型参数、运行框架标签，以及 GGUF 量化版本。",
  "mp.loadingDetail": "模型详情加载中...",
  "mp.failedLoadDetail": "加载模型详情失败。",
  "mp.modelParams": "模型参数",
  "mp.architecture": "架构",
  "mp.tensorType": "张量类型",
  "mp.downloads": "下载量",
  "mp.updated": "更新时间",
  "mp.runtimeFrameworks": "运行框架",
  "mp.tasks": "任务类型",
  "mp.quantizations": "GGUF 量化类型",
  "mp.quantizationsHint": "以下量化版本是根据仓库中的 GGUF 文件自动识别的。",
  "mp.sortBy": "排序",
  "mp.filter": "筛选",
  "mp.activeFilters": "正在筛选结果",
  "mp.noActiveFilters": "未应用筛选",
  "mp.clearFilters": "清除筛选",
  "mp.modelType": "模型类型",
  "mp.allModelTypes": "全部类型",
  "mp.modelTypeGGUF": "GGUF",
  "mp.modelTypeSafeTensors": "SafeTensors",
  "mp.taskType": "任务类型",
  "mp.allTaskTypes": "全部任务",
  "mp.taskTextGeneration": "文本生成",
  "mp.taskFeatureExtraction": "特征提取",
  "mp.taskSentenceSimilarity": "句子相似度",
  "mp.taskASR": "语音识别",
  "mp.taskTextToImage": "文生图",
  "mp.taskImageToImage": "图生图",
  "mp.modelSize": "模型大小",
  "mp.allModelSizes": "全部大小",
  "mp.modelSizeB": "{0}B",
  "mp.modelSizeRange": "参数区间",
  "mp.modelSizeAny": "全部大小",
  "mp.modelSizeRangeValue": "{0}B - {1}B",
  "mp.modelSizeMax": "最大 {0}B",
  "mp.modelSizeSliderHint": "滑杆 {0}B - {1}B",
  "mp.modelSizeUnder1B": "< 1B",
  "mp.modelSizeOver100B": "> 100B",
  "mp.quickSizes": "快速直达",
  "mp.minimum": "最小",
  "mp.maximum": "最大",
  "mp.updatedAt": "更新时间: {0}",
  "mp.viewer": "浏览",
  "mp.localInference": "本地推理",
  "mp.localInferenceSupported": "支持本地推理",
  "mp.localInferenceNotSupported": "不支持本地推理",
  "mp.localInferenceDirect": "支持（GGUF，下载后可直接运行）",
  "mp.localInferenceConvert": "支持（首次运行时会自动转换）",
  "mp.localInferenceImage": "支持（文生图运行时）",
  "mp.localInferenceASR": "支持（ASR 语音识别运行时）",
  "mp.localInferenceNone": "暂不支持",

  // Downloads
  "downloads.model": "模型",
  "downloads.dataset": "数据集",
  "downloads.progress": "下载进度",
  "downloads.none": "—",
  "downloads.downloading": "下载中",
  "downloads.downloadingPercent": "下载中 {0}%",
  "downloads.interrupted": "已中断",
  "downloads.failed": "失败",
  "downloads.done": "完成",
  "downloads.resume": "继续下载",
  "downloads.pause": "暂停",
  "downloads.clear": "清除",

  // AI Apps
  "aiApps.title": "应用",
  "aiApps.subtitle": "在 CSGHub-Lite 环境中发现并集成强大的 AI 应用。",
  "aiApps.search": "搜索应用...",
  "aiApps.results": "{0} 个应用",
  "aiApps.loading": "加载应用中...",
  "aiApps.noResults": "没有匹配当前搜索条件的应用。",
  "aiApps.installed": "已安装",
  "aiApps.details": "详情",
  "aiApps.chat": "对话",
  "aiApps.open": "打开",
  "aiApps.launch": "启动应用",
  "aiApps.start": "启动",
  "aiApps.stop": "停止",
  "aiApps.starting": "启动中...",
  "aiApps.stopping": "停止中...",
  "aiApps.model": "模型",
  "aiApps.modelHint": "选择要用来启动该应用的本地或 OpenCSG 模型。",
  "aiApps.modelLoading": "正在加载模型...",
  "aiApps.modelDefault": "使用应用默认模型",
  "aiApps.modelSourceCloud": "OpenCSG",
  "aiApps.modelSourceLocal": "本地",
  "aiApps.liveLogs": "实时日志",
  "aiApps.install": "安装",
  "aiApps.installLatest": "安装最新版本",
  "aiApps.reinstallLatest": "重装最新版本",
  "aiApps.retryInstall": "重试安装",
  "aiApps.uninstall": "卸载",
  "aiApps.disabled": "已禁用",
  "aiApps.installPreview": "安装预览",
  "aiApps.setupDetails": "安装详情",
  "aiApps.loadFailed": "加载应用状态失败。",
  "aiApps.openFailed": "打开应用失败。",
  "aiApps.startFailed": "启动应用失败。",
  "aiApps.stopFailed": "停止应用失败。",
  "aiApps.installFailed": "安装失败",
  "aiApps.installRunning": "安装进行中",
  "aiApps.uninstallFailed": "卸载失败",
  "aiApps.uninstallRunning": "卸载进行中",
  "aiApps.installedReady": "该应用已安装，你可以在这里继续更新到最新版本。",
  "aiApps.installedExternalReady": "检测到该应用在 csghub-lite 接管前已安装。你仍可在这里直接打开它，但更新和卸载请继续使用原有安装方式。",
  "aiApps.updateAvailableNotice": "镜像中有新版本可用：{0}。可在这里重装完成升级。",
  "aiApps.readyToInstall": "该应用已准备好安装。",
  "aiApps.disabledDockerNotice": "依赖 Docker 的应用目前在应用页暂不支持，请先手动安装。",
  "aiApps.disabledLinuxNotice": "该桌面应用暂不支持 Linux。",
  "aiApps.disabledWindowsNotice": "该应用暂不支持 Windows。",
  "aiApps.installMode": "安装方式",
  "aiApps.progressMode": "进度展示",
  "aiApps.currentStatus": "当前状态",
  "aiApps.runtimeStatus": "运行状态",
  "aiApps.runtime.running": "运行中",
  "aiApps.runtime.stopped": "已停止",
  "aiApps.version": "版本",
  "aiApps.currentVersion": "当前版本",
  "aiApps.latestVersion": "最新版本",
  "aiApps.updateStatus": "升级状态",
  "aiApps.updateAvailable": "可升级",
  "aiApps.updateAvailableShort": "最新：{0}",
  "aiApps.upToDate": "已是最新",
  "aiApps.latestKnown": "已获取最新版本",
  "aiApps.latestUnknown": "未知",
  "aiApps.installPath": "安装路径",
  "aiApps.logFile": "日志文件",
  "aiApps.lastError": "最近错误",
  "aiApps.commandPreview": "命令预览",
  "aiApps.installCommand": "安装命令",
  "aiApps.cnHint": "镜像与网络说明",
  "aiApps.cliLaunch": "命令行启动",
  "aiApps.cliLaunchHint": "可通过托管 CLI 启动该应用。`--model` 用于指定模型，放在 `--` 之后的参数会继续透传给应用自身。",
  "aiApps.currentModelId": "当前模型 ID",
  "aiApps.currentModelHint": "可在这里切换要用于启动的模型 ID，并按需复制给 `csghub-lite launch --model` 使用。",
  "aiApps.desktopLaunch": "启动桌面应用",
  "aiApps.desktopLaunchHint": "在本机打开 Codex App。模型配置会写入 ~/.codex/config.toml，与 Codex CLI 共用。",
  "aiApps.codexConfigPath": "Codex 配置",
  "aiApps.openDocs": "打开文档",
  "aiApps.openSettings": "前往设置",
  "aiApps.error.noLocalModelsOpenCSG": "当前还没有本地模型。你可以先拉取本地模型，或前往设置登录 OpenCSG / 保存 API Key。",
  "aiApps.error.noLocalOrCloudModels": "当前既没有本地模型，也没有可用的 OpenCSG 模型。你可以先拉取本地模型，或前往设置检查 OpenCSG 模型访问权限。",
  "aiApps.error.noModelsFound": "当前没有可用模型，请先拉取模型后再打开应用。",
  "aiApps.error.modelUnavailableWithCloudHint": "模型“{0}”当前不能用于 AI 应用。如果你想使用 OpenCSG 模型，请先前往设置登录 OpenCSG 或保存 API Key。",
  "aiApps.error.modelUnavailableCloudHint": "当前模型不能用于 AI 应用。如果你想使用 OpenCSG 模型，请先前往设置登录 OpenCSG 或保存 API Key。",
  "aiApps.error.modelUnavailable": "模型“{0}”当前不能用于 AI 应用。",
  "aiApps.error.localhostRequired": "Codex App 只能在通过 localhost 访问 csghub-lite 时打开。",
  "aiApps.plannedSteps": "计划步骤",
  "aiApps.taskLogs": "任务日志",
  "aiApps.streaming": "实时中",
  "aiApps.opening": "打开中...",
  "aiApps.launching": "启动中...",
  "aiApps.openingWindowHint": "正在准备本地应用入口，窗口会自动继续跳转。",
  "aiApps.shellTitle": "AI 应用终端",
  "aiApps.shellConnecting": "连接终端中",
  "aiApps.shellConnected": "已连接",
  "aiApps.shellDisconnected": "连接已断开",
  "aiApps.shellExited": "已退出",
  "aiApps.shellReconnect": "重新连接",
  "aiApps.shellApplyModel": "切换模型",
  "aiApps.shellApplyingModel": "切换中...",
  "aiApps.shellModel": "模型",
  "aiApps.shellDirectory": "目录",
  "aiApps.shellDirectoryPlaceholder": "项目目录路径",
  "aiApps.shellApplyLaunch": "应用",
  "aiApps.shellApplyingLaunch": "应用中...",
  "aiApps.shellExitCode": "退出码：{0}",
  "aiApps.shellExitNotice": "进程已退出，退出码 {0}",
  "aiApps.shellSessionMissing": "终端会话不存在，或已过期。",
  "aiApps.shellConnectionFailed": "连接本地终端会话失败。",
  "aiApps.paused": "已暂停",
  "aiApps.waitLogs": "等待日志...",
  "aiApps.logsScope": "这里展示的是当前所选应用的真实安装或卸载日志。",
  "aiApps.visitWebsite": "访问官网",
  "aiApps.close": "关闭",
  "aiApps.indeterminate": "不定进度",
  "aiApps.modeNpm": "npm",
  "aiApps.modeDocker": "Docker",
  "aiApps.modeScript": "脚本",
  "aiApps.status.idle": "可安装",
  "aiApps.status.installing": "安装中",
  "aiApps.status.uninstalling": "卸载中",
  "aiApps.status.installed": "已安装",
  "aiApps.status.failed": "失败",
  "aiApps.status.disabled": "已禁用",
  "aiApps.phase.ready": "可安装",
  "aiApps.phase.starting": "启动安装器",
  "aiApps.phase.preflight": "检查前置条件",
  "aiApps.phase.ensuring_node": "准备 Node.js",
  "aiApps.phase.detecting_platform": "识别平台",
  "aiApps.phase.resolving_latest": "解析最新版本",
  "aiApps.phase.downloading_binary": "下载二进制",
  "aiApps.phase.downloading_archive": "下载安装包",
  "aiApps.phase.verifying_checksum": "校验文件完整性",
  "aiApps.phase.installing_runtime": "安装运行时",
  "aiApps.phase.extracting_archive": "解压安装包",
  "aiApps.phase.stopping_services": "停止相关服务",
  "aiApps.phase.removing_runtime": "移除运行时",
  "aiApps.phase.checking_node": "检查 Node.js",
  "aiApps.phase.ensuring_search_tools": "准备搜索工具",
  "aiApps.phase.installing_pi": "安装 Pi",
  "aiApps.phase.verifying_pi": "校验 Pi 安装",
  "aiApps.phase.uninstalling_pi": "卸载 Pi",
  "aiApps.phase.prewarming_runtime": "预热运行时",
  "aiApps.phase.prewarming_gateway": "预热网关",
  "aiApps.phase.platform_unsupported": "暂不支持当前平台",
  "aiApps.phase.installing": "安装依赖包",
  "aiApps.phase.running_installer": "运行安装器",
  "aiApps.phase.removing_package": "移除全局包",
  "aiApps.phase.removing_binary": "移除可执行文件",
  "aiApps.phase.removing_files": "清理运行时文件",
  "nav.upgrade": "升级",
  "upgrade.title": "升级 CSGHub Lite",
  "upgrade.subtitle": "更新到最新版本",
  "upgrade.currentVersion": "当前版本",
  "upgrade.latestVersion": "最新版本",
  "upgrade.upgrade": "升级",
  "upgrade.available": "可升级到 {0}",
  "upgrade.upToDate": "当前已是最新版本。",
  "upgrade.confirm": "立即升级",
  "upgrade.cancel": "稍后再说",
  "upgrade.upgrading": "正在升级...",
  "upgrade.starting": "正在启动升级...",
  "upgrade.success": "成功",
  "upgrade.successMessage": "升级已完成，CSGHub Lite 正在重启，页面将自动刷新。",
  "upgrade.refresh": "刷新",
  "upgrade.failed": "升级失败",
  "upgrade.connectionError": "连接错误，请重试。",
  "aiApps.phase.cleaning_up": "清理残留文件",
  "aiApps.phase.verifying": "校验安装结果",
  "aiApps.phase.verifying_uninstall": "校验卸载结果",
  "aiApps.phase.installed": "已安装",
  "aiApps.phase.failed": "安装失败",
  "aiApps.phase.uninstall_failed": "卸载失败",
  "aiApps.phase.complete": "完成",
  "aiApps.phase.docker_disabled": "应用页暂不支持",
  "aiApps.phase.windows_unsupported": "暂不支持 Windows",
  "aiApps.phase.linux_unsupported": "暂不支持 Linux",
  "nav.settings": "设置",
  "nav.apiDocs": "API",
  "nav.help": "帮助",
  "settings.title": "设置",
  "settings.subtitle": "集中管理产品相关设置。",
  "settings.tabSystem": "系统设置",
  "settings.tabAPIKeys": "API Key 管理",
  "settings.tabUsage": "用量统计",
  "settings.never": "从未",
  "settings.copy": "复制",
  "settings.copied": "已复制",
  "settings.modelLocation": "存储位置",
  "settings.modelLocationDesc": "模型和数据集共用的基础目录。csghub-lite 会在此目录下创建 `models/` 和 `datasets/`。",
  "settings.browse": "浏览",
  "settings.directoryBrowserTitle": "选择文件夹",
  "settings.directoryBrowserDesc": "选择用于存放模型和数据集文件的本地目录。",
  "settings.currentFolder": "当前文件夹",
  "settings.upOneLevel": "上一级",
  "settings.loadingDirectories": "正在加载目录...",
  "settings.noDirectories": "没有子目录。",
  "settings.useCurrentFolder": "使用此文件夹",
  "settings.home": "主目录",
  "settings.cancel": "取消",
  "settings.storageDirSaveFailed": "保存存储目录失败。",
  "settings.directoryBrowseFailed": "浏览本地目录失败。",
  "settings.modelsPath": "模型目录：{0}",
  "settings.datasetsPath": "数据集目录：{0}",
  "settings.contextLength": "上下文长度",
  "settings.contextLengthDesc": "上下文长度决定了本地 LLM 可以记住多少对话内容并用于生成回复。",
  "settings.parallelSlots": "并发数",
  "settings.parallelSlotsDesc": "本地 LLM 推理服务可同时处理的并发请求数量。数值越大占用内存越多。",
  "settings.versionInfo": "版本信息",
  "settings.save": "保存",
  "settings.resetDefaults": "恢复默认设置",
  "settings.resettingDefaults": "恢复中...",
  "settings.resetDefaultsSuccess": "已恢复默认设置。",
  "settings.resetDefaultsFailed": "恢复默认设置失败。",
  "settings.language": "语言",
  "settings.languageDesc": "选择界面显示语言。",
  "settings.serviceUrls": "云端服务",
  "settings.serviceUrlsDesc": "配置内置云端模型服务、AI Gateway 地址和 provider 展示名称。留空或恢复默认设置会使用内置默认值。",
  "settings.serverUrl": "CSGHub Server URL",
  "settings.aiGatewayUrl": "AI Gateway URL",
  "settings.cloudProviderName": "云端 Provider 名称",
  "settings.cloudProviderNameHint": "用于内置云端模型的 provider 名称。默认：{0}",
  "settings.serviceUrlDefault": "默认：{0}",
  "settings.serviceUrlsSaveSuccess": "云端服务设置已保存。",
  "settings.serviceUrlsResetSuccess": "已恢复默认云端服务设置。",
  "settings.serviceUrlsSaveFailed": "保存云端服务设置失败。",
  "settings.cloudModelsRefresh": "刷新模型",
  "settings.cloudModelsRefreshing": "刷新中...",
  "settings.cloudModelsRefreshSuccess": "云端模型列表已刷新。",
  "settings.cloudModelsRefreshFailed": "刷新云端模型失败。",
  "settings.webSearch": "Web Search",
  "settings.webSearchDesc": "为 Lite Chat 使用内置免费互联网搜索引擎，并参考 SearXNG 的 provider fallback 与结果归一化思路。",
  "settings.webSearchOn": "已开启",
  "settings.webSearchOff": "已关闭",
  "settings.webSearchEngines": "内置搜索引擎：搜狗、百度、夸克、Bing、DuckDuckGo，无需本地搜索服务。",
  "settings.webSearchMaxResults": "最多结果数",
  "settings.webSearchTimeout": "超时时间（秒）",
  "settings.webSearchLanguage": "搜索语言",
  "settings.webSearchSafeSearch": "安全搜索",
  "settings.webSearchSafeOff": "关闭",
  "settings.webSearchSafeModerate": "中等",
  "settings.webSearchSafeStrict": "严格",
  "settings.webSearchSaveFailed": "保存 Web Search 设置失败。",
  "settings.diffuser": "Diffuser",
  "settings.diffuserDesc": "管理文生图模型使用的本地 Diffuser 运行环境。",
  "settings.diffuserUpgradeTitle": "升级 Diffuser",
  "settings.diffuserUpgradeHint": "重新安装并升级 Diffuser 相关 Python 包。当文生图模型需要更新的运行依赖时使用。",
  "settings.diffuserUpgrade": "升级 Diffuser",
  "settings.diffuserUpgrading": "升级中...",
  "settings.diffuserUpgradeSuccess": "Diffuser 升级成功。",
  "settings.diffuserUpgradeFailed": "升级 Diffuser 失败。",
  "settings.autostart": "开机自启动",
  "settings.autostartDesc": "登录计算机时自动启动 csghub-lite。",
  "settings.autostartOn": "已开启",
  "settings.autostartOff": "已关闭",
  "settings.account": "账号",
  "settings.accountDesc": "查看当前 OpenCSG 登录信息，必要时可退出登录。",
  "settings.cloudAPIKey": "{0} API Key",
  "settings.cloudAPIKeyDesc": "管理用于 {0} 云端模型请求的 API Key。",
  "settings.cloudAPIKeyStatusHint": "手动填写的 API Key 会优先于登录后获取的 built-in API Key。",
  "settings.cloudAPIKeyBuiltinStatus": "正在使用 built-in API Key{0}",
  "settings.cloudAPIKeyManualStatus": "正在使用手动 API Key{0}",
  "settings.cloudAPIKeyMissingStatus": "暂无可用 API Key",
  "settings.cloudAPIKeyInputHint": "在这里粘贴 OpenCSG API Key，可覆盖 built-in API Key。",
  "settings.openAPIKeyPage": "打开 API Key 页面",
  "settings.clearAPIKey": "清除 API Key",
  "settings.clearingAPIKey": "清除中...",
  "settings.providers": "第三方 Provider",
  "settings.providersDesc": "添加 OpenAI 兼容 Provider，让它们的模型和本地、OpenCSG 模型一起出现在 Chat 中。",
  "settings.providersConfigured": "已配置 {0} 个 Provider",
  "settings.providersHint": "API Key 仅保存在本机 csghub-lite 配置目录。",
  "settings.providersEmpty": "还没有配置第三方 Provider。",
  "settings.providersLoadFailed": "加载第三方 Provider 失败。",
  "settings.providerAdd": "添加 Provider",
  "settings.providerEdit": "编辑",
  "settings.providerDelete": "删除",
  "settings.providerAddTitle": "添加 Provider",
  "settings.providerEditTitle": "编辑 Provider",
  "settings.providerDialogDesc": "请使用 OpenAI 兼容 Base URL，例如 https://api.openai.com/v1。",
  "settings.providerType": "Provider 类型",
  "settings.providerName": "名称",
  "settings.providerBaseURL": "Base URL",
  "settings.providerAPIKey": "API Key",
  "settings.providerAPIKeyUnchanged": "留空则继续使用当前 Key",
  "settings.providerSave": "保存 Provider",
  "settings.providerSaveNext": "下一步",
  "settings.providerModelsTitle": "选择 Provider 模型",
  "settings.providerModelsDesc": "选择 {0} 中要显示到 csghub-lite 的模型。",
  "settings.providerModelsEmpty": "这个 Provider 没有返回模型。",
  "settings.providerModelsLoadFailed": "加载 Provider 模型失败。",
  "settings.providerModelsSaveFailed": "保存已选模型失败。",
  "settings.providerModelsSave": "保存模型",
  "settings.providerModelsNoneSelected": "未选择模型",
  "settings.providerModelsMore": "另有 {0} 个",
  "settings.providerModelDisplayNamePlaceholder": "可选显示名称",
  "settings.providerModelEdit": "修改",
  "settings.providerModelEditTitle": "修改 Provider 模型",
  "settings.providerModelEditDesc": "修改客户端调用时使用的模型 ID。真正转发给上游时仍使用原始 Provider 模型 ID。",
  "settings.providerModelID": "模型 ID",
  "settings.providerModelDisplayName": "显示名称",
  "settings.providerModelDescription": "描述",
  "settings.providerModelDescriptionPlaceholder": "可选描述",
  "settings.providerModelOptionalFieldHint": "留空则保持现有值不变。",
  "settings.providerModelSave": "保存模型",
  "settings.providerModelIDRequired": "模型 ID 必填。",
  "settings.providerModelUpdateFailed": "更新 Provider 模型失败。",
  "gateway.eyebrow": "AI 网关",
  "gateway.title": "AI 网关",
  "gateway.subtitle": "在独立网关页面统一管理本地推理 API Key、远程访问协议和 Token 用量。",
  "gateway.tabProviders": "Provider",
  "gateway.snapshotAuth": "鉴权",
  "gateway.snapshotKeys": "Key 数量",
  "gateway.snapshotProtocols": "协议",
  "gateway.authStatus": "当前状态",
  "gateway.cloudKeyBadge": "{0} 云端",
  "gateway.createKeyTitle": "创建新的 API Key",
  "gateway.keyListTitle": "API Key 列表",
  "gateway.keyListDesc": "这些 Key 可用于可信客户端调用本地推理网关。",
  "gateway.keyCount": "{0} 个 Key",
  "gateway.providerModels": "已选模型",
  "pipeline.languageModel": "语言",
  "pipeline.imageGeneration": "图像生成",
  "pipeline.imageToImage": "图像编辑",
  "pipeline.textToVideo": "视频生成",
  "pipeline.imageToVideo": "图生视频",
  "pipeline.videoUnderstanding": "视频输入",
  "pipeline.textToSpeech": "语音合成",
  "pipeline.speechRecognition": "语音识别",
  "pipeline.modalityImage": "图片",
  "pipeline.modalityVideo": "视频",
  "pipeline.modalityAudio": "音频",
  "pipeline.modalityFile": "文件",
  "pipeline.modalityText": "文本",
  "pipeline.inputCapability": "{0}输入",
  "pipeline.outputCapability": "{0}输出",
  "settings.providerNameURLRequired": "名称和 Base URL 必填。",
  "settings.providerAPIKeyRequired": "API Key 必填。",
  "settings.providerSaveFailed": "保存 Provider 失败。",
  "settings.providerDeleteFailed": "删除 Provider 失败。",
  "settings.providerDeleteConfirm": "确定删除 Provider「{0}」？",
  "settings.providerEnabled": "已启用",
  "settings.providerDisabled": "已禁用",
  "settings.apiDocs": "API 文档",
  "settings.apiDocsDesc": "打开本地 REST 和兼容接口文档。",
  "settings.apiDocsTitle": "本地 API 参考",
  "settings.apiDocsHint": "包含 `/api/*`、OpenAI 兼容接口和 Anthropic 兼容接口的 Swagger UI。",
  "settings.openApiDocs": "打开 API 文档",
  "settings.feedback": "问题反馈",
  "settings.feedbackDesc": "在 GitHub 上反馈问题或提交建议。",
  "settings.feedbackTitle": "反馈与问题",
  "settings.feedbackHint": "一键打开当前项目的 GitHub 主页。",
  "settings.openFeedback": "打开 GitHub",
  "settings.loggedOut": "未登录",
  "settings.loggedOutDesc": "登录 OpenCSG 并保存 Access Token 后，可使用账号的 built-in API Key 调用 OpenCSG 模型。",
  "settings.login": "打开登录",
  "settings.openTokenPage": "打开 Access Token 页面",
  "settings.tokenSaved": "已保存 Access Token",
  "settings.tokenSavedDesc": "暂时无法加载账号详情。你可以重新登录或退出。",
  "settings.tokenInputHint": "在这里粘贴 OpenCSG Access Token，用于登录或替换已保存的 Token。",
  "settings.logout": "退出登录",
  "settings.loggingOut": "退出中...",
  "settings.localAPIKeys": "本地网关 API Key",
  "settings.localAPIKeysDesc": "管理远程访问当前本地推理服务所需的 API Key。",
  "settings.localAPIAuth": "远程访问授权",
  "settings.localAPIAuthDesc": "开启后，远程推理 API 请求必须携带 API Key。本机 localhost 访问无需鉴权。",
  "settings.localAPIAuthOn": "需要 API Key",
  "settings.localAPIAuthOff": "未开启",
  "settings.localAPIBaseURL": "专属 Base URL",
  "settings.localAPIBaseURLDesc": "远程客户端可使用这些 Base URL 搭配生成的 API Key 访问。",
  "settings.localAPIBaseURLOpenAI": "兼容 OpenAI 接口协议",
  "settings.localAPIBaseURLAnthropic": "兼容 Anthropic 接口协议",
  "settings.localAPIAccessMethod": "访问方式",
  "settings.localAPIKeyName": "Key 名称",
  "settings.localAPIKeyNamePlaceholder": "Notebook、局域网客户端或服务名称",
  "settings.localAPIKeyAdd": "添加 API Key",
  "settings.localAPIKeyCreate": "创建 API Key",
  "settings.localAPIKeyCreated": "API Key 已创建",
  "settings.localAPIKeyCreatedHint": "请立即复制保存，此 Key 之后不会再次显示。",
  "settings.localAPIKeysEmpty": "还没有创建本地推理 API Key。",
  "settings.localAPIKeyPrefix": "前缀：{0}",
  "settings.localAPIKeyLastUsed": "最近使用：{0}",
  "settings.localAPIKeyDelete": "删除",
  "settings.localAPIKeyDeleteConfirm": "确定删除这个 API Key？",
  "settings.localAPIKeysLoadFailed": "加载本地推理 API Key 失败。",
  "settings.localAPIAuthSaveFailed": "保存授权设置失败。",
  "settings.localAPIKeyCreateFailed": "创建 API Key 失败。",
  "settings.localAPIKeyDeleteFailed": "删除 API Key 失败。",
  "settings.apiUsage": "用量统计",
  "settings.apiUsageDesc": "查看本地模型和云端模型的累计 Token 消耗。",
  "settings.apiUsageRefresh": "刷新",
  "settings.apiUsageEmpty": "暂无 API 用量记录。",
  "settings.apiUsageLoadFailed": "加载 API 用量失败。",
  "settings.apiUsagePeriodWeek": "最近 7 天",
  "settings.apiUsagePeriodMonth": "最近 30 天",
  "settings.apiUsagePeriodYear": "最近 12 个月",
  "settings.apiUsageRequests": "请求数",
  "settings.apiUsageInput": "输入 Tokens",
  "settings.apiUsageOutput": "输出 Tokens",
  "settings.apiUsageTotal": "总 Tokens",
  "settings.apiUsageKey": "客户端",
  "settings.apiUsageSource": "来源",
  "settings.apiUsageSourceLocal": "本地",
  "settings.apiUsageSourceCloud": "OpenCSG",
  "settings.apiUsageSourceProvider": "第三方 Provider",
  "settings.apiUsageSourceUnknown": "未知",
  "settings.apiUsageSourceAll": "全部来源",
  "settings.apiUsageSourceRequests": "{0} 次请求",
  "settings.apiUsageModel": "模型",
  "settings.apiUsageTokens": "Tokens",
  "settings.apiUsageLastUsed": "最近使用",
  "settings.apiUsageCumulative": "累计消耗",
  "settings.apiUsageLocalModels": "本地模型",
  "settings.apiUsageCloudModels": "云端模型",
  "settings.apiUsageTotalHistory": "历史总计",
  "settings.apiUsageBreakdown": "模型明细",
  "settings.apiUsageProviderFilter": "Provider",
  "settings.apiUsageProviderAll": "全部 Provider",

  // Library
  "lib.title": "模型库",
  "lib.subtitle": "已有模型管理",
  "lib.all": "全部",
  "lib.search": "搜索本地模型...",
  "lib.results": "{0} 个模型",
  "lib.searching": "搜索中...",
  "lib.modelName": "模型名称",
  "lib.format": "格式",
  "lib.fileSize": "文件大小",
  "lib.dateTime": "日期时间",
  "lib.operation": "操作",
  "lib.noModels": "未找到模型。请从市场拉取模型。",
  "lib.noSearchResults": "没有匹配当前搜索条件的模型。",
  "lib.upload": "上传模型",
  "lib.uploadTitle": "上传本地模型",
  "lib.uploadDesc": "将模型压缩包、GGUF/SafeTensors 文件或完整模型文件夹导入本地模型库。",
  "lib.uploadModelID": "模型 ID",
  "lib.uploadModelIDHint": "使用 namespace/name 格式，例如 local/qwen-gguf。",
  "lib.uploadDropTitle": "将模型文件或文件夹拖到这里",
  "lib.uploadDropDesc": "支持 .zip、.tar、.tar.gz、.tgz、.gguf、.safetensors、.bin 和模型文件夹。",
  "lib.uploadPickFiles": "选择文件/压缩包",
  "lib.uploadPickFolder": "选择文件夹",
  "lib.uploadNoFiles": "尚未选择文件。",
  "lib.uploadSelected": "已选择 {0} 个文件，{1}",
  "lib.uploadMoreFiles": "还有 {0} 个文件",
  "lib.uploadOverwrite": "覆盖相同 ID 的已有模型",
  "lib.uploadSubmit": "上传",
  "lib.uploading": "上传中...",
  "lib.uploadProgress": "正在上传 {0}%",
  "lib.uploadFailed": "上传模型失败",
  "lib.uploadReadFailed": "读取拖拽文件失败。",
  "lib.uploadModeArchive": "压缩包",
  "lib.uploadModeDirectory": "文件夹",
  "lib.uploadModeFiles": "文件",
  "lib.delete": "删除",
  "lib.api": "API",
  "lib.deleteConfirm": "确定删除模型 \"{0}\" 吗？",
  "lib.details": "详情",
  "lib.back": "返回",
  "lib.running": "运行中",
  "lib.converting": "转换中...",
  "lib.loadingImageRuntime": "加载图像运行环境...",
  "lib.loadingASRRuntime": "加载 ASR 运行环境...",
  "lib.loadingModel": "加载中...",
  "lib.run": "运行",
  "lib.runParamsTitle": "运行参数",
  "lib.runParamsDesc": "为 {0} 选择运行选项。这些选项与 `csghub-lite run` 参数一致，并会记住供下次使用。",
  "lib.runParamsDescImage": "为 {0} 选择图像运行选项。Diffusers 会自动选择设备和 dtype。",
  "lib.runParamsDescASR": "为 {0} 选择 ASR 运行选项。Python ASR runtime 会自动选择设备和 dtype。",
  "lib.runParamsDescEmbedding": "为 {0} 选择 embedding 运行选项。聊天专用的 cache 和并发参数已隐藏。",
  "lib.runParamDefault": "默认",
  "lib.runParamNumCtx": "上下文长度",
  "lib.runParamNumCtxHint": "`--num-ctx`；留空使用模型或服务默认值。",
  "lib.runParamNumParallel": "并发槽位",
  "lib.runParamNumParallelHint": "`--num-parallel`；设为 1 可尽量保留单会话上下文。",
  "lib.runParamNGPULayers": "GPU 层数",
  "lib.runParamNGPULayersHint": "`--n-gpu-layers`；设为 0 可禁用 GPU offload。",
  "lib.runParamCacheTypeK": "K 缓存类型",
  "lib.runParamCacheTypeV": "V 缓存类型",
  "lib.runParamCacheTypeHint": "`--cache-type-*`；llama-server 的 KV cache dtype。",
  "lib.runParamDType": "转换 dtype",
  "lib.runParamDTypeHint": "`--dtype`；SafeTensors 需要转换 GGUF 时使用。",
  "lib.runParamKeepAlive": "Keep alive",
  "lib.runParamKeepAliveHint": "`--keep-alive`；例如 5m、1h，或 -1 表示保持加载直到手动停止。",
  "lib.runParamImageRuntimeHint": "图像模型会自动准备所需的运行环境。通常只需要设置模型加载后保留多久。",
  "lib.runParamASRRuntimeHint": "ASR 模型会自动准备 Python ASR 运行环境。上下文、cache、GPU 层数和 dtype 参数不适用。",
  "lib.runParamCancel": "取消",
  "lib.runParamSubmit": "运行",
  "lib.runParamInteger": "{0} 必须是整数。",
  "lib.runParamMin": "{0} 不能小于 {1}。",
  "lib.runParamInvalid": "运行参数无效。",
  "lib.failedLoad": "加载模型失败",
  "lib.failedLoadModels": "加载模型列表失败",
  "lib.loadingDetail": "加载模型详情中...",
  "lib.detailSubtitle": "查看这个本地模型的文件列表和下载命令。",
  "lib.localInference": "本地推理",
  "lib.localInferenceSupported": "支持本地推理",
  "lib.localInferenceNotSupported": "不支持本地推理",
  "lib.localInferenceDirect": "支持（GGUF，下载后可直接运行）",
  "lib.localInferenceConvert": "支持（首次运行时会自动转换）",
  "lib.localInferenceImage": "支持（文生图运行时）",
  "lib.localInferenceASR": "支持（ASR 语音识别运行时）",
  "lib.localInferenceNone": "暂不支持",
  "lib.downloadMethods": "下载方式",
  "lib.downloadHint": "建议先获取 manifest，再根据其中每个文件的 download_url 逐个下载。文件接口支持 HEAD 和 Range，可用于断点续传。",
  "lib.manifestUrl": "Manifest 地址",
  "lib.manifestCurl": "使用 curl 获取 manifest",
  "lib.fileCurl": "单文件下载示例",
  "lib.copyUrl": "复制链接",
  "lib.copyCurl": "复制 curl",
  "lib.copyCommand": "复制命令",
  "lib.files": "文件列表",
  "lib.path": "路径",
  "lib.sha256": "SHA256",
  "lib.noFiles": "没有找到文件。",
  "lib.fileCount": "文件数",
  "lib.updated": "更新时间",
  "lib.pipeline": "任务类型",
  "lib.description": "描述",
  "lib.licenseLabel": "许可证",
  "lib.notAvailable": "暂无",

  // Datasets
  "nav.datasets": "数据集",
  "ds.title": "数据集",
  "ds.subtitle": "已有数据集管理",
  "ds.datasetName": "数据集名称",
  "ds.fileSize": "文件大小",
  "ds.dateTime": "日期时间",
  "ds.operation": "操作",
  "ds.noDatasets": "未找到数据集。请从市场拉取数据集。",
  "ds.delete": "删除",
  "ds.deleteConfirm": "确定删除数据集 \"{0}\" 吗？",
  "ds.name": "名称",
  "ds.size": "大小",
  "ds.dateModified": "修改日期",
  "ds.loadingFiles": "加载文件中...",
  "ds.noFiles": "未找到文件。",
  "ds.lessThanMinute": "不到一分钟前",
  "ds.minutesAgo": "{0} 分钟前",
  "ds.hoursAgo": "{0} 小时前",
  "ds.daysAgo": "{0} 天前",
  "ds.search": "搜索数据集...",
  "ds.searching": "搜索中...",
  "ds.results": "{0} 个结果",
  "ds.downloadMethods": "下载方式",
  "ds.downloadHint": "建议先获取 manifest，再根据其中每个文件的 download_url 逐个下载。文件接口支持 HEAD 和 Range，可用于断点续传。",
  "ds.manifestUrl": "Manifest 地址",
  "ds.manifestCurl": "使用 curl 获取 manifest",
  "ds.fileCurl": "单文件下载示例",
  "ds.copyUrl": "复制链接",
  "ds.copyCurl": "复制 curl",
  "ds.copyCommand": "复制命令",
  "ds.fileCount": "文件数",
  "ds.updated": "更新时间",
  "ds.description": "描述",
  "ds.licenseLabel": "许可证",
  "ds.path": "路径",
  "ds.sha256": "SHA256",
  "ds.notAvailable": "暂无",
  "ds.failedLoadDetail": "加载数据集详情失败",
  "ds.detailSubtitle": "查看这个本地数据集的文件列表和下载命令。",
  "ds.back": "返回",

  // Chat
  "chat.newChat": "新对话",
  "chat.chat": "对话",
  "chat.settings": "设置",
  "chat.clearHistory": "清除历史",
  "chat.clearConfirm": "确定清除当前会话的所有消息吗？",
  "chat.suggestion": "参数调节",
  "chat.systemPrompt": "系统提示词",
  "chat.placeholder": "请输入提示词...",
  "chat.resetDefaults": "重置默认",
  "chat.startConv": "开始一段对话...",
  "chat.askImage": "描述一下这张图片...",
  "chat.askImageEdit": "描述你想如何编辑已上传的图片...",
  "chat.askImageGenerate": "描述你想生成的图片...",
  "chat.askAudio": "上传音频或现场录音，也可以补充提示词...",
  "chat.askHelp": "有什么可以帮你的？",
  "chat.thinking": "思考过程",
  "chat.thinkingLive": "正在思考...",
  "chat.uploadImage": "上传图片",
  "chat.uploadAudio": "上传音频",
  "chat.audioFile": "音频文件",
  "chat.recordedAudio": "现场录音",
  "chat.audioPrompt": "提示词",
  "chat.audioReadyHint": "上传或录音结束后会自动开始转写。",
  "chat.removeAudio": "移除音频",
  "chat.transcribe": "转写",
  "chat.startRecording": "开始录音",
  "chat.stopRecording": "停止录音",
  "chat.recordingUnsupported": "当前浏览器不支持录音。",
  "chat.recordingFailed": "录音失败。",
  "chat.transcribingAudio": "正在转写音频...",
  "chat.preparingASRRuntime": "正在准备 ASR 运行环境，首次使用可能需要几分钟...",
  "chat.emptyTranscription": "未返回转写文本。",
  "chat.send": "发送",
  "chat.stop": "停止",
  "chat.failedResp": "获取回复失败，模型是否已加载？",
  "chat.noMmproj": "此视觉模型需要多模态投影（mmproj）文件来处理图片，图片将被忽略。",
  "chat.cloud": "OpenCSG",
  "chat.local": "本地",
  "chat.provider": "Provider",

  // Image generation
  "image.title": "图像生成",
  "image.subtitle": "通过按需安装的 Diffusers runtime 运行本地文生图和图生图/编辑模型。",
  "image.runtimeRequired": "需要图像运行环境",
  "image.runtimeMissing": "生成图片前需要安装本地 Diffusers runtime。",
  "image.installRuntime": "安装运行环境",
  "image.installing": "安装中...",
  "image.model": "模型",
  "image.prompt": "提示词",
  "image.promptPlaceholder": "描述你想生成的图片，或如何编辑输入图片...",
  "image.negativePrompt": "反向提示词",
  "image.negativePlaceholder": "例如：低质量、模糊、水印、多余手指...",
  "image.negativeHint": "用于告诉模型避免哪些画面问题。",
  "image.negativeSuggestions": "常见反向词",
  "image.negativeLowQuality": "低质量",
  "image.negativeBlurry": "模糊",
  "image.negativeBadHands": "手部错误",
  "image.negativeWatermark": "水印",
  "image.negativeDistorted": "面部扭曲",
  "image.negativeExtraLimbs": "多余肢体",
  "image.size": "尺寸",
  "image.sizeHint": "常用比例或自定义尺寸",
  "image.sizeSquare": "方图",
  "image.sizeLandscape": "16:9",
  "image.sizePortrait": "9:16",
  "image.sizeClassicLandscape": "4:3",
  "image.sizeClassicPortrait": "3:4",
  "image.width": "宽度",
  "image.height": "高度",
  "image.steps": "步数",
  "image.stepsHint": "推荐 1-80。步数越多可能质量越好，但生成更慢。",
  "image.stepsHintEdit": "编辑模型默认 50。步数越多可能质量越好，但生成更慢。",
  "image.seed": "种子",
  "image.seedHint": "留空表示随机；填写种子可复现结果。",
  "image.randomSeed": "随机种子",
  "image.cfgScale": "CFG scale",
  "image.cfgScaleEdit": "True CFG scale",
  "image.cfgHint": "提示词遵循度。推荐 1-20；数值越高越严格遵循提示词。",
  "image.cfgHintEdit": "编辑模型的 True CFG scale（默认 4.0）。数值越高越严格遵循提示词。",
  "image.advancedSettings": "高级设置",
  "image.presets": "参数预设",
  "image.presetsHint": "场景预设会填入正向提示词模板，并搭配对应参数。",
  "image.presetDefault": "默认",
  "image.presetPortrait": "人像",
  "image.presetLandscape": "风景",
  "image.presetDraft": "快速草稿",
  "image.presetPortraitPrompt": "电影感人像，自然皮肤质感，柔和棚拍光线，浅景深，高细节，真实摄影风格",
  "image.presetLandscapePrompt": "壮丽风景，黄金时刻光线，丰富氛围，细致前景，戏剧化天空，超广角，高质量摄影风格",
  "image.presetDraftPrompt": "主体的简洁概念草图，构图清晰，形状明确，光线均衡",
  "image.presetFillsPrompt": "填入提示词",
  "image.presetKeepsPrompt": "保留提示词",
  "image.reset": "重置",
  "image.generate": "生成",
  "image.edit": "编辑",
  "image.generating": "生成中...",
  "image.editing": "编辑中...",
  "image.jobRunningEdit": "编辑中...",
  "image.jobQueued": "已排队...",
  "image.jobRunning": "生成中...",
  "image.sizeFollowsInput": "跟随输入图",
  "image.cancel": "取消生成",
  "image.cancelled": "图像生成已取消。",
  "image.failed": "图像生成失败。",
  "image.succeeded": "已完成",
  "image.invalidSize": "宽度和高度必须是 {0} 到 {1} 之间的整数。",
  "image.jobs": "图像任务",
  "image.jobsHint": "运行中的任务和历史记录会在切换页面后保留。",
  "image.refreshJobs": "刷新",
  "image.refreshingJobs": "刷新中...",
  "image.runningJobs": "正在运行",
  "image.runningJobsHint": "任务会在后台继续执行。",
  "image.noRunningJobs": "当前没有正在运行的图像任务。",
  "image.latestResult": "最新结果",
  "image.history": "历史记录",
  "image.hideHistory": "收起历史",
  "image.historyHint": "已完成、失败和已取消的任务会保存在这里。",
  "image.backToImages": "返回图像生成",
  "image.emptyHistory": "暂无图像历史记录。",
  "image.openCloudAuth": "登录 / Token",
  "image.cloudAuthRequired": "需要登录云端服务。请登录 {0} 并保存 Access Token。",
  "image.cloudBuiltinAPIKeyFailed": "无法加载 {0} built-in API Key。请重新登录并保存 Access Token。",
  "image.results": "生成结果",
  "image.resultsHint": "最近生成会保留在这里，方便回看和对比。",
  "image.clearHistory": "清空历史",
  "image.elapsed": "已用时 {0}",
  "image.progressHint": "进度基于当前状态和参数估算。",
  "image.inputImage": "输入图片",
  "image.inputImageHint": "图生图/编辑模型需要上传输入图，输出尺寸会跟随输入图。",
  "image.inputImagePlaceholder": "上传 PNG 或 JPEG 进行编辑",
  "image.inputImageRequired": "请为此模型上传输入图片。",
  "image.removeInputImage": "移除",
  "image.modelTypeEdit": "编辑",
  "image.modelTypeGenerate": "生成",
  "image.negativeLabel": "反向词",
  "image.random": "随机",
  "image.download": "下载 PNG",
  "image.closePreview": "关闭",
  "image.empty": "生成结果会显示在这里。",

  "chat.cloudLoginTitle": "使用 {0} 模型需要登录",
  "chat.cloudLoginDesc": "{0} 模型通过当前配置的 AI Gateway 调用。请用 Access Token 登录，csghub-lite 会在调用模型时获取你的 built-in API Key。",
  "chat.cloudOpenLogin": "打开登录",
  "chat.cloudOpenTokenPage": "打开 Access Token 页面",
  "chat.cloudTokenLabel": "Access Token",
  "chat.cloudTokenPlaceholder": "请粘贴你的 OpenCSG Access Token",
  "chat.cloudTokenHint": "可在 OpenCSG 账号设置中创建或复制 Access Token，然后粘贴到这里。",
  "chat.cloudSaveToken": "保存 Token",
  "chat.cloudSavingToken": "保存中...",
  "chat.cloudCancel": "稍后再说",
  "chat.cloudApiKeyTitle": "OpenCSG AI Gateway API Key",
  "chat.cloudApiKeyDesc": "OpenCSG 模型通过 OpenCSG AI Gateway 调用。请在这里填写 API Key，csghub-lite 会用它发起云端模型请求。",
  "chat.cloudGatewayLabel": "AI Gateway URL",
  "chat.cloudGatewayValue": "https://ai.space.opencsg.com",
  "chat.cloudApiKeyLabel": "API Key",
  "chat.cloudApiKeyPlaceholder": "请粘贴你的 OpenCSG API Key",
  "chat.cloudApiKeyHint": "可在 OpenCSG 账号设置中创建或复制 API Key，然后粘贴到这里。",
  "chat.cloudApiKeyHelp": "获取 API Key",
  "chat.cloudApiKeyRequired": "使用 OpenCSG 云端模型需要先填写 AI Gateway API Key。",
  "chat.cloudApiKeyInvalid": "API Key 无效或已过期，请重新创建 API Key 后保存。",
  "chat.cloudApiKeyEmpty": "请先粘贴 API Key。",
  "chat.cloudApiKeySave": "保存 API Key",
  "chat.cloudApiKeySaving": "保存中...",
  "chat.cloudLoginRequired": "使用 {0} 模型需要先登录云端服务。",
  "chat.cloudAuthRequired": "需要登录云端服务。请登录 {0} 或保存 API Key。",
  "chat.cloudBuiltinAPIKeyFailed": "无法加载 {0} built-in API Key。请重新登录或保存 API Key。",
  "chat.cloudLoginExpired": "{0} 登录已过期或 Token 无效，请重新登录并更新 Access Token。",
  "chat.cloudTokenEmpty": "请先粘贴 Access Token。",
  "chat.conversations": "对话记录",
  "chat.conversationHistory": "对话记录",
  "chat.noConversations": "暂无对话记录",
  "chat.searchConversations": "搜索对话",
  "chat.clearConversationSearch": "清除搜索",
  "chat.noConversationSearchResults": "没有匹配的对话",
  "chat.deleteChat": "删除",
  "chat.deleteChatConfirm": "确定删除这个对话吗？",
  "chat.renameChat": "重命名",
  "chat.renameChatPrompt": "重命名对话",
  "chat.renameChatFailed": "重命名对话失败。",
  "chat.moreActions": "更多操作",
  "chat.searching": "搜索中...",
  "chat.imageQueued": "图像生成已排队...",
  "chat.imageGenerating": "正在生成图像...",
  "chat.imageGenerated": "已生成图像",
  "chat.searchingFor": "正在搜索：{0}",
  "chat.progressPreparing": "准备中",
  "chat.progressDecidingSearch": "思考中",
  "chat.progressSkippedSearch": "已跳过网页搜索",
  "chat.progressSkippedReason": "原因：{0}",
  "chat.progressSearching": "正在搜索：{0}",
  "chat.progressSearched": "搜索完成",
  "chat.progressFindingSources": "查找来源",
  "chat.progressFoundSources": "找到 {0} 个来源",
  "chat.progressThinking": "正在思考",
  "chat.progressThought": "已完成思考",
  "chat.progressWaitingAnswer": "准备回答",
  "chat.progressAnswering": "正在回答",
  "chat.webSearch": "Web",
  "chat.webSearchToggle": "回答前启用快速网页搜索",
  "chat.webSearchUnavailableForASR": "ASR 转写不支持网页搜索",
  "chat.webSearchNotConfigured": "请先在设置中配置 Web Search",
  "chat.webSearchFailed": "网页搜索失败：{0}",
  "chat.sources": "来源",
  "chat.moreSources": "还有 {0} 个来源",
  "chat.showSidebar": "显示侧栏",
  "chat.hideSidebar": "隐藏侧栏",
  "chat.messages": "{0} 条消息",
  "chat.selectModel": "选择模型",
  "chat.copyResponse": "复制回复",
  "chat.likeResponse": "赞同回复",
  "chat.dislikeResponse": "反对回复",
  "chat.embeddingData": "Embedding 数据",
  "chat.embeddingUsage": "输入 tokens {0} · 总 tokens {1}",
  "chat.embeddingIndex": "序号",
  "chat.embeddingObject": "对象",
  "chat.embeddingDimensions": "维度",
  "chat.embeddingDimension": "维度",
  "chat.embeddingVector": "向量",
  "chat.embeddingFormat": "格式",
  "chat.embeddingValue": "值",
  "chat.embeddingEncoded": "已编码",
  "chat.responseMeta": "Tokens {0} · Speed {1}/s · Time {2}",
  "chat.responseMetaPending": "Tokens -- · Speed -- · Time --",
  "chat.justNow": "刚刚",
  "chat.minutesAgo": "{0}分钟前",
  "chat.hoursAgo": "{0}小时前",
  "chat.daysAgo": "{0}天前",

  // Pricing
  "nav.pricing": "价格",
  "pricing.title": "价格",
  "pricing.subtitle": "集中查看本地、OpenCSG AI Gateway 和第三方模型的费用信息。",
  "pricing.loadFailed": "加载价格信息失败。",
  "pricing.loading": "加载价格信息中...",
  "pricing.refresh": "刷新",
  "pricing.refreshing": "刷新中...",
  "pricing.gateway": "AI Gateway",
  "pricing.gatewayHint": "个云端模型有价格",
  "pricing.gatewaySubtitle": "价格来自 OpenCSG AI Gateway 的模型元数据。",
  "pricing.localHint": "在本机运行",
  "pricing.thirdPartyHint": "由 Provider 计费",
  "pricing.local": "本地模型",
  "pricing.noLocal": "暂无本地模型。",
  "pricing.localDescription": "本地推理使用你自己的硬件，csghub-lite 不按 token 收费。",
  "pricing.free": "免费",
  "pricing.cloud": "云端模型",
  "pricing.noCloud": "暂无云端模型。",
  "pricing.cloudPricing": "查看 OpenCSG 价格",
  "pricing.thirdParty": "第三方 Provider",
  "pricing.noThirdParty": "暂无配置第三方 Provider。",
  "pricing.thirdPartyDescription": "第三方 Provider 的价格由对应服务商单独计费。",
  "pricing.thirdPartyNote": "请联系 Provider 了解价格",
  "pricing.perMillion": "每 100 万 tokens 价格",
  "pricing.perMillionShort": "/ 100 万 tokens",
  "pricing.model": "模型",
  "pricing.type": "类型",
  "pricing.input": "输入",
  "pricing.output": "输出",
  "pricing.context": "上下文",
  "pricing.unknownOwner": "未知归属",
  "pricing.notAvailable": "暂无",
  "pricing.moreModels": "还有 {0} 个模型",
  "pricing.typeServerless": "Serverless",
  "pricing.typeExternal": "外部模型",
  "pricing.typeInference": "专属推理",
  "pricing.typeCloud": "云端",
};

const translations: Record<Locale, Record<string, string>> = { en, zh };

export function t(key: string, ...args: (string | number)[]): string {
  const str = translations[locale.value]?.[key] || en[key] || key;
  if (args.length === 0) return str;
  return str.replace(/\{(\d+)\}/g, (_, i) => String(args[Number(i)]));
}
