Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

feat(i18n): add EN/ZH language switcher across all studio components

Anil Matcha32fa23a03b58
diff --git a/src/components/AgentStudio.js b/src/components/AgentStudio.js
index a359e9c5..182a7202 100644
--- a/src/components/AgentStudio.js
+++ b/src/components/AgentStudio.js
@@ -1,3 +1,5 @@
+import { t } from '../lib/i18n.js';
+
export function AgentStudio() {
const container = document.createElement('div');
container.className = 'w-full h-full flex flex-col items-center justify-center bg-app-bg text-white gap-4';
@@ -10,11 +12,11 @@ export function AgentStudio() {
</svg>`;
const title = document.createElement('p');
- title.textContent = 'Agent Studio';
+ title.textContent = t('agents.title');
title.className = 'text-lg font-bold opacity-60';
const sub = document.createElement('p');
- sub.textContent = 'Available in the web app at open-generative-ai.com';
+ sub.textContent = t('agents.webOnly');
sub.className = 'text-sm opacity-40';
container.appendChild(icon);
diff --git a/src/components/AuthModal.js b/src/components/AuthModal.js
index c96786b3..f8fe8e86 100644
--- a/src/components/AuthModal.js
+++ b/src/components/AuthModal.js
@@ -1,3 +1,5 @@
+import { t } from '../lib/i18n.js';
+
export function AuthModal(onSuccess) {
const overlay = document.createElement('div');
overlay.className = 'fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm px-6';
@@ -12,28 +14,28 @@ export function AuthModal(onSuccess) {
<path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3m-3-3l-2.25-2.25"/>
</svg>
</div>
- <h2 class="text-2xl font-black text-white uppercase tracking-wider mb-2">Muapi API Key Required</h2>
- <p class="text-secondary text-sm">Create a Muapi access key, then paste the key value here to start creating high-aesthetic images.</p>
+ <h2 class="text-2xl font-black text-white uppercase tracking-wider mb-2">${t('auth.title')}</h2>
+ <p class="text-secondary text-sm">${t('auth.subtitle')}</p>
</div>
<div class="space-y-6">
<div class="space-y-2">
- <label class="text-[10px] font-bold text-muted uppercase tracking-widest ml-1">Muapi Access Key</label>
- <input
- type="password"
+ <label class="text-[10px] font-bold text-muted uppercase tracking-widest ml-1">${t('auth.keyLabel')}</label>
+ <input
+ type="password"
id="muapi-key-input"
- placeholder="Paste your access key value..."
+ placeholder="${t('auth.keyPlaceholder')}"
class="w-full bg-black/40 border border-white/5 rounded-2xl px-5 py-4 text-white placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors shadow-inner"
>
- <p class="text-[11px] text-muted ml-1">Do not enter the key name or label; paste the generated key value from Muapi.</p>
+ <p class="text-[11px] text-muted ml-1">${t('auth.keyNote')}</p>
</div>
<div class="flex flex-col gap-3">
<button id="save-key-btn" class="w-full bg-primary text-black font-black py-4 rounded-2xl hover:shadow-glow hover:scale-[1.02] active:scale-[0.98] transition-all">
- Initialize Studio
+ ${t('auth.initBtn')}
</button>
<a href="https://muapi.ai/access-keys" target="_blank" rel="noreferrer" class="text-center text-[11px] font-bold text-muted hover:text-white transition-colors py-2 uppercase tracking-tighter">
- Create or copy a Muapi access key →
+ ${t('auth.createKey')}
</a>
</div>
</div>
diff --git a/src/components/CinemaStudio.js b/src/components/CinemaStudio.js
index 116a6fa3..84c37cfe 100644
--- a/src/components/CinemaStudio.js
+++ b/src/components/CinemaStudio.js
@@ -3,6 +3,7 @@ import { muapi } from '../lib/muapi.js';
import { CameraControls } from './CameraControls.js';
import { buildNanoBananaPrompt, CAMERA_MAP, LENS_MAP, FOCAL_PERSPECTIVE, APERTURE_EFFECT } from '../lib/promptUtils.js';
import { AuthModal } from './AuthModal.js';
+import { t } from '../lib/i18n.js';
export function CinemaStudio() {
const container = document.createElement('div');
@@ -27,9 +28,9 @@ export function CinemaStudio() {
const heroSection = document.createElement('div');
heroSection.className = 'flex flex-col items-center justify-center text-center px-4 animate-fade-in-up';
heroSection.innerHTML = `
- <div class="mb-4 text-xs font-bold text-white/40 tracking-[0.2em] uppercase">Cinema Studio 2.0</div>
+ <div class="mb-4 text-xs font-bold text-white/40 tracking-[0.2em] uppercase">${t('cinema.tagline')}</div>
<h1 class="text-4xl md:text-6xl font-black text-transparent bg-clip-text bg-gradient-to-b from-white to-white/50 tracking-tight leading-tight mb-2">
- What would you shoot<br>with infinite budget?
+ ${t('cinema.headline')}
</h1>
`;
container.appendChild(heroSection);
@@ -106,7 +107,7 @@ export function CinemaStudio() {
// Textarea
const textarea = document.createElement('textarea');
- textarea.placeholder = 'Describe your scene - use @ to add characters & props';
+ textarea.placeholder = t('cinema.placeholder');
textarea.className = 'flex-1 bg-transparent border-none text-white text-lg font-medium placeholder:text-white/20 focus:outline-none resize-none h-[28px] leading-relaxed overflow-hidden';
textarea.style.height = 'auto'; // Auto-grow check
textarea.rows = 1;
@@ -187,7 +188,7 @@ export function CinemaStudio() {
// Camera Builder Toggle Button
const cameraBuilderBtn = document.createElement('button');
cameraBuilderBtn.className = 'flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-bold text-white/50 hover:text-white transition-colors bg-white/5 hover:bg-white/10 rounded-lg border border-white/5';
- cameraBuilderBtn.setAttribute('data-tooltip', 'Quick camera builder');
+ cameraBuilderBtn.setAttribute('data-tooltip', t('cinema.builderTooltip'));
cameraBuilderBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="3"/></svg> Builder`;
settingsToolbar.appendChild(cameraBuilderBtn);
@@ -203,7 +204,7 @@ export function CinemaStudio() {
const summaryCard = document.createElement('button');
// Removed 'hidden' class, added 'flex' and refined width constraints for mobile
summaryCard.className = 'flex flex-col items-start justify-center px-4 py-2 bg-[#2a2a2a] rounded-xl border border-white/5 hover:border-white/20 transition-colors text-left flex-1 min-w-[100px] md:min-w-[140px] max-w-[240px] h-[56px] relative group overflow-hidden';
- summaryCard.setAttribute('data-tooltip', 'Open camera settings');
+ summaryCard.setAttribute('data-tooltip', t('cinema.cameraSettings'));
// Dot indicator
const dot = document.createElement('div');
@@ -236,7 +237,7 @@ export function CinemaStudio() {
const generateBtn = document.createElement('button');
generateBtn.className = 'h-[56px] px-8 bg-[#22d3ee] text-black rounded-xl font-black text-xs uppercase hover:bg-white transition-colors shadow-lg disabled:opacity-50 disabled:cursor-not-allowed';
generateBtn.setAttribute('data-tooltip', 'Generate cinema shot');
- generateBtn.innerHTML = `GENERATE ✨`;
+ generateBtn.innerHTML = t('cinema.generateBtn');
rightGroup.appendChild(summaryCard);
rightGroup.appendChild(generateBtn);
@@ -257,44 +258,44 @@ export function CinemaStudio() {
builderCard.innerHTML = `
<div class="flex items-center justify-between mb-4">
- <h4 class="text-xs font-bold text-white">Camera Builder</h4>
+ <h4 class="text-xs font-bold text-white">${t('cinema.cameraBuilder')}</h4>
<button id="close-builder-btn" class="text-white/40 hover:text-white transition-colors">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
-
+
<div class="grid grid-cols-2 md:grid-cols-4 gap-3 mb-4">
<div class="flex flex-col gap-1.5">
- <label class="text-[10px] font-bold text-muted uppercase">Camera</label>
+ <label class="text-[10px] font-bold text-muted uppercase">${t('cinema.camera')}</label>
<select id="builder-camera" class="w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-primary/50">
${Object.keys(CAMERA_MAP).map(c => `<option value="${c}" ${c === currentSettings.camera ? 'selected' : ''}>${c}</option>`).join('')}
</select>
</div>
<div class="flex flex-col gap-1.5">
- <label class="text-[10px] font-bold text-muted uppercase">Lens</label>
+ <label class="text-[10px] font-bold text-muted uppercase">${t('cinema.lens')}</label>
<select id="builder-lens" class="w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-primary/50">
${Object.keys(LENS_MAP).map(l => `<option value="${l}" ${l === currentSettings.lens ? 'selected' : ''}>${l}</option>`).join('')}
</select>
</div>
<div class="flex flex-col gap-1.5">
- <label class="text-[10px] font-bold text-muted uppercase">Focal</label>
+ <label class="text-[10px] font-bold text-muted uppercase">${t('cinema.focal')}</label>
<select id="builder-focal" class="w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-primary/50">
${Object.keys(FOCAL_PERSPECTIVE).map(f => `<option value="${f}" ${f === currentSettings.focal ? 'selected' : ''}>${f}mm</option>`).join('')}
</select>
</div>
<div class="flex flex-col gap-1.5">
- <label class="text-[10px] font-bold text-muted uppercase">Aperture</label>
+ <label class="text-[10px] font-bold text-muted uppercase">${t('cinema.aperture')}</label>
<select id="builder-aperture" class="w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-primary/50">
${Object.keys(APERTURE_EFFECT).map(a => `<option value="${a}" ${a === currentSettings.aperture ? 'selected' : ''}>${a}</option>`).join('')}
</select>
</div>
</div>
-
+
<div class="flex flex-col gap-2">
- <label class="text-[10px] font-bold text-muted uppercase">Preview</label>
+ <label class="text-[10px] font-bold text-muted uppercase">${t('cinema.preview')}</label>
<div id="builder-preview" class="w-full bg-white/5 border border-white/10 rounded-lg px-4 py-2.5 text-white text-xs min-h-[40px]"></div>
<button id="apply-builder-btn" class="px-4 py-2 bg-primary text-black rounded-lg text-xs font-bold hover:shadow-glow transition-all">
- Use This Setup
+ ${t('cinema.useSetup')}
</button>
</div>
`;
@@ -325,7 +326,7 @@ export function CinemaStudio() {
const preview = buildNanoBananaPrompt('', camera, lens, focal, aperture);
const previewEl = builderCard.querySelector('#builder-preview');
if (previewEl) {
- previewEl.textContent = preview || 'Select camera settings to see preview...';
+ previewEl.textContent = preview || t('cinema.selectSettings');
}
};
@@ -365,7 +366,7 @@ export function CinemaStudio() {
const historyLabel = document.createElement('div');
historyLabel.className = 'text-[9px] font-bold text-white/40 uppercase tracking-widest mb-2';
- historyLabel.textContent = 'History';
+ historyLabel.textContent = t('cinema.history');
historySidebar.appendChild(historyLabel);
const historyList = document.createElement('div');
@@ -401,9 +402,9 @@ export function CinemaStudio() {
return btn;
};
- const regenerateBtn = createActionBtn('↻ Regenerate');
- const downloadBtn = createActionBtn('↓ Download', true);
- const newPromptBtn = createActionBtn('+ New Shot');
+ const regenerateBtn = createActionBtn(t('cinema.regenerate'));
+ const downloadBtn = createActionBtn(t('cinema.download'), true);
+ const newPromptBtn = createActionBtn(t('cinema.newShot'));
canvasControls.appendChild(regenerateBtn);
canvasControls.appendChild(downloadBtn);
@@ -422,7 +423,7 @@ export function CinemaStudio() {
thumb.innerHTML = `
<img src="${entry.url}" class="w-full h-full object-cover opacity-80 group-hover/thumb:opacity-100 transition-opacity">
<div class="absolute inset-0 bg-black/50 opacity-0 group-hover/thumb:opacity-100 transition-opacity flex items-center justify-center">
- <span class="text-[8px] font-bold text-white uppercase">Load</span>
+ <span class="text-[8px] font-bold text-white uppercase">${t('cinema.load')}</span>
</div>
`;
@@ -544,7 +545,7 @@ export function CinemaStudio() {
}
generateBtn.disabled = true;
- generateBtn.innerHTML = "SHOOTING...";
+ generateBtn.innerHTML = t('cinema.shooting');
// Compile Prompt
const finalPrompt = buildNanoBananaPrompt(
@@ -583,10 +584,10 @@ export function CinemaStudio() {
} catch (e) {
console.error(e);
- alert('Generation Failed: ' + e.message);
+ alert(t('cinema.generationFailed') + e.message);
} finally {
generateBtn.disabled = false;
- generateBtn.innerHTML = `GENERATE ✨`;
+ generateBtn.innerHTML = t('cinema.generateBtn');
}
};
diff --git a/src/components/Header.js b/src/components/Header.js
index ec295b99..fac8391f 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -1,4 +1,5 @@
import { SettingsModal } from './SettingsModal.js';
+import { t, getLang, setLang } from '../lib/i18n.js';
export function Header(navigate) {
const header = document.createElement('header');
@@ -27,33 +28,31 @@ export function Header(navigate) {
const menu = document.createElement('nav');
menu.className = 'hidden lg:flex items-center gap-6 text-[13px] font-bold text-secondary';
- const items = ['Image', 'Video', 'Lip Sync', 'Cinema Studio', 'Workflows', 'Agents', 'MCP & CLI'];
-
- items.forEach(item => {
+ const items = [
+ { label: t('nav.image'), page: 'image' },
+ { label: t('nav.video'), page: 'video' },
+ { label: t('nav.lipsync'), page: 'lipsync' },
+ { label: t('nav.cinema'), page: 'cinema' },
+ { label: t('nav.workflows'), page: 'workflows' },
+ { label: t('nav.agents'), page: 'agents' },
+ { label: t('nav.mcpcli'), page: 'mcp-cli' },
+ ];
+
+ items.forEach(({ label, page }, idx) => {
const link = document.createElement('a');
- link.textContent = item;
- link.className = `hover:text-white transition-all cursor-pointer relative group ${item === 'Image' ? 'text-white' : ''}`;
+ link.textContent = label;
+ link.className = `hover:text-white transition-all cursor-pointer relative group ${idx === 0 ? 'text-white' : ''}`;
- // Active Indicator or Dot
- if (item === 'Image') {
+ if (idx === 0) {
const dot = document.createElement('div');
dot.className = 'absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 bg-primary rounded-full';
link.appendChild(dot);
}
link.onclick = () => {
- // Remove active state from all
Array.from(menu.children).forEach(child => child.classList.remove('text-white'));
- // Add to current
link.classList.add('text-white');
-
- if (item === 'Image') navigate('image');
- else if (item === 'Video') navigate('video');
- else if (item === 'Lip Sync') navigate('lipsync');
- else if (item === 'Cinema Studio') navigate('cinema');
- else if (item === 'Workflows') navigate('workflows');
- else if (item === 'Agents') navigate('agents');
- else if (item === 'MCP & CLI') navigate('mcp-cli');
+ navigate(page);
};
menu.appendChild(link);
@@ -73,12 +72,21 @@ export function Header(navigate) {
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
- <span>Settings</span>
+ <span>${t('nav.settings')}</span>
`;
settingsBtn.onclick = () => {
document.body.appendChild(SettingsModal());
};
+ // Language toggle button
+ const langBtn = document.createElement('button');
+ const currentLang = getLang();
+ langBtn.className = 'flex items-center px-3 py-1.5 rounded-md border border-white/10 bg-white/5 text-[13px] font-bold text-white/80 hover:text-white hover:bg-white/10 hover:border-white/20 transition-colors';
+ langBtn.title = currentLang === 'zh' ? 'Switch to English' : '切换为中文';
+ langBtn.textContent = currentLang === 'zh' ? 'EN' : '中文';
+ langBtn.onclick = () => setLang(currentLang === 'zh' ? 'en' : 'zh');
+
+ rightPart.appendChild(langBtn);
rightPart.appendChild(settingsBtn);
navBar.appendChild(leftPart);
diff --git a/src/components/ImageStudio.js b/src/components/ImageStudio.js
index 2809f60d..26779ea8 100644
--- a/src/components/ImageStudio.js
+++ b/src/components/ImageStudio.js
@@ -8,6 +8,7 @@ import { localAI, isLocalAIAvailable } from '../lib/localInferenceClient.js';
import { LOCAL_MODEL_CATALOG, getLocalModelById } from '../lib/localModels.js';
import { ENHANCE_TAGS, QUICK_PROMPTS } from '../lib/promptUtils.js';
import { AuthModal } from './AuthModal.js';
+import { t } from '../lib/i18n.js';
import { createUploadPicker } from './UploadPicker.js';
import { savePendingJob, removePendingJob, getPendingJobs } from '../lib/pendingJobs.js';
@@ -90,8 +91,8 @@ export function ImageStudio() {
<div class="absolute top-4 right-4 text-primary animate-pulse">✨</div>
</div>
</div>
- <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">Image Studio</h1>
- <p class="text-secondary text-sm font-medium tracking-wide opacity-60">Transform images with AI — upscale, stylize, animate and more</p>
+ <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">${t('image.title')}</h1>
+ <p class="text-secondary text-sm font-medium tracking-wide opacity-60">${t('image.subtitle')}</p>
`;
container.appendChild(hero);
@@ -129,8 +130,8 @@ export function ImageStudio() {
picker.setMaxImages(getMaxImagesForI2IModel(selectedModel));
}
textarea.placeholder = uploadedImageUrls.length > 1
- ? `${uploadedImageUrls.length} images selected — describe the transformation (optional)`
- : 'Describe how to transform this image (optional)';
+ ? `${uploadedImageUrls.length} ${t('image.multiImageNote') || 'images selected — describe the transformation (optional)'}`
+ : t('image.placeholderTransform');
},
onClear: () => {
uploadedImageUrls = [];
@@ -144,7 +145,7 @@ export function ImageStudio() {
qualityBtn.style.display = t2iResolutions.length > 0 ? 'flex' : 'none';
if (t2iResolutions.length > 0) document.getElementById('quality-btn-label').textContent = t2iResolutions[0];
picker.setMaxImages(1);
- textarea.placeholder = 'Describe the image you want to create';
+ textarea.placeholder = t('image.placeholder');
}
});
topRow.appendChild(picker.trigger);
@@ -187,15 +188,15 @@ export function ImageStudio() {
<div class="w-5 h-5 bg-primary rounded-md flex items-center justify-center shadow-lg shadow-primary/20">
<span class="text-[10px] font-black text-black">G</span>
</div>
- `, selectedModelName, 'model-btn', 'Select AI generation model');
+ `, selectedModelName, 'model-btn', t('image.modelTooltip'));
const arBtn = createControlBtn(`
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="opacity-60 text-secondary"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>
- `, selectedAr, 'ar-btn', 'Change aspect ratio');
+ `, selectedAr, 'ar-btn', t('image.arTooltip'));
const qualityBtn = createControlBtn(`
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="opacity-60 text-secondary"><path d="M6 2L3 6v15a2 2 0 002 2h14a2 2 0 002-2V6l-3-4H6z"/></svg>
- `, '720p', 'quality-btn', 'Set output quality');
+ `, '720p', 'quality-btn', t('image.qualityTooltip'));
// Local / API source toggle (only shown in Electron)
let localToggleBtn = null;
@@ -206,10 +207,10 @@ export function ImageStudio() {
const updateLocalToggleStyle = () => {
if (useLocalModel) {
localToggleBtn.className = 'flex items-center gap-1.5 px-3 py-2 rounded-xl transition-all border text-xs font-bold whitespace-nowrap bg-primary/20 border-primary/40 text-primary';
- localToggleBtn.textContent = '⚡ Local';
+ localToggleBtn.textContent = t('image.local');
} else {
localToggleBtn.className = 'flex items-center gap-1.5 px-3 py-2 rounded-xl transition-all border text-xs font-bold whitespace-nowrap bg-white/5 border-white/5 text-white/60 hover:bg-white/10';
- localToggleBtn.textContent = '☁ API';
+ localToggleBtn.textContent = t('image.api');
}
};
updateLocalToggleStyle();
@@ -235,13 +236,13 @@ export function ImageStudio() {
// Advanced options toggle button
const advancedBtn = createControlBtn(`
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="opacity-60 text-secondary"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 001.82-.33 1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-1.82.33A1.65 1.65 0 0019.4 9a1.65 1.65 0 00-1.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/></svg>
- `, 'Advanced', 'advanced-btn', 'Show advanced options');
+ `, t('common.advanced'), 'advanced-btn', t('image.advancedTooltip'));
controlsLeft.appendChild(advancedBtn);
-
+
// Quick Tools toggle button
const toolsBtn = createControlBtn(`
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="opacity-60 text-secondary"><path d="M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"/></svg>
- `, 'Tools', 'tools-btn', 'Quick starters & prompt enhancer');
+ `, t('common.tools'), 'tools-btn', t('image.toolsTooltip'));
controlsLeft.appendChild(toolsBtn);
// Show quality button if the default model has quality/resolution options
const _initResolutions = getResolutionsForModel(defaultModel.id);
@@ -253,8 +254,8 @@ export function ImageStudio() {
const generateBtn = document.createElement('button');
generateBtn.className = 'bg-primary text-black px-6 md:px-8 py-3 md:py-3.5 rounded-xl md:rounded-[1.5rem] font-black text-sm md:text-base hover:shadow-glow hover:scale-105 active:scale-95 transition-all flex items-center justify-center gap-2.5 w-full sm:w-auto shadow-lg';
- generateBtn.setAttribute('data-tooltip', 'Generate AI image from prompt');
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.setAttribute('data-tooltip', t('image.generateTooltip'));
+ generateBtn.innerHTML = t('common.generate');
bottomRow.appendChild(controlsLeft);
bottomRow.appendChild(generateBtn);
@@ -272,14 +273,14 @@ export function ImageStudio() {
localProgressWrap.id = 'local-progress-wrap';
localProgressWrap.innerHTML = `
<div class="flex items-center justify-between">
- <span class="text-xs font-bold text-white/60">Generating locally...</span>
+ <span class="text-xs font-bold text-white/60">${t('image.generatingLocally')}</span>
<span id="local-progress-pct" class="text-xs font-bold text-primary">0%</span>
</div>
<div class="h-1.5 rounded-full bg-white/10 overflow-hidden">
<div id="local-progress-fill" class="h-full bg-primary transition-all duration-200" style="width:0%"></div>
</div>
<div class="flex justify-end">
- <button id="local-cancel-btn" class="text-xs text-red-400 hover:text-red-300 transition-colors">Cancel</button>
+ <button id="local-cancel-btn" class="text-xs text-red-400 hover:text-red-300 transition-colors">${t('common.cancel')}</button>
</div>
`;
container.appendChild(localProgressWrap);
@@ -289,7 +290,7 @@ export function ImageStudio() {
localProgressWrap.classList.remove('flex');
localProgressWrap.classList.add('hidden');
generateBtn.disabled = false;
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
});
// ==========================================
@@ -303,16 +304,16 @@ export function ImageStudio() {
toolsPanel.innerHTML = `
<div class="bg-[#111]/90 backdrop-blur-xl border border-white/10 rounded-2xl p-5 flex flex-col gap-4">
<div class="flex items-center justify-between pb-3 border-b border-white/5">
- <h3 class="text-sm font-bold text-white">Quick Tools</h3>
+ <h3 class="text-sm font-bold text-white">${t('image.quickTools')}</h3>
<button id="close-tools-btn" class="text-white/40 hover:text-white transition-colors">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
-
+
<div class="flex flex-col lg:flex-row gap-6">
<!-- Quick Starters Section -->
<div class="flex-1">
- <h4 class="text-xs font-bold text-secondary uppercase tracking-wider mb-3">Quick Starters</h4>
+ <h4 class="text-xs font-bold text-secondary uppercase tracking-wider mb-3">${t('image.quickStarters')}</h4>
<div class="grid grid-cols-2 sm:grid-cols-4 gap-2">
${QUICK_PROMPTS.map(q => `
<button class="quick-starter-btn px-3 py-2 rounded-lg text-xs font-bold bg-white/5 text-secondary hover:bg-white/10 hover:text-primary transition-all text-left border border-white/5 hover:border-primary/30" data-prompt="${q.prompt}">
@@ -324,14 +325,14 @@ export function ImageStudio() {
<!-- Prompt Enhancer Section -->
<div class="flex-1">
- <h4 class="text-xs font-bold text-secondary uppercase tracking-wider mb-3">Prompt Enhancer</h4>
+ <h4 class="text-xs font-bold text-secondary uppercase tracking-wider mb-3">${t('image.promptEnhancer')}</h4>
<div class="flex flex-col gap-3">
- <input type="text" id="base-prompt-input"
- placeholder="Enter base prompt..."
+ <input type="text" id="base-prompt-input"
+ placeholder="${t('image.basePromptPlaceholder')}"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
-
+
<div>
- <label class="text-[10px] font-bold text-muted uppercase tracking-wider mb-2 block">Enhancement Tags</label>
+ <label class="text-[10px] font-bold text-muted uppercase tracking-wider mb-2 block">${t('image.enhancementTags')}</label>
<div id="enhance-tags-area" class="flex flex-wrap gap-1.5">
${Object.entries(ENHANCE_TAGS).map(([category, tags]) =>
tags.map(tag => `<button class="enhance-tag-btn px-2 py-1 rounded-full text-[10px] font-bold bg-white/5 text-secondary hover:bg-white/10 transition-all" data-tag="${tag}">${tag}</button>`).join('')
@@ -340,14 +341,14 @@ export function ImageStudio() {
</div>
<div class="flex flex-col gap-2">
- <label class="text-[10px] font-bold text-muted uppercase tracking-wider">Enhanced Prompt</label>
+ <label class="text-[10px] font-bold text-muted uppercase tracking-wider">${t('image.enhancedPrompt')}</label>
<div id="enhanced-prompt-display" class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-xs min-h-[40px]"></div>
<div class="flex gap-2">
<button id="copy-enhanced-btn" class="px-3 py-1.5 rounded-lg text-xs font-bold bg-white/5 text-secondary hover:bg-white/10 transition-all">
- Copy
+ ${t('common.copy')}
</button>
<button id="use-enhanced-btn" class="px-3 py-1.5 rounded-lg text-xs font-bold bg-primary text-black hover:shadow-glow transition-all">
- Use in Generator
+ ${t('common.useInGenerator')}
</button>
</div>
</div>
@@ -370,15 +371,15 @@ export function ImageStudio() {
advancedPanel.innerHTML = `
<div class="bg-[#111]/90 backdrop-blur-xl border border-white/10 rounded-2xl p-5 flex flex-col gap-4">
<div class="flex items-center justify-between pb-3 border-b border-white/5">
- <h3 class="text-sm font-bold text-white">Advanced Options</h3>
+ <h3 class="text-sm font-bold text-white">${t('image.advancedOptions')}</h3>
<button id="close-adv-btn" class="text-white/40 hover:text-white transition-colors">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
</div>
-
+
<!-- Style Presets -->
<div class="flex flex-col gap-2">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Style Preset</label>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.stylePreset')}</label>
<div class="flex gap-2 flex-wrap">
${STYLE_PRESETS.map(s => `<button class="style-preset-btn px-3 py-1.5 rounded-lg text-xs font-bold bg-white/5 text-secondary hover:bg-white/10 transition-all" data-style="${s}">${s}</button>`).join('')}
</div>
@@ -386,9 +387,9 @@ export function ImageStudio() {
<!-- Negative Prompt -->
<div class="flex flex-col gap-2">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Negative Prompt</label>
- <input type="text" id="negative-prompt-input"
- placeholder="What to exclude from the image (e.g., blurry, distorted, watermark)"
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.negPromptLabel')}</label>
+ <input type="text" id="negative-prompt-input"
+ placeholder="${t('image.negPromptPlaceholder')}"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
</div>
@@ -396,7 +397,7 @@ export function ImageStudio() {
<div class="flex gap-4 flex-wrap">
<div class="flex-1 min-w-[200px] flex flex-col gap-2">
<div class="flex items-center justify-between">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Guidance Scale</label>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.guidanceScale')}</label>
<span id="guidance-value" class="text-xs font-bold text-primary">7.5</span>
</div>
<input type="range" id="guidance-slider" min="1" max="20" step="0.5" value="7.5"
@@ -405,7 +406,7 @@ export function ImageStudio() {
<div class="flex-1 min-w-[200px] flex flex-col gap-2">
<div class="flex items-center justify-between">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Steps</label>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.steps')}</label>
<span id="steps-value" class="text-xs font-bold text-primary">25</span>
</div>
<input type="range" id="steps-slider" min="1" max="50" step="1" value="25"
@@ -416,11 +417,11 @@ export function ImageStudio() {
<!-- Seed -->
<div class="flex flex-col gap-2">
<div class="flex items-center justify-between">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Seed</label>
- <button id="randomize-seed-btn" class="text-xs font-bold text-primary hover:text-primary/80 transition-colors">Randomize</button>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.seed')}</label>
+ <button id="randomize-seed-btn" class="text-xs font-bold text-primary hover:text-primary/80 transition-colors">${t('common.randomize')}</button>
</div>
- <input type="number" id="seed-input"
- placeholder="-1 for random"
+ <input type="number" id="seed-input"
+ placeholder="${t('image.seedPlaceholder')}"
value="-1"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
</div>
@@ -428,7 +429,7 @@ export function ImageStudio() {
<!-- Batch Count -->
<div class="flex flex-col gap-2">
<div class="flex items-center justify-between">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Batch Count</label>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.batchCount')}</label>
<span id="batch-value" class="text-xs font-bold text-primary">1</span>
</div>
<input type="range" id="batch-slider" min="1" max="4" step="1" value="1"
@@ -438,16 +439,16 @@ export function ImageStudio() {
<!-- Width & Height -->
<div class="flex gap-4 flex-wrap">
<div class="flex-1 min-w-[120px] flex flex-col gap-2">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Width</label>
- <input type="number" id="width-input"
- placeholder="Auto"
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.width')}</label>
+ <input type="number" id="width-input"
+ placeholder="${t('image.widthPlaceholder')}"
value=""
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
</div>
<div class="flex-1 min-w-[120px] flex flex-col gap-2">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Height</label>
- <input type="number" id="height-input"
- placeholder="Auto"
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.height')}</label>
+ <input type="number" id="height-input"
+ placeholder="${t('image.heightPlaceholder')}"
value=""
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
</div>
@@ -456,27 +457,27 @@ export function ImageStudio() {
<!-- Reference Strength (for I2I models) -->
<div class="flex flex-col gap-2">
<div class="flex items-center justify-between">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">Reference Strength</label>
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.refStrength')}</label>
<span id="reference-strength-value" class="text-xs font-bold text-primary">50%</span>
</div>
<input type="range" id="reference-strength-slider" min="0" max="100" step="5" value="50"
class="w-full h-2 bg-white/10 rounded-lg appearance-none cursor-pointer accent-primary">
- <p class="text-xs text-muted">How much to preserve the reference image characteristics</p>
+ <p class="text-xs text-muted">${t('image.refStrengthNote')}</p>
</div>
<!-- LoRA Model Selection -->
<div class="flex flex-col gap-2">
- <label class="text-xs font-bold text-secondary uppercase tracking-wider">LoRA Model (Optional)</label>
- <input type="text" id="lora-input"
- placeholder="e.g., civitai:1642876@1864626"
+ <label class="text-xs font-bold text-secondary uppercase tracking-wider">${t('image.lora')}</label>
+ <input type="text" id="lora-input"
+ placeholder="${t('image.loraPlaceholder')}"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm placeholder:text-muted focus:outline-none focus:border-primary/50 transition-colors">
<div class="flex items-center gap-2 mt-1">
- <label class="text-xs font-bold text-secondary">LoRA Weight:</label>
+ <label class="text-xs font-bold text-secondary">${t('image.loraWeight')}</label>
<input type="number" id="lora-weight-input"
value="1.0" min="0" max="4" step="0.1"
class="w-20 bg-white/5 border border-white/10 rounded-xl px-3 py-1.5 text-white text-sm focus:outline-none focus:border-primary/50 transition-colors">
</div>
- <p class="text-xs text-muted">Enter a LoRA model ID from Civitai (format: civitai:id@version)</p>
+ <p class="text-xs text-muted">${t('image.loraNote')}</p>
</div>
</div>
`;
@@ -486,7 +487,7 @@ export function ImageStudio() {
const toggleAdvanced = () => {
showAdvanced = !showAdvanced;
advancedPanel.classList.toggle('hidden', !showAdvanced);
- document.getElementById('advanced-btn-label').textContent = showAdvanced ? 'Less' : 'Advanced';
+ document.getElementById('advanced-btn-label').textContent = showAdvanced ? t('common.less') : t('common.advanced');
};
// Add tools panel and advanced panel to container first before accessing their elements
@@ -542,7 +543,7 @@ export function ImageStudio() {
const tags = Array.from(enhanceSelectedTags).join(', ');
const enhanced = [base, tags].filter(p => p).join(', ');
if (enhancedPromptDisplay) {
- enhancedPromptDisplay.textContent = enhanced || 'Your enhanced prompt will appear here...';
+ enhancedPromptDisplay.textContent = enhanced || t('image.enhancedPlaceholder');
enhancedPromptDisplay.classList.toggle('text-muted', !enhanced);
}
};
@@ -575,10 +576,10 @@ export function ImageStudio() {
if (copyEnhancedBtn) {
copyEnhancedBtn.onclick = () => {
const text = enhancedPromptDisplay?.textContent || '';
- if (text && text !== 'Your enhanced prompt will appear here...') {
+ if (text && text !== t('image.enhancedPlaceholder')) {
navigator.clipboard.writeText(text);
- copyEnhancedBtn.textContent = 'Copied!';
- setTimeout(() => { copyEnhancedBtn.textContent = 'Copy'; }, 1500);
+ copyEnhancedBtn.textContent = t('common.copied');
+ setTimeout(() => { copyEnhancedBtn.textContent = t('common.copy'); }, 1500);
}
};
}
@@ -588,7 +589,7 @@ export function ImageStudio() {
if (useEnhancedBtn) {
useEnhancedBtn.onclick = () => {
const text = enhancedPromptDisplay?.textContent || '';
- if (text && text !== 'Your enhanced prompt will appear here...') {
+ if (text && text !== t('image.enhancedPlaceholder')) {
textarea.value = text;
textarea.style.height = 'auto';
const maxHeight = window.innerWidth < 768 ? 150 : 250;
@@ -720,7 +721,7 @@ export function ImageStudio() {
<div class="px-2 pb-3 mb-2 border-b border-white/5 shrink-0">
<div class="flex items-center gap-3 bg-white/5 rounded-xl px-4 py-2.5 border border-white/5 focus-within:border-primary/50 transition-colors">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="text-muted"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>
- <input type="text" id="model-search" placeholder="Search models..." class="bg-transparent border-none text-xs text-white focus:ring-0 w-full p-0">
+ <input type="text" id="model-search" placeholder="${t('common.searchModels')}" class="bg-transparent border-none text-xs text-white focus:ring-0 w-full p-0">
</div>
</div>
<div class="text-[10px] font-bold text-secondary uppercase tracking-widest px-3 py-2 shrink-0">Available models</div>
@@ -739,7 +740,7 @@ export function ImageStudio() {
m.id.toLowerCase().includes(filter.toLowerCase())
);
if (filtered.length === 0) {
- list.innerHTML = `<div class="text-xs text-muted text-center py-4">No local models match</div>`;
+ list.innerHTML = `<div class="text-xs text-muted text-center py-4">${t('common.noResults')}</div>`;
return;
}
filtered.forEach(m => {
@@ -939,7 +940,7 @@ export function ImageStudio() {
const historyLabel = document.createElement('div');
historyLabel.className = 'text-[9px] font-bold text-muted uppercase tracking-widest mb-2 rotate-0';
- historyLabel.textContent = 'History';
+ historyLabel.textContent = t('common.history');
historySidebar.appendChild(historyLabel);
const historyList = document.createElement('div');
@@ -965,15 +966,15 @@ export function ImageStudio() {
const regenerateBtn = document.createElement('button');
regenerateBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- regenerateBtn.textContent = '↻ Regenerate';
+ regenerateBtn.textContent = t('common.regenerate');
const downloadBtn = document.createElement('button');
downloadBtn.className = 'bg-primary text-black px-6 py-2.5 rounded-2xl text-xs font-bold transition-all shadow-glow active:scale-95';
- downloadBtn.textContent = '↓ Download';
+ downloadBtn.textContent = t('common.download');
const newPromptBtn = document.createElement('button');
newPromptBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- newPromptBtn.textContent = '+ New';
+ newPromptBtn.textContent = t('common.newItem');
canvasControls.appendChild(regenerateBtn);
canvasControls.appendChild(downloadBtn);
@@ -1146,7 +1147,7 @@ export function ImageStudio() {
const resetResolutions = getResolutionsForModel(selectedModel);
qualityBtn.style.display = resetResolutions.length > 0 ? 'flex' : 'none';
if (resetResolutions.length > 0) document.getElementById('quality-btn-label').textContent = resetResolutions[0];
- textarea.placeholder = 'Describe the image you want to create';
+ textarea.placeholder = t('image.placeholder');
textarea.focus();
};
@@ -1174,7 +1175,7 @@ export function ImageStudio() {
hero.classList.add('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.disabled = true;
- generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> Generating...`;
+ generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> ${t('common.generating')}`;
const progressWrap = document.getElementById('local-progress-wrap');
const progressFill = document.getElementById('local-progress-fill');
@@ -1226,10 +1227,10 @@ export function ImageStudio() {
hero.classList.remove('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
console.error('[Local] full error:', e.message);
generateBtn.innerHTML = `Error: ${e.message.slice(0, 120)}`;
- setTimeout(() => { generateBtn.innerHTML = `Generate ✨`; }, 6000);
+ setTimeout(() => { generateBtn.innerHTML = t('common.generate'); }, 6000);
} finally {
generateBtn.disabled = false;
- if (!hadError) generateBtn.innerHTML = `Generate ✨`;
+ if (!hadError) generateBtn.innerHTML = t('common.generate');
}
return;
}
@@ -1307,12 +1308,12 @@ export function ImageStudio() {
hero.classList.remove('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.innerHTML = `Error: ${e.message.slice(0, 60)}`;
setTimeout(() => {
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
}, 4000);
} finally {
generateBtn.disabled = false;
// Only reset the label on success; the catch timeout handles the error case
- if (!hadError) generateBtn.innerHTML = `Generate ✨`;
+ if (!hadError) generateBtn.innerHTML = t('common.generate');
}
};
diff --git a/src/components/LipSyncStudio.js b/src/components/LipSyncStudio.js
index d1fb429e..26c2f63e 100644
--- a/src/components/LipSyncStudio.js
+++ b/src/components/LipSyncStudio.js
@@ -1,6 +1,7 @@
import { muapi } from '../lib/muapi.js';
import { lipsyncModels, imageLipSyncModels, videoLipSyncModels, getLipSyncModelById, getResolutionsForLipSyncModel } from '../lib/models.js';
import { AuthModal } from './AuthModal.js';
+import { t } from '../lib/i18n.js';
import { createUploadPicker } from './UploadPicker.js';
import { savePendingJob, removePendingJob, getPendingJobs } from '../lib/pendingJobs.js';
@@ -48,8 +49,8 @@ export function LipSyncStudio() {
<div class="absolute top-4 right-4 text-primary animate-pulse">🎙</div>
</div>
</div>
- <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">Lip Sync</h1>
- <p class="text-secondary text-sm font-medium tracking-wide opacity-60">Animate portraits or sync lips to audio with AI</p>
+ <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">${t('lipsync.title')}</h1>
+ <p class="text-secondary text-sm font-medium tracking-wide opacity-60">${t('lipsync.subtitle')}</p>
`;
container.appendChild(hero);
@@ -69,17 +70,17 @@ export function LipSyncStudio() {
const modeLabel = document.createElement('span');
modeLabel.className = 'text-xs text-muted font-bold uppercase tracking-widest mr-2';
- modeLabel.textContent = 'Input:';
+ modeLabel.textContent = t('lipsync.input');
const imageModeBtn = document.createElement('button');
imageModeBtn.type = 'button';
imageModeBtn.className = 'px-4 py-1.5 rounded-xl text-xs font-bold transition-all border border-primary bg-primary/10 text-primary';
- imageModeBtn.textContent = '🖼 Portrait Image';
+ imageModeBtn.textContent = t('lipsync.portraitImage');
const videoModeBtn = document.createElement('button');
videoModeBtn.type = 'button';
videoModeBtn.className = 'px-4 py-1.5 rounded-xl text-xs font-bold transition-all border border-white/10 text-muted hover:border-white/30 hover:text-white';
- videoModeBtn.textContent = '🎬 Video';
+ videoModeBtn.textContent = t('lipsync.video');
modeToggleRow.appendChild(modeLabel);
modeToggleRow.appendChild(imageModeBtn);
@@ -95,12 +96,12 @@ export function LipSyncStudio() {
anchorContainer: container,
onSelect: ({ url }) => {
uploadedImageUrl = url;
- imageStatusLabel.textContent = '✓ Image ready';
+ imageStatusLabel.textContent = t('lipsync.imageReady');
imageStatusLabel.className = 'text-primary';
},
onClear: () => {
uploadedImageUrl = null;
- imageStatusLabel.textContent = 'No image';
+ imageStatusLabel.textContent = t('lipsync.noImage');
imageStatusLabel.className = 'text-muted';
}
});
@@ -144,7 +145,7 @@ export function LipSyncStudio() {
videoReadyEl.classList.add('hidden'); videoReadyEl.classList.remove('flex');
videoPickerBtn.classList.remove('border-primary/60'); videoPickerBtn.classList.add('border-white/10');
videoPickerBtn.title = 'Upload source video';
- mediaStatusLabel.textContent = 'No video'; mediaStatusLabel.className = 'text-muted';
+ mediaStatusLabel.textContent = t('lipsync.noVideo'); mediaStatusLabel.className = 'text-muted';
};
const showVideoSpinner = () => {
videoIconEl.classList.add('hidden'); videoIconEl.classList.remove('flex');
@@ -212,7 +213,7 @@ export function LipSyncStudio() {
audioReadyEl.classList.add('hidden'); audioReadyEl.classList.remove('flex');
audioPickerBtn.classList.remove('border-primary/60'); audioPickerBtn.classList.add('border-white/10');
audioPickerBtn.title = 'Upload audio file';
- audioStatusLabel.textContent = 'No audio'; audioStatusLabel.className = 'text-muted';
+ audioStatusLabel.textContent = t('lipsync.noAudio'); audioStatusLabel.className = 'text-muted';
};
const showAudioSpinner = () => {
audioIconEl.classList.add('hidden'); audioIconEl.classList.remove('flex');
@@ -248,7 +249,7 @@ export function LipSyncStudio() {
// ── Prompt Textarea ──
const textarea = document.createElement('textarea');
- textarea.placeholder = 'Optional: describe the talking style or motion...';
+ textarea.placeholder = t('lipsync.promptPlaceholder');
textarea.className = 'flex-1 bg-transparent text-white placeholder-muted/50 text-sm resize-none outline-none min-h-[56px] leading-relaxed pt-1';
textarea.rows = 2;
@@ -265,13 +266,13 @@ export function LipSyncStudio() {
// mediaStatusLabel: shows image or video status depending on mode
const mediaStatusLabel = document.createElement('span');
mediaStatusLabel.className = 'text-muted';
- mediaStatusLabel.textContent = 'No image';
+ mediaStatusLabel.textContent = t('lipsync.noImage');
const imageStatusLabel = mediaStatusLabel; // alias used in imagePicker callbacks
const audioStatusLabel = document.createElement('span');
audioStatusLabel.className = 'text-muted';
- audioStatusLabel.textContent = 'No audio';
+ audioStatusLabel.textContent = t('lipsync.noAudio');
statusRow.appendChild(mediaStatusLabel);
statusRow.appendChild(document.createTextNode(' · '));
@@ -301,7 +302,7 @@ export function LipSyncStudio() {
generateBtn.id = 'ls-generate-btn';
generateBtn.type = 'button';
generateBtn.className = 'ml-auto px-6 py-2.5 bg-primary text-black font-black text-sm rounded-2xl hover:scale-105 active:scale-95 transition-all shadow-glow disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100';
- generateBtn.textContent = 'Generate ✨';
+ generateBtn.textContent = t('common.generate');
bottomRow.appendChild(modelBtn);
bottomRow.appendChild(resolutionBtn);
@@ -407,14 +408,14 @@ export function LipSyncStudio() {
videoModeBtn.className = 'px-4 py-1.5 rounded-xl text-xs font-bold transition-all border border-white/10 text-muted hover:border-white/30 hover:text-white';
imagePicker.trigger.classList.remove('hidden');
videoPickerBtn.classList.add('hidden');
- mediaStatusLabel.textContent = uploadedImageUrl ? '✓ Image ready' : 'No image';
+ mediaStatusLabel.textContent = uploadedImageUrl ? t('lipsync.imageReady') : t('lipsync.noImage');
mediaStatusLabel.className = uploadedImageUrl ? 'text-primary' : 'text-muted';
} else {
videoModeBtn.className = 'px-4 py-1.5 rounded-xl text-xs font-bold transition-all border border-primary bg-primary/10 text-primary';
imageModeBtn.className = 'px-4 py-1.5 rounded-xl text-xs font-bold transition-all border border-white/10 text-muted hover:border-white/30 hover:text-white';
videoPickerBtn.classList.remove('hidden');
imagePicker.trigger.classList.add('hidden');
- mediaStatusLabel.textContent = uploadedVideoUrl ? '✓ Video ready' : 'No video';
+ mediaStatusLabel.textContent = uploadedVideoUrl ? t('lipsync.videoReady') : t('lipsync.noVideo');
mediaStatusLabel.className = uploadedVideoUrl ? 'text-primary' : 'text-muted';
}
@@ -469,7 +470,7 @@ export function LipSyncStudio() {
const historyLabel = document.createElement('div');
historyLabel.className = 'text-[9px] font-bold text-muted uppercase tracking-widest mb-2';
- historyLabel.textContent = 'History';
+ historyLabel.textContent = t('lipsync.history');
historySidebar.appendChild(historyLabel);
const historyList = document.createElement('div');
@@ -498,15 +499,15 @@ export function LipSyncStudio() {
const regenerateBtn = document.createElement('button');
regenerateBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- regenerateBtn.textContent = '↻ Regenerate';
+ regenerateBtn.textContent = t('lipsync.regenerate');
const downloadBtn = document.createElement('button');
downloadBtn.className = 'bg-primary text-black px-6 py-2.5 rounded-2xl text-xs font-bold transition-all shadow-glow active:scale-95';
- downloadBtn.textContent = '↓ Download';
+ downloadBtn.textContent = t('lipsync.download');
const newBtn = document.createElement('button');
newBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- newBtn.textContent = '+ New';
+ newBtn.textContent = t('lipsync.new');
canvasControls.appendChild(regenerateBtn);
canvasControls.appendChild(downloadBtn);
@@ -639,9 +640,9 @@ export function LipSyncStudio() {
uploadedAudioUrl = null;
showVideoIcon();
showAudioIcon();
- mediaStatusLabel.textContent = inputMode === 'image' ? 'No image' : 'No video';
+ mediaStatusLabel.textContent = inputMode === 'image' ? t('lipsync.noImage') : t('lipsync.noVideo');
mediaStatusLabel.className = 'text-muted';
- audioStatusLabel.textContent = 'No audio';
+ audioStatusLabel.textContent = t('lipsync.noAudio');
audioStatusLabel.className = 'text-muted';
textarea.focus();
};
@@ -655,15 +656,15 @@ export function LipSyncStudio() {
// Validation
if (!uploadedAudioUrl) {
- alert('Please upload an audio file first.');
+ alert(t('lipsync.noAudioAlert'));
return;
}
if (inputMode === 'image' && !uploadedImageUrl) {
- alert('Please upload a portrait image first.');
+ alert(t('lipsync.noImageAlert'));
return;
}
if (inputMode === 'video' && !uploadedVideoUrl) {
- alert('Please upload a source video first.');
+ alert(t('lipsync.noVideoAlert'));
return;
}
@@ -672,7 +673,7 @@ export function LipSyncStudio() {
hero.classList.add('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.disabled = true;
- generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> Generating...`;
+ generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> ${t('common.generating')}`;
let hadError = false;
let capturedRequestId = null;
@@ -720,10 +721,10 @@ export function LipSyncStudio() {
console.error(e);
hero.classList.remove('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.innerHTML = `Error: ${e.message.slice(0, 60)}`;
- setTimeout(() => { generateBtn.innerHTML = `Generate ✨`; }, 4000);
+ setTimeout(() => { generateBtn.innerHTML = t('common.generate'); }, 4000);
} finally {
generateBtn.disabled = false;
- if (!hadError) generateBtn.innerHTML = `Generate ✨`;
+ if (!hadError) generateBtn.innerHTML = t('common.generate');
}
};
diff --git a/src/components/LocalModelManager.js b/src/components/LocalModelManager.js
index ffcc7474..6962a311 100644
--- a/src/components/LocalModelManager.js
+++ b/src/components/LocalModelManager.js
@@ -1,4 +1,5 @@
import { localAI, isLocalAIAvailable } from '../lib/localInferenceClient.js';
+import { t, tf } from '../lib/i18n.js';
// ─── Icons ────────────────────────────────────────────────────────────────────
const DownloadIcon = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg>`;
@@ -26,13 +27,13 @@ function BinaryStatusBar(onStatusChange) {
label.className = 'flex flex-col gap-0.5';
label.innerHTML = `
<span class="text-xs font-bold text-white">sd.cpp inference engine</span>
- <span id="binary-status-text" class="text-[11px] text-muted">Checking...</span>
+ <span id="binary-status-text" class="text-[11px] text-muted">${t('localModels.checking')}</span>
`;
const btn = document.createElement('button');
btn.id = 'binary-action-btn';
btn.className = 'px-3 py-1.5 rounded-lg text-xs font-bold transition-all hidden';
- btn.textContent = 'Install';
+ btn.textContent = t('localModels.installEngine');
bar.appendChild(label);
bar.appendChild(btn);
@@ -47,13 +48,13 @@ function BinaryStatusBar(onStatusChange) {
const status = await localAI.getBinaryStatus();
const text = bar.querySelector('#binary-status-text');
if (status.exists) {
- text.textContent = 'Installed and ready';
+ text.textContent = t('localModels.installed');
text.className = 'text-[11px] text-green-400';
btn.classList.add('hidden');
} else {
- text.textContent = 'Not installed — required for local generation';
+ text.textContent = t('localModels.notInstalled');
text.className = 'text-[11px] text-yellow-400';
- btn.textContent = 'Install Engine';
+ btn.textContent = t('localModels.installEngine');
btn.className = 'px-3 py-1.5 rounded-lg text-xs font-bold bg-primary text-black transition-all';
btn.classList.remove('hidden');
}
@@ -62,7 +63,7 @@ function BinaryStatusBar(onStatusChange) {
btn.onclick = async () => {
btn.disabled = true;
- btn.textContent = 'Downloading...';
+ btn.textContent = t('localModels.downloading');
progressBar.classList.remove('hidden');
const unsub = localAI.onDownloadProgress(({ id, phase, progress }) => {
@@ -70,7 +71,7 @@ function BinaryStatusBar(onStatusChange) {
const fill = document.getElementById('binary-progress-fill');
const text = bar.querySelector('#binary-status-text');
if (fill) fill.style.width = `${Math.round(progress * 100)}%`;
- if (text) text.textContent = phase === 'extracting' ? 'Extracting...' : `Downloading... ${Math.round(progress * 100)}%`;
+ if (text) text.textContent = phase === 'extracting' ? t('localModels.extracting') : `${t('localModels.downloading')} ${Math.round(progress * 100)}%`;
});
try {
@@ -83,7 +84,7 @@ function BinaryStatusBar(onStatusChange) {
const text = bar.querySelector('#binary-status-text');
if (text) text.textContent = `Error: ${err.message}`;
btn.disabled = false;
- btn.textContent = 'Retry';
+ btn.textContent = t('common.retry');
}
};
@@ -108,14 +109,14 @@ function AuxRow(label, auxKey, initStatus, onStateChange) {
</div>
<div class="flex items-center gap-2 shrink-0">
${isReady
- ? `<span class="text-[10px] text-green-400">Ready</span>`
- : `<button class="aux-dl-btn flex items-center gap-1 px-2.5 py-1 rounded-lg text-[11px] font-bold bg-primary/20 text-primary border border-primary/30 hover:bg-primary/30 transition-all">${DownloadIcon} Get</button>`}
+ ? `<span class="text-[10px] text-green-400">${t('localModels.ready')}</span>`
+ : `<button class="aux-dl-btn flex items-center gap-1 px-2.5 py-1 rounded-lg text-[11px] font-bold bg-primary/20 text-primary border border-primary/30 hover:bg-primary/30 transition-all">${DownloadIcon} ${t('localModels.get')}</button>`}
</div>
<div class="aux-progress hidden w-full col-span-2 mt-1">
<div class="h-1 rounded-full bg-white/10 overflow-hidden">
<div class="aux-fill h-full bg-primary transition-all" style="width:0%"></div>
</div>
- <span class="aux-text text-[10px] text-muted block mt-0.5">Downloading...</span>
+ <span class="aux-text text-[10px] text-muted block mt-0.5">${t('localModels.downloading')}</span>
</div>
`;
@@ -133,7 +134,7 @@ function AuxRow(label, auxKey, initStatus, onStateChange) {
const unsub = localAI.onDownloadProgress(({ id, phase, progress }) => {
if (id !== auxId) return;
progFill.style.width = `${Math.round(progress * 100)}%`;
- progText.textContent = phase === 'done' ? 'Complete!' : `Downloading... ${Math.round(progress * 100)}%`;
+ progText.textContent = phase === 'done' ? t('localModels.complete') : `${t('localModels.downloading')} ${Math.round(progress * 100)}%`;
});
try {
@@ -144,7 +145,7 @@ function AuxRow(label, auxKey, initStatus, onStateChange) {
unsub();
progText.textContent = `Error: ${err.message}`;
btn.disabled = false;
- btn.innerHTML = `${DownloadIcon} Retry`;
+ btn.innerHTML = `${DownloadIcon} ${t('common.retry')}`;
}
};
}
@@ -170,7 +171,7 @@ function Wan2gpConfigBar(onChange) {
<button id="wan2gp-test" class="px-3 py-1.5 rounded-lg text-xs font-bold bg-primary/20 text-primary border border-primary/30 hover:bg-primary/30 transition-all">Test</button>
<button id="wan2gp-save" class="px-3 py-1.5 rounded-lg text-xs font-bold bg-primary text-black hover:shadow-glow transition-all">Save</button>
</div>
- <div id="wan2gp-status" class="text-[11px] text-muted">Not configured</div>
+ <div id="wan2gp-status" class="text-[11px] text-muted">${t('localModels.notConfigured')}</div>
`;
const input = wrap.querySelector('#wan2gp-url');
@@ -190,14 +191,14 @@ function Wan2gpConfigBar(onChange) {
const r = await localAI.probeWan2gp(cfg.url);
setStatus(r.ok ? `Connected · Gradio ${r.version}` : `Saved URL not reachable: ${r.error}`, r.ok ? 'ok' : 'warn');
} else {
- setStatus('Not configured (Wan2GP models will appear offline)', 'muted');
+ setStatus(t('localModels.notConfiguredNote'), 'muted');
}
})();
testBtn.onclick = async () => {
const url = input.value.trim();
if (!url) { setStatus('Enter a URL first', 'warn'); return; }
- setStatus('Probing...', 'muted');
+ setStatus(t('localModels.probing'), 'muted');
testBtn.disabled = true;
try {
const r = await localAI.probeWan2gp(url);
@@ -238,7 +239,7 @@ function Wan2gpModelCard(model) {
</div>
</div>
<div class="shrink-0">
- <span class="text-[10px] font-bold ${ready ? 'text-green-400' : 'text-yellow-400'}">${ready ? 'Available' : 'Server offline'}</span>
+ <span class="text-[10px] font-bold ${ready ? 'text-green-400' : 'text-yellow-400'}">${ready ? t('localModels.available') : t('localModels.offline')}</span>
</div>
`;
return card;
@@ -259,7 +260,7 @@ function ModelCard(model, onStateChange) {
<div class="flex flex-col gap-1 min-w-0">
<div class="flex items-center gap-2 flex-wrap">
<span class="text-sm font-bold text-white truncate">${model.name}</span>
- ${model.featured ? `<span class="px-1.5 py-0.5 rounded-md text-[10px] font-black bg-primary/20 text-primary border border-primary/30">⚡ Featured</span>` : ''}
+ ${model.featured ? `<span class="px-1.5 py-0.5 rounded-md text-[10px] font-black bg-primary/20 text-primary border border-primary/30">${t('localModels.featured')}</span>` : ''}
${fullyReady ? `<span class="text-green-400">${CheckIcon}</span>` : ''}
</div>
<p class="text-[11px] text-muted leading-relaxed">${model.description}</p>
@@ -272,7 +273,7 @@ function ModelCard(model, onStateChange) {
<div class="flex items-center gap-2 shrink-0">
${isDownloaded
? `<button class="delete-btn p-2 rounded-lg text-red-400 hover:bg-red-500/10 transition-all">${TrashIcon}</button>`
- : `<button class="download-btn flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold bg-primary text-black hover:shadow-glow transition-all">${DownloadIcon} Download</button>`
+ : `<button class="download-btn flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold bg-primary text-black hover:shadow-glow transition-all">${DownloadIcon} ${t('localModels.download')}</button>`
}
</div>
</div>
@@ -280,7 +281,7 @@ function ModelCard(model, onStateChange) {
<div class="h-1 rounded-full bg-white/10 overflow-hidden">
<div class="progress-fill h-full bg-primary transition-all" style="width:0%"></div>
</div>
- <span class="progress-text text-[10px] text-muted mt-1 block">Preparing...</span>
+ <span class="progress-text text-[10px] text-muted mt-1 block">${t('localModels.preparing')}</span>
</div>
${model.requiresAuxiliary ? `<div class="aux-section flex flex-col gap-1.5 pt-1 border-t border-white/5"></div>` : ''}
`;
@@ -289,7 +290,7 @@ function ModelCard(model, onStateChange) {
if (model.requiresAuxiliary) {
const auxSection = card.querySelector('.aux-section');
auxSection.appendChild(document.createElement('span')).className = 'text-[10px] text-muted uppercase tracking-wider font-bold';
- auxSection.querySelector('span').textContent = 'Required components';
+ auxSection.querySelector('span').textContent = t('localModels.requiredComponents');
auxSection.appendChild(AuxRow('Qwen3-4B Text Encoder (2.4 GB)', 'llm', auxStatus.llm, onStateChange));
auxSection.appendChild(AuxRow('FLUX VAE (335 MB)', 'vae', auxStatus.vae, onStateChange));
}
@@ -302,13 +303,13 @@ function ModelCard(model, onStateChange) {
if (downloadBtn) {
downloadBtn.onclick = async () => {
downloadBtn.disabled = true;
- downloadBtn.innerHTML = `<span class="animate-spin">◌</span> Starting...`;
+ downloadBtn.innerHTML = `<span class="animate-spin">◌</span> ${t('localModels.starting')}`;
progressWrap.classList.remove('hidden');
const unsub = localAI.onDownloadProgress(({ id, phase, progress }) => {
if (id !== model.id) return;
progressFill.style.width = `${Math.round(progress * 100)}%`;
- progressText.textContent = phase === 'done' ? 'Complete!' : `Downloading... ${Math.round(progress * 100)}%`;
+ progressText.textContent = phase === 'done' ? t('localModels.complete') : `${t('localModels.downloading')} ${Math.round(progress * 100)}%`;
});
try {
@@ -319,7 +320,7 @@ function ModelCard(model, onStateChange) {
unsub();
progressText.textContent = `Error: ${err.message}`;
downloadBtn.disabled = false;
- downloadBtn.innerHTML = `${DownloadIcon} Retry`;
+ downloadBtn.innerHTML = `${DownloadIcon} ${t('common.retry')}`;
}
};
}
@@ -327,7 +328,7 @@ function ModelCard(model, onStateChange) {
const deleteBtn = card.querySelector('.delete-btn');
if (deleteBtn) {
deleteBtn.onclick = async () => {
- if (!confirm(`Delete "${model.name}"? You'll need to re-download it to use it again.`)) return;
+ if (!confirm(tf('localModels.deleteConfirm', model.name))) return;
await localAI.deleteModel(model.id);
if (onStateChange) onStateChange();
};
@@ -344,8 +345,8 @@ export function LocalModelManager() {
if (!isLocalAIAvailable()) {
root.innerHTML = `
<div class="flex flex-col items-center gap-3 py-8 text-center">
- <p class="text-sm font-bold text-white">Local Models</p>
- <p class="text-xs text-muted max-w-xs">Local model inference is only available in the desktop app (Electron build). Use <span class="text-primary font-bold">npm run electron:build</span> to build.</p>
+ <p class="text-sm font-bold text-white">${t('localModels.title')}</p>
+ <p class="text-xs text-muted max-w-xs">${t('localModels.webOnly')}</p>
</div>
`;
return root;
@@ -354,7 +355,7 @@ export function LocalModelManager() {
// ── Section: engine status
const engineSection = document.createElement('div');
engineSection.className = 'flex flex-col gap-2';
- engineSection.innerHTML = `<h3 class="text-xs font-bold text-secondary uppercase tracking-wider">Inference Engine</h3>`;
+ engineSection.innerHTML = `<h3 class="text-xs font-bold text-secondary uppercase tracking-wider">${t('localModels.inferenceEngine')}</h3>`;
let binaryReady = false;
const binaryBar = BinaryStatusBar((ready) => { binaryReady = ready; });
@@ -369,8 +370,8 @@ export function LocalModelManager() {
modelsSection.className = 'flex flex-col gap-3';
modelsSection.innerHTML = `
<div class="flex items-center justify-between gap-3">
- <h3 class="text-xs font-bold text-secondary uppercase tracking-wider shrink-0">Local Models</h3>
- <span id="local-model-storage" class="min-w-0 truncate text-right text-[10px] text-muted">Checking storage...</span>
+ <h3 class="text-xs font-bold text-secondary uppercase tracking-wider shrink-0">${t('localModels.title')}</h3>
+ <span id="local-model-storage" class="min-w-0 truncate text-right text-[10px] text-muted">${t('localModels.checkingStorage')}</span>
</div>
<div id="local-model-list" class="flex flex-col gap-3"></div>
`;
@@ -383,17 +384,17 @@ export function LocalModelManager() {
try {
const status = await localAI.getBinaryStatus();
const storagePath = status.modelsDir || status.dataDir;
- storageEl.textContent = storagePath ? `Stored in ${storagePath}` : 'Stored in your app data folder';
+ storageEl.textContent = storagePath ? `${t('localModels.storedIn')} ${storagePath}` : t('localModels.storedDefault');
if (storagePath && status.envVar) {
storageEl.title = `Set ${status.envVar} before launch to change this location`;
}
} catch (_) {
- storageEl.textContent = 'Stored in your app data folder';
+ storageEl.textContent = t('localModels.storedDefault');
}
};
const renderModels = async () => {
- listEl.innerHTML = `<div class="text-xs text-muted text-center py-4">Loading...</div>`;
+ listEl.innerHTML = `<div class="text-xs text-muted text-center py-4">${t('localModels.loading')}</div>`;
try {
const models = await localAI.listModels();
listEl.innerHTML = '';
@@ -401,7 +402,7 @@ export function LocalModelManager() {
listEl.appendChild(ModelCard(m, renderModels));
});
} catch (err) {
- listEl.innerHTML = `<div class="text-xs text-red-400 text-center py-4">Error loading models: ${err.message}</div>`;
+ listEl.innerHTML = `<div class="text-xs text-red-400 text-center py-4">${t('localModels.errorLoading')}${err.message}</div>`;
}
};
diff --git a/src/components/SettingsModal.js b/src/components/SettingsModal.js
index 8cf7e78a..4d84784b 100644
--- a/src/components/SettingsModal.js
+++ b/src/components/SettingsModal.js
@@ -1,5 +1,6 @@
import { LocalModelManager } from './LocalModelManager.js';
import { isLocalAIAvailable } from '../lib/localInferenceClient.js';
+import { t } from '../lib/i18n.js';
export function SettingsModal(onClose) {
const overlay = document.createElement('div');
@@ -12,7 +13,7 @@ export function SettingsModal(onClose) {
const header = document.createElement('div');
header.style.cssText = 'display:flex;align-items:center;justify-content:space-between;padding:1.25rem 1.5rem;border-bottom:1px solid rgba(255,255,255,0.06);flex-shrink:0;';
header.innerHTML = `
- <h2 style="font-size:1rem;font-weight:800;color:#fff;margin:0;">Settings</h2>
+ <h2 style="font-size:1rem;font-weight:800;color:#fff;margin:0;">${t('settings.title')}</h2>
<button id="settings-close-btn" style="color:rgba(255,255,255,0.4);background:none;border:none;cursor:pointer;padding:4px;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6L6 18M6 6l12 12"/></svg>
</button>
@@ -21,8 +22,8 @@ export function SettingsModal(onClose) {
// ── Tabs ──────────────────────────────────────────────────────────────────
const TABS = [
- { id: 'api', label: 'API Key' },
- ...(isLocalAIAvailable() ? [{ id: 'local', label: 'Local Models' }] : []),
+ { id: 'api', label: t('settings.apiKey') },
+ ...(isLocalAIAvailable() ? [{ id: 'local', label: t('settings.localModels') }] : []),
];
let activeTab = 'api';
@@ -51,18 +52,18 @@ export function SettingsModal(onClose) {
apiPanel.innerHTML = `
<div style="display:flex;flex-direction:column;gap:0.75rem;">
<div>
- <label style="display:block;font-size:0.75rem;color:rgba(255,255,255,0.5);margin-bottom:0.4rem;font-weight:600;">Muapi API Key</label>
+ <label style="display:block;font-size:0.75rem;color:rgba(255,255,255,0.5);margin-bottom:0.4rem;font-weight:600;">${t('settings.muapiKeyLabel')}</label>
<input id="settings-api-key" type="password"
style="width:100%;box-sizing:border-box;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.1);border-radius:0.75rem;padding:0.6rem 0.9rem;color:#fff;font-size:0.875rem;outline:none;"
- placeholder="Enter your Muapi API key..."
+ placeholder="${t('settings.keyPlaceholder')}"
value="${localStorage.getItem('muapi_key') || ''}">
</div>
<p style="font-size:0.7rem;color:rgba(255,255,255,0.3);margin:0;">
- Your API key is stored locally and never sent anywhere except api.muapi.ai.
+ ${t('settings.keyNote')}
</p>
<div style="display:flex;justify-content:flex-end;gap:0.5rem;margin-top:0.5rem;">
- <button id="settings-cancel-btn" style="padding:0.5rem 1rem;border-radius:0.5rem;background:none;border:1px solid rgba(255,255,255,0.1);color:rgba(255,255,255,0.6);font-size:0.75rem;font-weight:700;cursor:pointer;">Cancel</button>
- <button id="settings-save-btn" style="padding:0.5rem 1rem;border-radius:0.5rem;background:var(--color-primary,#22d3ee);color:#000;font-size:0.75rem;font-weight:700;cursor:pointer;border:none;">Save</button>
+ <button id="settings-cancel-btn" style="padding:0.5rem 1rem;border-radius:0.5rem;background:none;border:1px solid rgba(255,255,255,0.1);color:rgba(255,255,255,0.6);font-size:0.75rem;font-weight:700;cursor:pointer;">${t('common.cancel')}</button>
+ <button id="settings-save-btn" style="padding:0.5rem 1rem;border-radius:0.5rem;background:var(--color-primary,#22d3ee);color:#000;font-size:0.75rem;font-weight:700;cursor:pointer;border:none;">${t('common.save')}</button>
</div>
</div>
`;
@@ -105,7 +106,7 @@ export function SettingsModal(onClose) {
localStorage.setItem('muapi_key', key);
close();
} else {
- alert('Please enter a valid API key.');
+ alert(t('settings.invalidKey'));
}
};
diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js
index 3c3accc1..b972fbf3 100644
--- a/src/components/Sidebar.js
+++ b/src/components/Sidebar.js
@@ -1,3 +1,5 @@
+import { t } from '../lib/i18n.js';
+
export function Sidebar() {
const element = document.createElement('aside');
element.className = 'glass-panel';
@@ -17,13 +19,13 @@ export function Sidebar() {
element.appendChild(logo);
const navItems = [
- { id: 'image', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>', label: 'Canvas' },
- { id: 'video', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>', label: 'Video' },
- { id: 'library', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></svg>', label: 'Library' },
+ { id: 'image', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>', label: t('sidebar.canvas') },
+ { id: 'video', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>', label: t('sidebar.video') },
+ { id: 'library', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></svg>', label: t('sidebar.library') },
];
const bottomItems = [
- { id: 'settings', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>', label: 'Settings' }
+ { id: 'settings', icon: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>', label: t('sidebar.settings') }
];
let activeTab = 'image';
diff --git a/src/components/VideoStudio.js b/src/components/VideoStudio.js
index 1b99e59b..6f690875 100644
--- a/src/components/VideoStudio.js
+++ b/src/components/VideoStudio.js
@@ -1,6 +1,7 @@
import { muapi } from '../lib/muapi.js';
import { t2vModels, getAspectRatiosForVideoModel, getDurationsForModel, getResolutionsForVideoModel, i2vModels, getAspectRatiosForI2VModel, getDurationsForI2VModel, getResolutionsForI2VModel, v2vModels, getModesForModel } from '../lib/models.js';
import { AuthModal } from './AuthModal.js';
+import { t } from '../lib/i18n.js';
import { createUploadPicker } from './UploadPicker.js';
import { savePendingJob, removePendingJob, getPendingJobs } from '../lib/pendingJobs.js';
import { localAI, isLocalAIAvailable } from '../lib/localInferenceClient.js';
@@ -100,8 +101,8 @@ export function VideoStudio() {
<div class="absolute top-4 right-4 text-primary animate-pulse">✨</div>
</div>
</div>
- <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">Video Studio</h1>
- <p class="text-secondary text-sm font-medium tracking-wide opacity-60">Animate images into stunning AI videos with motion effects</p>
+ <h1 class="text-2xl sm:text-4xl md:text-7xl font-black text-white tracking-widest uppercase mb-4 selection:bg-primary selection:text-black text-center px-4">${t('video.title')}</h1>
+ <p class="text-secondary text-sm font-medium tracking-wide opacity-60">${t('video.subtitle')}</p>
`;
container.appendChild(hero);
@@ -164,7 +165,7 @@ export function VideoStudio() {
selectedModelName = allT2V[0].name;
document.getElementById('v-model-btn-label').textContent = selectedModelName;
updateControlsForModel(selectedModel);
- textarea.placeholder = 'Describe the video you want to create';
+ textarea.placeholder = t('video.placeholder');
textarea.disabled = false;
},
// Route the upload through the configured Wan2GP server when the active
@@ -437,7 +438,7 @@ export function VideoStudio() {
const generateBtn = document.createElement('button');
generateBtn.className = 'bg-primary text-black px-6 md:px-8 py-3 md:py-3.5 rounded-xl md:rounded-[1.5rem] font-black text-sm md:text-base hover:shadow-glow hover:scale-105 active:scale-95 transition-all flex items-center justify-center gap-2.5 w-full sm:w-auto shadow-lg';
generateBtn.setAttribute('data-tooltip', 'Generate AI video from prompt');
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
bottomRow.appendChild(controlsLeft);
bottomRow.appendChild(generateBtn);
@@ -556,7 +557,7 @@ export function VideoStudio() {
<div class="px-2 pb-3 mb-2 border-b border-white/5 shrink-0">
<div class="flex items-center gap-3 bg-white/5 rounded-xl px-4 py-2.5 border border-white/5 focus-within:border-primary/50 transition-colors">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="text-muted"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>
- <input type="text" id="v-model-search" placeholder="Search models..." class="bg-transparent border-none text-xs text-white focus:ring-0 w-full p-0">
+ <input type="text" id="v-model-search" placeholder="${t('common.searchModels')}" class="bg-transparent border-none text-xs text-white focus:ring-0 w-full p-0">
</div>
</div>
<div class="text-[10px] font-bold text-secondary uppercase tracking-widest px-3 py-2 shrink-0">Video models</div>
@@ -638,7 +639,7 @@ export function VideoStudio() {
if (filteredV2V.length > 0) {
const sectionLabel = document.createElement('div');
sectionLabel.className = 'text-[10px] font-bold text-orange-400/70 uppercase tracking-widest px-3 py-2 mt-1 border-t border-white/5';
- sectionLabel.textContent = 'Video Tools';
+ sectionLabel.textContent = t('video.videoTools');
list.appendChild(sectionLabel);
filteredV2V.forEach(m => list.appendChild(makeModelItem(m, true)));
}
@@ -838,7 +839,7 @@ export function VideoStudio() {
const historyLabel = document.createElement('div');
historyLabel.className = 'text-[9px] font-bold text-muted uppercase tracking-widest mb-2';
- historyLabel.textContent = 'History';
+ historyLabel.textContent = t('video.history');
historySidebar.appendChild(historyLabel);
const historyList = document.createElement('div');
@@ -868,20 +869,20 @@ export function VideoStudio() {
const regenerateBtn = document.createElement('button');
regenerateBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- regenerateBtn.textContent = '↻ Regenerate';
+ regenerateBtn.textContent = t('video.regenerate');
const downloadBtn = document.createElement('button');
downloadBtn.className = 'bg-primary text-black px-6 py-2.5 rounded-2xl text-xs font-bold transition-all shadow-glow active:scale-95';
- downloadBtn.textContent = '↓ Download';
+ downloadBtn.textContent = t('video.download');
const extendBtn = document.createElement('button');
extendBtn.className = 'hidden bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-primary/30 text-primary backdrop-blur-lg';
- extendBtn.textContent = '↗ Extend';
+ extendBtn.textContent = t('video.extend');
extendBtn.title = 'Extend this video using Seedance 2.0 Extend';
const newPromptBtn = document.createElement('button');
newPromptBtn.className = 'bg-white/10 hover:bg-white/20 px-6 py-2.5 rounded-2xl text-xs font-bold transition-all border border-white/5 backdrop-blur-lg text-white';
- newPromptBtn.textContent = '+ New';
+ newPromptBtn.textContent = t('video.new');
canvasControls.appendChild(regenerateBtn);
canvasControls.appendChild(extendBtn);
@@ -1127,14 +1128,14 @@ export function VideoStudio() {
hero.classList.add('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.disabled = true;
- generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> Generating...`;
+ generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> ${t('common.generating')}`;
// For local generations, surface step progress in the button label.
let unsubscribeProgress = null;
if (isLocal) {
unsubscribeProgress = localAI.onProgress(({ status, progress }) => {
const pct = typeof progress === 'number' ? Math.round(progress * 100) : null;
- generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> ${status || 'Generating'}${pct != null ? ` ${pct}%` : '…'}`;
+ generateBtn.innerHTML = `<span class="animate-spin inline-block mr-2 text-black">◌</span> ${status || t('common.generating')}${pct != null ? ` ${pct}%` : '…'}`;
});
}
@@ -1170,7 +1171,7 @@ export function VideoStudio() {
throw new Error('No video URL returned by Wan2GP');
}
generateBtn.disabled = false;
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
return;
}
@@ -1191,7 +1192,7 @@ export function VideoStudio() {
throw new Error('No video URL returned by API');
}
generateBtn.disabled = false;
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
return;
}
@@ -1233,7 +1234,7 @@ export function VideoStudio() {
throw new Error('No video URL returned by API');
}
generateBtn.disabled = false;
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
return;
}
@@ -1295,13 +1296,13 @@ export function VideoStudio() {
hero.classList.remove('opacity-0', 'scale-95', '-translate-y-10', 'pointer-events-none');
generateBtn.innerHTML = `Error: ${e.message.slice(0, 60)}`;
setTimeout(() => {
- generateBtn.innerHTML = `Generate ✨`;
+ generateBtn.innerHTML = t('common.generate');
}, 4000);
} finally {
generateBtn.disabled = false;
if (typeof unsubscribeProgress === 'function') unsubscribeProgress();
// Only reset the label on success; the catch timeout handles the error case
- if (!hadError) generateBtn.innerHTML = `Generate ✨`;
+ if (!hadError) generateBtn.innerHTML = t('common.generate');
}
};
diff --git a/src/components/WorkflowStudio.js b/src/components/WorkflowStudio.js
index 90595b0b..15b0dc15 100644
--- a/src/components/WorkflowStudio.js
+++ b/src/components/WorkflowStudio.js
@@ -1,3 +1,5 @@
+import { t } from '../lib/i18n.js';
+
export function WorkflowStudio() {
const container = document.createElement('div');
container.className = 'w-full h-full flex flex-col items-center justify-center bg-app-bg text-white gap-4';
@@ -10,11 +12,11 @@ export function WorkflowStudio() {
</svg>`;
const title = document.createElement('p');
- title.textContent = 'Workflow Studio';
+ title.textContent = t('workflows.title');
title.className = 'text-lg font-bold opacity-60';
const sub = document.createElement('p');
- sub.textContent = 'Available in the web app at open-generative-ai.com';
+ sub.textContent = t('workflows.webOnly');
sub.className = 'text-sm opacity-40';
container.appendChild(icon);
diff --git a/src/lib/i18n.js b/src/lib/i18n.js
new file mode 100644
index 00000000..20260f0a
--- /dev/null
+++ b/src/lib/i18n.js
@@ -0,0 +1,407 @@
+const LANG_KEY = 'og_lang';
+
+export function getLang() {
+ return localStorage.getItem(LANG_KEY) || 'en';
+}
+
+export function setLang(lang) {
+ localStorage.setItem(LANG_KEY, lang);
+ location.reload();
+}
+
+const translations = {
+ en: {
+ // Navigation
+ 'nav.image': 'Image',
+ 'nav.video': 'Video',
+ 'nav.lipsync': 'Lip Sync',
+ 'nav.cinema': 'Cinema Studio',
+ 'nav.workflows': 'Workflows',
+ 'nav.agents': 'Agents',
+ 'nav.mcpcli': 'MCP & CLI',
+ 'nav.settings': 'Settings',
+
+ // Sidebar
+ 'sidebar.canvas': 'Canvas',
+ 'sidebar.video': 'Video',
+ 'sidebar.library': 'Library',
+ 'sidebar.settings': 'Settings',
+
+ // Common
+ 'common.generate': 'Generate ✨',
+ 'common.generating': 'Generating...',
+ 'common.download': '↓ Download',
+ 'common.cancel': 'Cancel',
+ 'common.save': 'Save',
+ 'common.history': 'History',
+ 'common.advanced': 'Advanced',
+ 'common.less': 'Less',
+ 'common.tools': 'Tools',
+ 'common.copy': 'Copy',
+ 'common.copied': 'Copied!',
+ 'common.searchModels': 'Search models...',
+ 'common.retry': 'Retry',
+ 'common.loading': 'Loading...',
+ 'common.noResults': 'No local models match',
+ 'common.regenerate': '↻ Regenerate',
+ 'common.newItem': '+ New',
+ 'common.useInGenerator': 'Use in Generator',
+ 'common.randomize': 'Randomize',
+
+ // Settings Modal
+ 'settings.title': 'Settings',
+ 'settings.apiKey': 'API Key',
+ 'settings.localModels': 'Local Models',
+ 'settings.muapiKeyLabel': 'Muapi API Key',
+ 'settings.keyPlaceholder': 'Enter your Muapi API key...',
+ 'settings.keyNote': 'Your API key is stored locally and never sent anywhere except api.muapi.ai.',
+ 'settings.invalidKey': 'Please enter a valid API key.',
+
+ // Auth Modal
+ 'auth.title': 'Muapi API Key Required',
+ 'auth.subtitle': 'Create a Muapi access key, then paste the key value here to start creating high-aesthetic images.',
+ 'auth.keyLabel': 'Muapi Access Key',
+ 'auth.keyPlaceholder': 'Paste your access key value...',
+ 'auth.keyNote': 'Do not enter the key name or label; paste the generated key value from Muapi.',
+ 'auth.initBtn': 'Initialize Studio',
+ 'auth.createKey': 'Create or copy a Muapi access key →',
+
+ // Image Studio
+ 'image.title': 'Image Studio',
+ 'image.subtitle': 'Transform images with AI — upscale, stylize, animate and more',
+ 'image.placeholder': 'Describe the image you want to create',
+ 'image.placeholderTransform': 'Describe how to transform this image (optional)',
+ 'image.generateTooltip': 'Generate AI image from prompt',
+ 'image.modelTooltip': 'Select AI generation model',
+ 'image.arTooltip': 'Change aspect ratio',
+ 'image.qualityTooltip': 'Set output quality',
+ 'image.advancedTooltip': 'Show advanced options',
+ 'image.toolsTooltip': 'Quick starters & prompt enhancer',
+ 'image.local': '⚡ Local',
+ 'image.api': '☁ API',
+ 'image.generatingLocally': 'Generating locally...',
+ 'image.quickTools': 'Quick Tools',
+ 'image.quickStarters': 'Quick Starters',
+ 'image.promptEnhancer': 'Prompt Enhancer',
+ 'image.basePromptPlaceholder': 'Enter base prompt...',
+ 'image.enhancementTags': 'Enhancement Tags',
+ 'image.enhancedPrompt': 'Enhanced Prompt',
+ 'image.enhancedPlaceholder': 'Your enhanced prompt will appear here...',
+ 'image.advancedOptions': 'Advanced Options',
+ 'image.stylePreset': 'Style Preset',
+ 'image.negPromptLabel': 'Negative Prompt',
+ 'image.negPromptPlaceholder': 'What to exclude from the image (e.g., blurry, distorted, watermark)',
+ 'image.guidanceScale': 'Guidance Scale',
+ 'image.steps': 'Steps',
+ 'image.seed': 'Seed',
+ 'image.seedPlaceholder': '-1 for random',
+ 'image.batchCount': 'Batch Count',
+ 'image.width': 'Width',
+ 'image.height': 'Height',
+ 'image.widthPlaceholder': 'Auto',
+ 'image.heightPlaceholder': 'Auto',
+ 'image.refStrength': 'Reference Strength',
+ 'image.refStrengthNote': 'How much to preserve the reference image characteristics',
+ 'image.lora': 'LoRA Model (Optional)',
+ 'image.loraPlaceholder': 'e.g., civitai:1642876@1864626',
+ 'image.loraWeight': 'LoRA Weight:',
+ 'image.loraNote': 'Enter a LoRA model ID from Civitai (format: civitai:id@version)',
+
+ // Video Studio
+ 'video.title': 'Video Studio',
+ 'video.subtitle': 'Animate images into stunning AI videos with motion effects',
+ 'video.placeholder': 'Describe the video you want to create',
+ 'video.generateTooltip': 'Generate AI video',
+ 'video.history': 'History',
+ 'video.regenerate': '↻ Regenerate',
+ 'video.download': '↓ Download',
+ 'video.extend': '↗ Extend',
+ 'video.new': '+ New',
+ 'video.videoTools': 'Video Tools',
+
+ // Lip Sync Studio
+ 'lipsync.title': 'Lip Sync',
+ 'lipsync.subtitle': 'Animate portraits or sync lips to audio with AI',
+ 'lipsync.input': 'Input:',
+ 'lipsync.portraitImage': '🖼 Portrait Image',
+ 'lipsync.video': '🎬 Video',
+ 'lipsync.noImage': 'No image',
+ 'lipsync.noVideo': 'No video',
+ 'lipsync.noAudio': 'No audio',
+ 'lipsync.imageReady': '✓ Image ready',
+ 'lipsync.videoReady': '✓ Video ready',
+ 'lipsync.promptPlaceholder': 'Optional: describe the talking style or motion...',
+ 'lipsync.regenerate': '↻ Regenerate',
+ 'lipsync.download': '↓ Download',
+ 'lipsync.new': '+ New',
+ 'lipsync.history': 'History',
+ 'lipsync.noAudioAlert': 'Please upload an audio file first.',
+ 'lipsync.noImageAlert': 'Please upload a portrait image first.',
+ 'lipsync.noVideoAlert': 'Please upload a source video first.',
+
+ // Cinema Studio
+ 'cinema.tagline': 'Cinema Studio 2.0',
+ 'cinema.headline': 'What would you shoot<br>with infinite budget?',
+ 'cinema.placeholder': 'Describe your scene - use @ to add characters & props',
+ 'cinema.builderTooltip': 'Quick camera builder',
+ 'cinema.cameraSettings': 'Open camera settings',
+ 'cinema.generateBtn': 'GENERATE ✨',
+ 'cinema.shooting': 'SHOOTING...',
+ 'cinema.history': 'History',
+ 'cinema.load': 'Load',
+ 'cinema.regenerate': '↻ Regenerate',
+ 'cinema.download': '↓ Download',
+ 'cinema.newShot': '+ New Shot',
+ 'cinema.cameraBuilder': 'Camera Builder',
+ 'cinema.camera': 'Camera',
+ 'cinema.lens': 'Lens',
+ 'cinema.focal': 'Focal',
+ 'cinema.aperture': 'Aperture',
+ 'cinema.preview': 'Preview',
+ 'cinema.useSetup': 'Use This Setup',
+ 'cinema.selectSettings': 'Select camera settings to see preview...',
+ 'cinema.generationFailed': 'Generation Failed: ',
+
+ // Agent Studio
+ 'agents.title': 'Agent Studio',
+ 'agents.webOnly': 'Available in the web app at open-generative-ai.com',
+
+ // Workflow Studio
+ 'workflows.title': 'Workflow Studio',
+ 'workflows.webOnly': 'Available in the web app at open-generative-ai.com',
+
+ // Local Model Manager
+ 'localModels.title': 'Local Models',
+ 'localModels.webOnly': 'Local model inference is only available in the desktop app (Electron build). Use npm run electron:build to build.',
+ 'localModels.inferenceEngine': 'Inference Engine',
+ 'localModels.checking': 'Checking...',
+ 'localModels.installed': 'Installed and ready',
+ 'localModels.notInstalled': 'Not installed — required for local generation',
+ 'localModels.installEngine': 'Install Engine',
+ 'localModels.downloading': 'Downloading...',
+ 'localModels.extracting': 'Extracting...',
+ 'localModels.storedIn': 'Stored in',
+ 'localModels.storedDefault': 'Stored in your app data folder',
+ 'localModels.checkingStorage': 'Checking storage...',
+ 'localModels.loading': 'Loading...',
+ 'localModels.featured': '⚡ Featured',
+ 'localModels.download': 'Download',
+ 'localModels.requiredComponents': 'Required components',
+ 'localModels.ready': 'Ready',
+ 'localModels.available': 'Available',
+ 'localModels.offline': 'Server offline',
+ 'localModels.starting': 'Starting...',
+ 'localModels.complete': 'Complete!',
+ 'localModels.preparing': 'Preparing...',
+ 'localModels.get': 'Get',
+ 'localModels.notConfigured': 'Not configured',
+ 'localModels.notConfiguredNote': 'Not configured (Wan2GP models will appear offline)',
+ 'localModels.probing': 'Probing...',
+ 'localModels.errorLoading': 'Error loading models: ',
+ 'localModels.deleteConfirm': (name) => `Delete "${name}"? You'll need to re-download it to use it again.`,
+ },
+ zh: {
+ // Navigation
+ 'nav.image': '图像',
+ 'nav.video': '视频',
+ 'nav.lipsync': '唇语同步',
+ 'nav.cinema': '电影工作室',
+ 'nav.workflows': '工作流',
+ 'nav.agents': '智能体',
+ 'nav.mcpcli': 'MCP & CLI',
+ 'nav.settings': '设置',
+
+ // Sidebar
+ 'sidebar.canvas': '画布',
+ 'sidebar.video': '视频',
+ 'sidebar.library': '素材库',
+ 'sidebar.settings': '设置',
+
+ // Common
+ 'common.generate': '生成 ✨',
+ 'common.generating': '生成中...',
+ 'common.download': '↓ 下载',
+ 'common.cancel': '取消',
+ 'common.save': '保存',
+ 'common.history': '历史记录',
+ 'common.advanced': '高级',
+ 'common.less': '收起',
+ 'common.tools': '工具',
+ 'common.copy': '复制',
+ 'common.copied': '已复制!',
+ 'common.searchModels': '搜索模型...',
+ 'common.retry': '重试',
+ 'common.loading': '加载中...',
+ 'common.noResults': '未找到本地模型',
+ 'common.regenerate': '↻ 重新生成',
+ 'common.newItem': '+ 新建',
+ 'common.useInGenerator': '用于生成器',
+ 'common.randomize': '随机',
+
+ // Settings Modal
+ 'settings.title': '设置',
+ 'settings.apiKey': 'API 密钥',
+ 'settings.localModels': '本地模型',
+ 'settings.muapiKeyLabel': 'Muapi API 密钥',
+ 'settings.keyPlaceholder': '输入您的 Muapi API 密钥...',
+ 'settings.keyNote': '您的 API 密钥仅存储在本地,除 api.muapi.ai 外不会发送到任何地方。',
+ 'settings.invalidKey': '请输入有效的 API 密钥。',
+
+ // Auth Modal
+ 'auth.title': '需要 Muapi API 密钥',
+ 'auth.subtitle': '创建一个 Muapi 访问密钥,然后将密钥值粘贴到这里开始创建高质量图像。',
+ 'auth.keyLabel': 'Muapi 访问密钥',
+ 'auth.keyPlaceholder': '粘贴您的访问密钥值...',
+ 'auth.keyNote': '请不要输入密钥名称或标签;粘贴从 Muapi 生成的密钥值。',
+ 'auth.initBtn': '初始化工作室',
+ 'auth.createKey': '创建或复制 Muapi 访问密钥 →',
+
+ // Image Studio
+ 'image.title': '图像工作室',
+ 'image.subtitle': '用 AI 转换图像 — 超分辨率、风格化、动画等更多功能',
+ 'image.placeholder': '描述您想创建的图像',
+ 'image.placeholderTransform': '描述您想如何转换此图像(可选)',
+ 'image.generateTooltip': '根据提示词生成 AI 图像',
+ 'image.modelTooltip': '选择 AI 生成模型',
+ 'image.arTooltip': '更改宽高比',
+ 'image.qualityTooltip': '设置输出质量',
+ 'image.advancedTooltip': '显示高级选项',
+ 'image.toolsTooltip': '快速启动器与提示词增强器',
+ 'image.local': '⚡ 本地',
+ 'image.api': '☁ API',
+ 'image.generatingLocally': '本地生成中...',
+ 'image.quickTools': '快速工具',
+ 'image.quickStarters': '快速启动',
+ 'image.promptEnhancer': '提示词增强器',
+ 'image.basePromptPlaceholder': '输入基础提示词...',
+ 'image.enhancementTags': '增强标签',
+ 'image.enhancedPrompt': '增强后的提示词',
+ 'image.enhancedPlaceholder': '增强后的提示词将显示在这里...',
+ 'image.advancedOptions': '高级选项',
+ 'image.stylePreset': '风格预设',
+ 'image.negPromptLabel': '反向提示词',
+ 'image.negPromptPlaceholder': '图像中要排除的内容(如:模糊、失真、水印)',
+ 'image.guidanceScale': '引导系数',
+ 'image.steps': '步数',
+ 'image.seed': '随机种子',
+ 'image.seedPlaceholder': '-1 表示随机',
+ 'image.batchCount': '批量数量',
+ 'image.width': '宽度',
+ 'image.height': '高度',
+ 'image.widthPlaceholder': '自动',
+ 'image.heightPlaceholder': '自动',
+ 'image.refStrength': '参考强度',
+ 'image.refStrengthNote': '保留参考图像特征的程度',
+ 'image.lora': 'LoRA 模型(可选)',
+ 'image.loraPlaceholder': '例如:civitai:1642876@1864626',
+ 'image.loraWeight': 'LoRA 权重:',
+ 'image.loraNote': '输入来自 Civitai 的 LoRA 模型 ID(格式:civitai:id@version)',
+
+ // Video Studio
+ 'video.title': '视频工作室',
+ 'video.subtitle': '用 AI 将图像动态化为精彩视频,配合运动效果',
+ 'video.placeholder': '描述您想创建的视频',
+ 'video.generateTooltip': '生成 AI 视频',
+ 'video.history': '历史记录',
+ 'video.regenerate': '↻ 重新生成',
+ 'video.download': '↓ 下载',
+ 'video.extend': '↗ 延伸',
+ 'video.new': '+ 新建',
+ 'video.videoTools': '视频工具',
+
+ // Lip Sync Studio
+ 'lipsync.title': '唇语同步',
+ 'lipsync.subtitle': '用 AI 为人像制作动画或将音频与唇语同步',
+ 'lipsync.input': '输入:',
+ 'lipsync.portraitImage': '🖼 人像图',
+ 'lipsync.video': '🎬 视频',
+ 'lipsync.noImage': '无图像',
+ 'lipsync.noVideo': '无视频',
+ 'lipsync.noAudio': '无音频',
+ 'lipsync.imageReady': '✓ 图像已就绪',
+ 'lipsync.videoReady': '✓ 视频已就绪',
+ 'lipsync.promptPlaceholder': '可选:描述说话风格或动作...',
+ 'lipsync.regenerate': '↻ 重新生成',
+ 'lipsync.download': '↓ 下载',
+ 'lipsync.new': '+ 新建',
+ 'lipsync.history': '历史记录',
+ 'lipsync.noAudioAlert': '请先上传音频文件。',
+ 'lipsync.noImageAlert': '请先上传人像图片。',
+ 'lipsync.noVideoAlert': '请先上传源视频。',
+
+ // Cinema Studio
+ 'cinema.tagline': '电影工作室 2.0',
+ 'cinema.headline': '如果预算无限,<br>你会拍什么?',
+ 'cinema.placeholder': '描述您的场景 - 使用 @ 添加角色和道具',
+ 'cinema.builderTooltip': '快速摄像机设置',
+ 'cinema.cameraSettings': '打开摄像机设置',
+ 'cinema.generateBtn': '生成 ✨',
+ 'cinema.shooting': '拍摄中...',
+ 'cinema.history': '历史记录',
+ 'cinema.load': '加载',
+ 'cinema.regenerate': '↻ 重新生成',
+ 'cinema.download': '↓ 下载',
+ 'cinema.newShot': '+ 新镜头',
+ 'cinema.cameraBuilder': '摄像机设置',
+ 'cinema.camera': '摄像机',
+ 'cinema.lens': '镜头',
+ 'cinema.focal': '焦距',
+ 'cinema.aperture': '光圈',
+ 'cinema.preview': '预览',
+ 'cinema.useSetup': '使用此设置',
+ 'cinema.selectSettings': '选择摄像机设置以查看预览...',
+ 'cinema.generationFailed': '生成失败:',
+
+ // Agent Studio
+ 'agents.title': '智能体工作室',
+ 'agents.webOnly': '在网页应用 open-generative-ai.com 上可用',
+
+ // Workflow Studio
+ 'workflows.title': '工作流工作室',
+ 'workflows.webOnly': '在网页应用 open-generative-ai.com 上可用',
+
+ // Local Model Manager
+ 'localModels.title': '本地模型',
+ 'localModels.webOnly': '本地模型推理仅在桌面应用(Electron 构建版)中可用。使用 npm run electron:build 进行构建。',
+ 'localModels.inferenceEngine': '推理引擎',
+ 'localModels.checking': '检查中...',
+ 'localModels.installed': '已安装,可以使用',
+ 'localModels.notInstalled': '未安装 — 本地生成所必需',
+ 'localModels.installEngine': '安装引擎',
+ 'localModels.downloading': '下载中...',
+ 'localModels.extracting': '解压中...',
+ 'localModels.storedIn': '存储于',
+ 'localModels.storedDefault': '存储在应用数据文件夹中',
+ 'localModels.checkingStorage': '检查存储...',
+ 'localModels.loading': '加载中...',
+ 'localModels.featured': '⚡ 推荐',
+ 'localModels.download': '下载',
+ 'localModels.requiredComponents': '所需组件',
+ 'localModels.ready': '已就绪',
+ 'localModels.available': '可用',
+ 'localModels.offline': '服务器离线',
+ 'localModels.starting': '启动中...',
+ 'localModels.complete': '完成!',
+ 'localModels.preparing': '准备中...',
+ 'localModels.get': '获取',
+ 'localModels.notConfigured': '未配置',
+ 'localModels.notConfiguredNote': '未配置(Wan2GP 模型将显示为离线)',
+ 'localModels.probing': '探测中...',
+ 'localModels.errorLoading': '加载模型时出错:',
+ 'localModels.deleteConfirm': (name) => `删除"${name}"?您需要重新下载才能再次使用。`,
+ },
+};
+
+export function t(key) {
+ const lang = getLang();
+ const dict = translations[lang] || translations.en;
+ const val = dict[key] !== undefined ? dict[key] : (translations.en[key] !== undefined ? translations.en[key] : key);
+ return typeof val === 'function' ? val : val;
+}
+
+export function tf(key, ...args) {
+ const lang = getLang();
+ const dict = translations[lang] || translations.en;
+ const val = dict[key] !== undefined ? dict[key] : (translations.en[key] !== undefined ? translations.en[key] : key);
+ return typeof val === 'function' ? val(...args) : val;
+}