From eae695b4cc3af4fb5138e804b5d5d628f34f2ace Mon Sep 17 00:00:00 2001 From: hashaam-011 Date: Thu, 14 Aug 2025 22:08:12 +0500 Subject: [PATCH] translation --- .../src/components/LanguageSelector.tsx | 39 ++ dream_layer_frontend/src/i18n/en.js | 431 ++++++++++++++++++ dream_layer_frontend/src/i18n/fr.js | 431 ++++++++++++++++++ dream_layer_frontend/src/i18n/i18nContext.tsx | 96 ++++ dream_layer_frontend/src/i18n/index.ts | 3 + 5 files changed, 1000 insertions(+) create mode 100644 dream_layer_frontend/src/components/LanguageSelector.tsx create mode 100644 dream_layer_frontend/src/i18n/en.js create mode 100644 dream_layer_frontend/src/i18n/fr.js create mode 100644 dream_layer_frontend/src/i18n/i18nContext.tsx create mode 100644 dream_layer_frontend/src/i18n/index.ts diff --git a/dream_layer_frontend/src/components/LanguageSelector.tsx b/dream_layer_frontend/src/components/LanguageSelector.tsx new file mode 100644 index 00000000..fc0368c2 --- /dev/null +++ b/dream_layer_frontend/src/components/LanguageSelector.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Globe } from "lucide-react"; +import { useI18n } from '@/i18n/i18nContext'; + +const LanguageSelector = () => { + const { language, setLanguage, availableLanguages } = useI18n(); + + return ( + + + + + + {Object.entries(availableLanguages).map(([code, lang]) => ( + setLanguage(code as keyof typeof availableLanguages)} + className={language === code ? 'bg-accent' : ''} + > + {lang.flag} + {lang.name} + + ))} + + + ); +}; + +export default LanguageSelector; diff --git a/dream_layer_frontend/src/i18n/en.js b/dream_layer_frontend/src/i18n/en.js new file mode 100644 index 00000000..2172b185 --- /dev/null +++ b/dream_layer_frontend/src/i18n/en.js @@ -0,0 +1,431 @@ +export const en = { + // Navigation + nav: { + dreamLayerAI: "DreamLayer AI", + txt2img: "Txt2Img", + img2img: "Img2Img", + extras: "Extras", + models: "Models", + pnginfo: "PNG Info", + configurations: "Configurations" + }, + + // Common + common: { + generate: "Generate", + generateImage: "Generate Image", + saveSettings: "Save Settings", + refresh: "Refresh", + clear: "Clear", + cancel: "Cancel", + confirm: "Confirm", + apply: "Apply", + reset: "Reset", + close: "Close", + open: "Open", + enabled: "Enabled", + disabled: "Disabled", + loading: "Loading...", + error: "Error", + success: "Success", + warning: "Warning", + info: "Information", + manual: "Manual", + interrupt: "Interrupt" + }, + + // Generation Modules + generation: { + title: "Generation Modules", + generation: "Generation", + customWorkflow: "Custom Workflow", + lora: "Lora", + customWorkflowManagement: "Custom Workflow Management", + loraBrowser: "LoRA Browser", + coreGenerationSettings: "Core Generation Settings" + }, + + // Txt2Img + txt2img: { + title: "Text to Image Generation", + prompt: "Prompt", + negativePrompt: "Negative Prompt", + promptPlaceholder: "Enter your prompt here...", + negativePromptPlaceholder: "Enter negative prompt here...", + model: "Model", + sampler: "Sampler", + scheduler: "Scheduler", + steps: "Steps", + cfgScale: "CFG Scale", + width: "Width", + height: "Height", + batchSize: "Batch Size", + batchCount: "Batch Count", + seed: "Seed", + randomSeed: "Random Seed", + denoisingStrength: "Denoising Strength", + // Model Selection + selectCheckpoint: "Select Stable Diffusion Checkpoint:", + auto: "Auto", + selectModel: "Select a model", + noModelsFound: "No models found. Try uploading a new model file.", + addApiKey: "Add API KEY", + refreshModels: "Refresh Models", + // Generation Settings + generationSettings: "Generation Settings", + generateImage: "Generate Image", + // Core Generation Settings + coreGenerationSettings: "Core Generation Settings", + promptInput: "Prompt Input", + copyPrompts: "Copy Prompts", + promptLabel: "a) Prompt", + addRandom: "Add Random", + negativePromptLabel: "b) Negative Prompt", + // Sampling Settings + samplingSettings: "Sampling Settings", + samplingMethod: "a) Sampling Method:", + euler: "Euler", + eulerDescription: "About The Method: Delivers fast, cleaner images with sharper edges, great for stylized portraits and rapid experiments. It's not ideal for extreme prompt accuracy at high CFG. Speed: Fast.", + aboutTheMethod: "About The Method", + speed: "Speed", + samplingSteps: "b) Sampling Steps | Optimal Level: 20–30", + min: "Min: 1", + max: "Max: 150", + optimalLevel: "Optimal Level: 6–9", + cfgScaleLabel: "c) CFG Scale | Optimal Level: 6–9", + // Sizing + sizing: "3. Sizing", + // Output Quantity + outputQuantity: "4. Output Quantity: 4", + batchSizeLabel: "a) Batch Size | Optimal Level: 4–7", + // Seed + seedSection: "5. Seed", + randomizeSeed: "Randomize Seed", + reusePastSeed: "Reuse Past Seed", + generationSeed: "Generation Seed", + random: "Random", + // Advanced Settings + advancedOptionalSettings: "Advanced Optional Settings", + restoreFaces: "Restore Faces", + tilingPatternMode: "Tiling - Pattern Mode", + hiresFixRefinement: "Hires.fix - High-Resolution Refinement", + imageRefiner: "Image Refiner", + // External Extensions + externalExtensions: "External Extensions & Add-ons", + controlNet: "ControlNet v1.1.447+", + // Additional missing strings + enterPromptHere: "Enter your prompt here", + enterNegativePromptHere: "Enter negative prompt here", + seedSettings: "Seed Settings", + resizeMode: "Resize Mode", + justResize: "Just Resize", + cropAndResize: "Crop & Resize", + resizeAndFill: "Resize & Fill", + justResizeLatent: "Just Resize (latent upscale)", + denoisingStrengthLabel: "d) Denoising Strength | Optimal 0.4-0.7" + }, + + // Img2Img + img2img: { + title: "Image to Image Generation", + inputImage: "Input Image", + uploadImage: "Upload Image", + dragAndDrop: "Drag & drop an image here", + fileTypes: "PNG, JPG, WEBP or GIF up to 10MB", + browseFiles: "Browse Files", + tools: "Img2Img Tools", + inpaint: "Inpaint", + inpaintUpload: "Inpaint Upload", + mask: "Mask", + uploadMask: "Upload Mask", + resizeMode: "Resize Mode", + justResize: "Just Resize", + cropAndResize: "Crop and Resize", + fill: "Fill" + }, + + // ControlNet + controlnet: { + title: "ControlNet", + enabled: "ControlNet Enabled", + addUnit: "Add Unit", + removeUnit: "Remove Unit", + unit: "Unit", + model: "ControlNet Model", + preprocessor: "Preprocessor", + inputImage: "Input Image", + strength: "Strength", + guidanceStart: "Guidance Start", + guidanceEnd: "Guidance End", + canny: "Canny", + depth: "Depth", + normal: "Normal", + openpose: "OpenPose", + scribble: "Scribble", + segmentation: "Segmentation" + }, + + // LoRA + lora: { + title: "LoRA", + enabled: "LoRA Enabled", + model: "LoRA Model", + strength: "Strength", + clipStrength: "CLIP Strength", + triggerWord: "Trigger Word" + }, + + // Advanced Settings + advanced: { + title: "Advanced Settings", + vae: "VAE", + clipSkip: "CLIP Skip", + tiling: "Tiling", + tileSize: "Tile Size", + tileOverlap: "Tile Overlap", + hiresFix: "Hires.fix", + hiresFixEnabled: "Enable Hires.fix", + hiresFixUpscaleMethod: "Upscale Method", + hiresFixUpscaleFactor: "Upscale Factor", + hiresFixSteps: "Hires Steps", + hiresFixDenoisingStrength: "Hires Denoising Strength", + upscaleBy: "Upscale By", + resizeTo: "Resize To", + faceRestoration: "Face Restoration", + restoreFaces: "Restore Faces", + faceRestorationModel: "Face Restoration Model", + codeformer: "CodeFormer", + gfpgan: "GFPGAN", + codeformerWeight: "CodeFormer Weight", + gfpganWeight: "GFPGAN Weight", + // Face Restoration + pickFaceRestorationModel: "Pick a Face Restoration Model", + codeformerDescription: "For fixing artistic or stylized portraits where you want faces to look natural and balanced", + gfpganDescription: "For quickly fix distorted or low-quality faces in messy generations.", + moveFaceFixingModel: "Move face fixing model from VRAM into RAM after processing", + // Tiling + tilingPatternMode: "Tiling - Pattern Mode", + tilingDescription: "Tiling allows you to generate seamless patterns by processing the image in tiles. This is useful for creating repeating textures and patterns.", + tileSizeLabel: "Tile Size: 512px", + tileSizeDescription: "Size of each tile. Larger tiles use more memory but may produce better results.", + overlapLabel: "Overlap: 64px", + overlapDescription: "Overlap between tiles. Higher overlap reduces seams but uses more memory.", + tilingTip: "Tip: For seamless patterns, try tile sizes of 512-768px with 64-128px overlap.", + // Hires.fix + hiresFixRefinement: "Hires.fix - High-Resolution Refinement", + setUpscaleSize: "Set Upscale Size:", + upscaleLabel: "Upscale", + upscalingModel: "Upscaling Model", + upscalingModel2: "Upscaling Model #2", + aboutUpscaler: "About The Upscaler: Delivers extreme sharpness, great for textures and fine detail, but may exaggerate edges. Speed: Medium.", + hiresSteps: "Hires Steps | Optimal Level: 10–15", + denoisingStrength: "Denoising Strength | Optimal Accuracy: 0.4–0.6", + // Image Refiner + imageRefiner: "Image Refiner", + imageRefinerDescription: "How it works: The Base Model builds the layout of the image (e.g, shapes, people, and background). Then, the Refiner Model takes over to polish the final details (e.g, sharpening faces, fixing textures, and improving realism).", + checkpointRefinerModel: "Checkpoint - Refiner Model", + switchAt: "Switch at | Optimal Level: 0.8–0.8", + switchAtDescription: "Choose when the image generation switches from the Base Model to the Refiner Model.", + // Extras specific + upscaler2Visibility: "Upscaler 2 visibility | Optimal Level: 0.25", + gfpganVisibility: "GFPGAN visibility | Optimal Level: 0.8", + codeformerVisibility: "CodeFormer visibility | Optimal Level: 0.7", + codeformerWeightLabel: "CodeFormer weight | Optimal Level: 0.2" + }, + + // Model Manager + modelManager: { + title: "Model Manager", + checkpoints: "Checkpoints", + loras: "LoRAs", + controlnets: "ControlNets", + vaes: "VAEs", + upscalers: "Upscalers", + refreshModels: "Refresh Model List", + uploadModel: "Upload Model", + deleteModel: "Delete Model", + modelName: "Model Name", + modelType: "Model Type", + fileSize: "File Size", + lastModified: "Last Modified", + // Model Manager Page + uploadOrganizeManage: "Upload, organize, and manage your AI models", + hideUpload: "Hide Upload", + showUpload: "Show Upload", + uploadNewModel: "Upload New Model", + modelType: "Model Type", + baseModelCheckpoint: "Base Model (Checkpoint)", + brainGeneratesImages: "The 'brain' that generates images", + dropModelFileHere: "Drop your model file here", + orBrowseFiles: "or browse files", + supportsFormats: "Supports: .safetensors, .ckpt, .pth, .pt, .bin", + browseFiles: "Browse Files", + searchModels: "Search models...", + allModels: "All Models", + sort: "Sort:", + type: "Type", + showingModels: "Showing {count} of {total} models", + noModelsFound: "No models found", + uploadCheckpointModel: "Upload a checkpoint model to get started with image generation", + loadingModels: "Loading models...", + tryAdjustingSearch: "Try adjusting your search or filters", + // Additional Model Manager strings + uploadSuccessful: "Upload Successful", + uploadingModel: "Uploading model...", + supports: "Supports:", + filterByType: "Filter by type" + }, + + // Extras + extras: { + title: "Extras", + upscale: "Upscale", + faceRestoration: "Face Restoration", + imageToImage: "Image to Image", + batchFromDirectory: "Batch from Directory", + batchFromDirectoryInput: "Input Directory", + batchFromDirectoryOutput: "Output Directory", + batchFromDirectoryOutputDir: "Output Directory", + batchFromDirectoryOutputDirPlaceholder: "Select output directory...", + // Extras Page + imagePostProcessing: "Image Post-Processing", + singleImage: "Single Image", + upscalingOptions: "Upscaling Options", + processedImageWillDisplay: "Processed image will display here", + processing: "Processing...", + batchOptions: "Batch Options", + inputDirectory: "Input Directory - Batch image processing", + browseBatchFiles: "Browse Batch Files", + specifyFolder: "Specify a folder containing reference images", + batchOperation: "Batch Operation:", + resizeAll: "Resize All", + upscaleAll: "Upscale All", + convertFormat: "Convert Format", + enhanceAll: "Enhance All", + clickGenerateToProcess: "Click Generate to process the image", + // Extras specific strings + dragAndDropImageHere: "Drag & drop an image here or click to browse", + fileTypesSupported: "PNG, JPG, WEBP or GIF up to 10MB", + setUpscaleSize: "a) Set Upscale Size:", + upscaleBy: "Upscale by", + resizeTo: "Resize to", + upscale: "Upscale", + upscalingModel1: "b) Upscaling Model #1", + upscalingModel2: "c) Upscaling Model #2", + aboutTheUpscaler: "About The Upscaler:", + upscalerDescription: "Delivers extreme sharpness, great for textures and fine detail, but may exaggerate edges. Speed: Medium.", + upscaler2Visibility: "d) Upscaler 2 visibility | Optimal Level: 0.25", + gfpganVisibility: "e) GFPGAN visibility | Optimal Level: 0.8", + codeformerVisibility: "f) CodeFormer visibility | Optimal Level: 0.7", + codeformerWeight: "g) CodeFormer weight | Optimal Level: 0.2" + }, + + // PNG Info + pnginfo: { + title: "PNG Info", + uploadImage: "Upload Image to Extract Info", + extractedInfo: "Extracted Information", + parameters: "Parameters", + metadata: "Metadata", + noInfoFound: "No information found in image", + pngInfoExtraction: "PNG Info Extraction", + extractInfo: "Extract Info", + imageUpload: "Image Upload", + dragDropPng: "Drag & drop a PNG image here or click to browse", + onlyPngWithData: "Only PNG images with embedded generation data will provide full information", + browseFiles: "Browse Files", + prompt: "Prompt:", + promptInfoWillAppear: "Prompt information will appear here...", + negativePrompt: "Negative Prompt:", + negativePromptInfoWillAppear: "Negative prompt information will appear here...", + generationSettings: "Generation Settings:", + settingsInfoWillAppear: "Settings information will appear here...", + copyToClipboard: "Copy to Clipboard", + sendToTxt2Img: "Send to Txt2Img", + sendToImg2Img: "Send to Img2Img" + }, + + // Configurations + configurations: { + title: "Configurations", + general: "General", + generation: "Generation", + interface: "Interface", + saving: "Saving", + outputDirectory: "Output Directory", + modelsDirectory: "Models Directory", + autoSaveSettings: "Auto-save Settings", + saveGenerationInfo: "Save Generation Info", + saveGrid: "Save Grid", + saveIndividualImages: "Save Individual Images", + gridFormat: "Grid Format", + individualFormat: "Individual Format", + png: "PNG", + jpg: "JPG", + webp: "WebP", + // Configurations Page + systemConfigurations: "System Configurations", + saveSettings: "Save Settings", + uiSettings: "UI Settings", + uiTheme: "UI Theme:", + systemDefault: "System Default", + showQuickSettings: "Show quick settings", + showProgressInTitle: "Show progress in title", + pathsAndSaving: "Paths & Saving", + outputDirectoryLabel: "Output Directory:", + modelsDirectoryLabel: "Models Directory:", + controlNetModelsPath: "ControlNet Models Path:", + upscalerModelsPath: "Upscaler Models Path:", + vaeModelsPath: "VAE Models Path:", + loraEmbeddingsPath: "LoRA / Embeddings Path:", + filenameFormat: "Filename Format:", + filenameFormatPlaceholder: "paste the path if it is outside project root", + filenameVariables: "Variables: [seed], [model_name], [prompt_words], [width], [height], [steps], [date], [time]", + saveGenerationParameters: "Save generation parameters as metadata", + updatesAndInstallation: "Updates & Installation", + currentVersion: "Current Version: v1.2.3", + lastChecked: "Last checked: 4 hours ago", + checkForUpdates: "Check for Updates", + enableAutomaticUpdates: "Enable automatic updates", + browse: "Browse", + performanceAndResources: "Performance & Resources", + primaryComputeDevice: "Primary Compute Device:", + nvidiaGpuCuda: "NVIDIA GPU (CUDA)", + amdGpuRocm: "AMD GPU (ROCm)", + appleSiliconMps: "Apple Silicon (MPS)", + cpu: "CPU", + vramUsageTarget: "VRAM Usage Target (%)", + lowerToReduceMemory: "| Lower to reduce memory usage", + parallelProcessing: "Parallel Processing", + higherValuesUseMoreGpu: "| Higher values use more GPU memory", + useXformers: "Use xFormers memory efficient attention", + optimizeForMediumLowVram: "Optimize for medium-low VRAM usage", + language: "Language:", + lightMode: "Light Mode", + darkMode: "Dark Mode" + }, + + // Gallery + gallery: { + title: "Gallery", + noImages: "No images generated yet", + clearGallery: "Clear Gallery", + downloadImage: "Download Image", + copyPrompt: "Copy Prompt", + copySettings: "Copy Settings", + deleteImage: "Delete Image" + }, + + // Theme + theme: { + light: "Light", + dark: "Dark", + system: "System" + }, + + // Language + language: { + english: "English", + french: "Français" + } +}; diff --git a/dream_layer_frontend/src/i18n/fr.js b/dream_layer_frontend/src/i18n/fr.js new file mode 100644 index 00000000..2a483d28 --- /dev/null +++ b/dream_layer_frontend/src/i18n/fr.js @@ -0,0 +1,431 @@ +export const fr = { + // Navigation + nav: { + dreamLayerAI: "DreamLayer IA", + txt2img: "Texte vers Image", + img2img: "Image vers Image", + extras: "Extras", + models: "Modèles", + pnginfo: "Info PNG", + configurations: "Configurations" + }, + + // Common + common: { + generate: "Générer", + generateImage: "Générer l'Image", + saveSettings: "Sauvegarder les Paramètres", + refresh: "Actualiser", + clear: "Effacer", + cancel: "Annuler", + confirm: "Confirmer", + apply: "Appliquer", + reset: "Réinitialiser", + close: "Fermer", + open: "Ouvrir", + enabled: "Activé", + disabled: "Désactivé", + loading: "Chargement...", + error: "Erreur", + success: "Succès", + warning: "Avertissement", + info: "Information", + manual: "Manuel", + interrupt: "Interrompre" + }, + + // Generation Modules + generation: { + title: "Modules de Génération", + generation: "Génération", + customWorkflow: "Workflow Personnalisé", + lora: "LoRA", + customWorkflowManagement: "Gestion de Workflow Personnalisé", + loraBrowser: "Navigateur LoRA", + coreGenerationSettings: "Paramètres de Génération Principaux" + }, + + // Txt2Img + txt2img: { + title: "Génération de Texte vers Image", + prompt: "Prompt", + negativePrompt: "Prompt Négatif", + promptPlaceholder: "Entrez votre prompt ici...", + negativePromptPlaceholder: "Entrez le prompt négatif ici...", + model: "Modèle", + sampler: "Échantillonneur", + scheduler: "Planificateur", + steps: "Étapes", + cfgScale: "Échelle CFG", + width: "Largeur", + height: "Hauteur", + batchSize: "Taille du Lot", + batchCount: "Nombre de Lots", + seed: "Graine", + randomSeed: "Graine Aléatoire", + denoisingStrength: "Force de Débruitage", + // Model Selection + selectCheckpoint: "Sélectionner le Point de Contrôle Stable Diffusion :", + auto: "Auto", + selectModel: "Sélectionner un modèle", + noModelsFound: "Aucun modèle trouvé. Essayez de télécharger un nouveau fichier de modèle.", + addApiKey: "Ajouter une CLÉ API", + refreshModels: "Actualiser les Modèles", + // Generation Settings + generationSettings: "Paramètres de Génération", + generateImage: "Générer l'Image", + // Core Generation Settings + coreGenerationSettings: "Paramètres de Génération Principaux", + promptInput: "Saisie de Prompt", + copyPrompts: "Copier les Prompts", + promptLabel: "a) Prompt", + addRandom: "Ajouter Aléatoire", + negativePromptLabel: "b) Prompt Négatif", + // Sampling Settings + samplingSettings: "Paramètres d'Échantillonnage", + samplingMethod: "a) Méthode d'Échantillonnage :", + euler: "Euler", + eulerDescription: "À propos de la Méthode : Fournit des images rapides et plus propres avec des bords plus nets, excellent pour les portraits stylisés et les expériences rapides. Ce n'est pas idéal pour une précision extrême du prompt à CFG élevé. Vitesse : Rapide.", + aboutTheMethod: "À propos de la Méthode", + speed: "Vitesse", + samplingSteps: "b) Étapes d'Échantillonnage | Niveau Optimal : 20–30", + min: "Min : 1", + max: "Max : 150", + optimalLevel: "Niveau Optimal : 6–9", + cfgScaleLabel: "c) Échelle CFG | Niveau Optimal : 6–9", + // Sizing + sizing: "3. Dimensions", + // Output Quantity + outputQuantity: "4. Quantité de Sortie : 4", + batchSizeLabel: "a) Taille du Lot | Niveau Optimal : 4–7", + // Seed + seedSection: "5. Graine", + randomizeSeed: "Randomiser la Graine", + reusePastSeed: "Réutiliser la Graine Précédente", + generationSeed: "Graine de Génération", + random: "Aléatoire", + // Advanced Settings + advancedOptionalSettings: "Paramètres Avancés Optionnels", + restoreFaces: "Restaurer les Visages", + tilingPatternMode: "Mosaïque - Mode Motif", + hiresFixRefinement: "Hires.fix - Raffinement Haute Résolution", + imageRefiner: "Raffineur d'Image", + // External Extensions + externalExtensions: "Extensions Externes et Add-ons", + controlNet: "ControlNet v1.1.447+", + // Additional missing strings + enterPromptHere: "Entrez votre prompt ici", + enterNegativePromptHere: "Entrez le prompt négatif ici", + seedSettings: "Paramètres de Graine", + resizeMode: "Mode de Redimensionnement", + justResize: "Redimensionner Seulement", + cropAndResize: "Recadrer et Redimensionner", + resizeAndFill: "Redimensionner et Remplir", + justResizeLatent: "Redimensionner Seulement (agrandissement latent)", + denoisingStrengthLabel: "d) Force de Débruitage | Optimal 0.4-0.7" + }, + + // Img2Img + img2img: { + title: "Génération d'Image vers Image", + inputImage: "Image d'Entrée", + uploadImage: "Télécharger l'Image", + dragAndDrop: "Glissez et déposez une image ici", + fileTypes: "PNG, JPG, WEBP ou GIF jusqu'à 10MB", + browseFiles: "Parcourir les Fichiers", + tools: "Outils Img2Img", + inpaint: "Inpainting", + inpaintUpload: "Téléchargement Inpainting", + mask: "Masque", + uploadMask: "Télécharger le Masque", + resizeMode: "Mode de Redimensionnement", + justResize: "Redimensionner Seulement", + cropAndResize: "Recadrer et Redimensionner", + fill: "Remplir" + }, + + // ControlNet + controlnet: { + title: "ControlNet", + enabled: "ControlNet Activé", + addUnit: "Ajouter une Unité", + removeUnit: "Supprimer l'Unité", + unit: "Unité", + model: "Modèle ControlNet", + preprocessor: "Préprocesseur", + inputImage: "Image d'Entrée", + strength: "Force", + guidanceStart: "Début de Guidage", + guidanceEnd: "Fin de Guidage", + canny: "Canny", + depth: "Profondeur", + normal: "Normal", + openpose: "OpenPose", + scribble: "Gribouillage", + segmentation: "Segmentation" + }, + + // LoRA + lora: { + title: "LoRA", + enabled: "LoRA Activé", + model: "Modèle LoRA", + strength: "Force", + clipStrength: "Force CLIP", + triggerWord: "Mot Déclencheur" + }, + + // Advanced Settings + advanced: { + title: "Paramètres Avancés", + vae: "VAE", + clipSkip: "Saut CLIP", + tiling: "Mosaïque", + tileSize: "Taille de Tuile", + tileOverlap: "Chevauchement de Tuiles", + hiresFix: "Correction Haute Résolution", + hiresFixEnabled: "Activer la Correction Haute Résolution", + hiresFixUpscaleMethod: "Méthode d'Agrandissement", + hiresFixUpscaleFactor: "Facteur d'Agrandissement", + hiresFixSteps: "Étapes Haute Résolution", + hiresFixDenoisingStrength: "Force de Débruitage Haute Résolution", + upscaleBy: "Agrandir Par", + resizeTo: "Redimensionner Vers", + faceRestoration: "Restauration de Visage", + restoreFaces: "Restaurer les Visages", + faceRestorationModel: "Modèle de Restauration de Visage", + codeformer: "CodeFormer", + gfpgan: "GFPGAN", + codeformerWeight: "Poids CodeFormer", + gfpganWeight: "Poids GFPGAN", + // Face Restoration + pickFaceRestorationModel: "Choisir un Modèle de Restauration de Visage", + codeformerDescription: "Pour corriger les portraits artistiques ou stylisés où vous voulez que les visages paraissent naturels et équilibrés", + gfpganDescription: "Pour corriger rapidement les visages déformés ou de mauvaise qualité dans les générations désordonnées.", + moveFaceFixingModel: "Déplacer le modèle de correction de visage de la VRAM vers la RAM après traitement", + // Tiling + tilingPatternMode: "Mosaïque - Mode Motif", + tilingDescription: "La mosaïque vous permet de générer des motifs sans couture en traitant l'image en tuiles. C'est utile pour créer des textures et motifs répétitifs.", + tileSizeLabel: "Taille de Tuile: 512px", + tileSizeDescription: "Taille de chaque tuile. Les tuiles plus grandes utilisent plus de mémoire mais peuvent produire de meilleurs résultats.", + overlapLabel: "Chevauchement: 64px", + overlapDescription: "Chevauchement entre les tuiles. Un chevauchement plus élevé réduit les coutures mais utilise plus de mémoire.", + tilingTip: "Conseil: Pour des motifs sans couture, essayez des tailles de tuiles de 512-768px avec un chevauchement de 64-128px.", + // Hires.fix + hiresFixRefinement: "Hires.fix - Raffinement Haute Résolution", + setUpscaleSize: "Définir la Taille d'Agrandissement:", + upscaleLabel: "Agrandir", + upscalingModel: "Modèle d'Agrandissement", + upscalingModel2: "Modèle d'Agrandissement #2", + aboutUpscaler: "À propos de l'Agrandisseur: Fournit une netteté extrême, excellent pour les textures et les détails fins, mais peut exagérer les bords. Vitesse: Moyenne.", + hiresSteps: "Étapes Hires | Niveau Optimal: 10–15", + denoisingStrength: "Force de Débruitage | Précision Optimale: 0.4–0.6", + // Image Refiner + imageRefiner: "Raffineur d'Image", + imageRefinerDescription: "Comment ça fonctionne: Le Modèle de Base construit la disposition de l'image (ex: formes, personnes et arrière-plan). Ensuite, le Modèle Raffineur prend le relais pour polir les détails finaux (ex: affiner les visages, corriger les textures et améliorer le réalisme).", + checkpointRefinerModel: "Point de Contrôle - Modèle Raffineur", + switchAt: "Basculer à | Niveau Optimal: 0.8–0.8", + switchAtDescription: "Choisissez quand la génération d'image bascule du Modèle de Base vers le Modèle Raffineur.", + // Extras specific + upscaler2Visibility: "Visibilité Agrandisseur 2 | Niveau Optimal: 0.25", + gfpganVisibility: "Visibilité GFPGAN | Niveau Optimal: 0.8", + codeformerVisibility: "Visibilité CodeFormer | Niveau Optimal: 0.7", + codeformerWeightLabel: "Poids CodeFormer | Niveau Optimal: 0.2" + }, + + // Model Manager + modelManager: { + title: "Gestionnaire de Modèles", + checkpoints: "Points de Contrôle", + loras: "LoRAs", + controlnets: "ControlNets", + vaes: "VAEs", + upscalers: "Agrandisseurs", + refreshModels: "Actualiser la Liste des Modèles", + uploadModel: "Télécharger un Modèle", + deleteModel: "Supprimer le Modèle", + modelName: "Nom du Modèle", + modelType: "Type de Modèle", + fileSize: "Taille du Fichier", + lastModified: "Dernière Modification", + // Model Manager Page + uploadOrganizeManage: "Télécharger, organiser et gérer vos modèles IA", + hideUpload: "Masquer le Téléchargement", + showUpload: "Afficher le Téléchargement", + uploadNewModel: "Télécharger un Nouveau Modèle", + modelType: "Type de Modèle", + baseModelCheckpoint: "Modèle de Base (Point de Contrôle)", + brainGeneratesImages: "Le 'cerveau' qui génère les images", + dropModelFileHere: "Déposez votre fichier de modèle ici", + orBrowseFiles: "ou parcourir les fichiers", + supportsFormats: "Supporte: .safetensors, .ckpt, .pth, .pt, .bin", + browseFiles: "Parcourir les Fichiers", + searchModels: "Rechercher des modèles...", + allModels: "Tous les Modèles", + sort: "Trier:", + type: "Type", + showingModels: "Affichage de {count} sur {total} modèles", + noModelsFound: "Aucun modèle trouvé", + uploadCheckpointModel: "Téléchargez un modèle de point de contrôle pour commencer la génération d'images", + loadingModels: "Chargement des modèles...", + tryAdjustingSearch: "Essayez d'ajuster votre recherche ou vos filtres", + // Additional Model Manager strings + uploadSuccessful: "Téléchargement réussi", + uploadingModel: "Téléchargement du modèle...", + supports: "Supporte :", + filterByType: "Filtrer par type" + }, + + // Extras + extras: { + title: "Extras", + upscale: "Agrandir", + faceRestoration: "Restauration de Visage", + imageToImage: "Image vers Image", + batchFromDirectory: "Lot depuis le Répertoire", + batchFromDirectoryInput: "Répertoire d'Entrée", + batchFromDirectoryOutput: "Répertoire de Sortie", + batchFromDirectoryOutputDir: "Répertoire de Sortie", + batchFromDirectoryOutputDirPlaceholder: "Sélectionner le répertoire de sortie...", + // Extras Page + imagePostProcessing: "Post-Traitement d'Image", + singleImage: "Image Unique", + upscalingOptions: "Options d'Agrandissement", + processedImageWillDisplay: "L'image traitée s'affichera ici", + processing: "Traitement...", + batchOptions: "Options de Lot", + inputDirectory: "Répertoire d'Entrée - Traitement d'images par lot", + browseBatchFiles: "Parcourir les Fichiers de Lot", + specifyFolder: "Spécifier un dossier contenant des images de référence", + batchOperation: "Opération de Lot:", + resizeAll: "Redimensionner Tout", + upscaleAll: "Agrandir Tout", + convertFormat: "Convertir Format", + enhanceAll: "Améliorer Tout", + clickGenerateToProcess: "Cliquez sur Générer pour traiter l'image", + // Extras specific strings + dragAndDropImageHere: "Glissez et déposez une image ici ou cliquez pour parcourir", + fileTypesSupported: "PNG, JPG, WEBP ou GIF jusqu'à 10MB", + setUpscaleSize: "a) Définir la taille d'agrandissement :", + upscaleBy: "Agrandir par", + resizeTo: "Redimensionner à", + upscale: "Agrandir", + upscalingModel1: "b) Modèle d'agrandissement #1", + upscalingModel2: "c) Modèle d'agrandissement #2", + aboutTheUpscaler: "À propos de l'agrandisseur :", + upscalerDescription: "Offre une netteté extrême, idéal pour les textures et les détails fins, mais peut exagérer les bords. Vitesse : Moyenne.", + upscaler2Visibility: "d) Visibilité de l'agrandisseur 2 | Niveau optimal : 0,25", + gfpganVisibility: "e) Visibilité GFPGAN | Niveau optimal : 0,8", + codeformerVisibility: "f) Visibilité CodeFormer | Niveau optimal : 0,7", + codeformerWeight: "g) Poids CodeFormer | Niveau optimal : 0,2" + }, + + // PNG Info + pnginfo: { + title: "Info PNG", + uploadImage: "Télécharger l'Image pour Extraire les Infos", + extractedInfo: "Informations Extraites", + parameters: "Paramètres", + metadata: "Métadonnées", + noInfoFound: "Aucune information trouvée dans l'image", + pngInfoExtraction: "Extraction d'Informations PNG", + extractInfo: "Extraire les Infos", + imageUpload: "Téléchargement d'Image", + dragDropPng: "Glissez-déposez une image PNG ici ou cliquez pour parcourir", + onlyPngWithData: "Seules les images PNG avec des données de génération intégrées fourniront des informations complètes", + browseFiles: "Parcourir les Fichiers", + prompt: "Prompt:", + promptInfoWillAppear: "Les informations de prompt apparaîtront ici...", + negativePrompt: "Prompt Négatif:", + negativePromptInfoWillAppear: "Les informations de prompt négatif apparaîtront ici...", + generationSettings: "Paramètres de Génération:", + settingsInfoWillAppear: "Les informations de paramètres apparaîtront ici...", + copyToClipboard: "Copier dans le Presse-papiers", + sendToTxt2Img: "Envoyer vers Txt2Img", + sendToImg2Img: "Envoyer vers Img2Img" + }, + + // Configurations + configurations: { + title: "Configurations", + general: "Général", + generation: "Génération", + interface: "Interface", + saving: "Sauvegarde", + outputDirectory: "Répertoire de Sortie", + modelsDirectory: "Répertoire des Modèles", + autoSaveSettings: "Sauvegarde Automatique des Paramètres", + saveGenerationInfo: "Sauvegarder les Infos de Génération", + saveGrid: "Sauvegarder la Grille", + saveIndividualImages: "Sauvegarder les Images Individuelles", + gridFormat: "Format de Grille", + individualFormat: "Format Individuel", + png: "PNG", + jpg: "JPG", + webp: "WebP", + // Configurations Page + systemConfigurations: "Configurations Système", + saveSettings: "Sauvegarder les Paramètres", + uiSettings: "Paramètres d'Interface", + uiTheme: "Thème d'Interface:", + systemDefault: "Par Défaut du Système", + showQuickSettings: "Afficher les paramètres rapides", + showProgressInTitle: "Afficher le progrès dans le titre", + pathsAndSaving: "Chemins et Sauvegarde", + outputDirectoryLabel: "Répertoire de Sortie:", + modelsDirectoryLabel: "Répertoire des Modèles:", + controlNetModelsPath: "Chemin des Modèles ControlNet:", + upscalerModelsPath: "Chemin des Modèles d'Agrandissement:", + vaeModelsPath: "Chemin des Modèles VAE:", + loraEmbeddingsPath: "Chemin LoRA / Intégrations:", + filenameFormat: "Format de Nom de Fichier:", + filenameFormatPlaceholder: "collez le chemin s'il est en dehors de la racine du projet", + filenameVariables: "Variables: [seed], [model_name], [prompt_words], [width], [height], [steps], [date], [time]", + saveGenerationParameters: "Sauvegarder les paramètres de génération comme métadonnées", + updatesAndInstallation: "Mises à Jour et Installation", + currentVersion: "Version Actuelle: v1.2.3", + lastChecked: "Dernière vérification: il y a 4 heures", + checkForUpdates: "Vérifier les Mises à Jour", + enableAutomaticUpdates: "Activer les mises à jour automatiques", + browse: "Parcourir", + performanceAndResources: "Performance et Ressources", + primaryComputeDevice: "Dispositif de Calcul Principal:", + nvidiaGpuCuda: "GPU NVIDIA (CUDA)", + amdGpuRocm: "GPU AMD (ROCm)", + appleSiliconMps: "Silicon Apple (MPS)", + cpu: "CPU", + vramUsageTarget: "Cible d'Utilisation VRAM (%)", + lowerToReduceMemory: "| Plus bas pour réduire l'utilisation mémoire", + parallelProcessing: "Traitement Parallèle", + higherValuesUseMoreGpu: "| Des valeurs plus élevées utilisent plus de mémoire GPU", + useXformers: "Utiliser l'attention efficace en mémoire xFormers", + optimizeForMediumLowVram: "Optimiser pour une utilisation VRAM moyenne-faible", + language: "Langue:", + lightMode: "Mode Clair", + darkMode: "Mode Sombre" + }, + + // Gallery + gallery: { + title: "Galerie", + noImages: "Aucune image générée pour le moment", + clearGallery: "Vider la Galerie", + downloadImage: "Télécharger l'Image", + copyPrompt: "Copier le Prompt", + copySettings: "Copier les Paramètres", + deleteImage: "Supprimer l'Image" + }, + + // Theme + theme: { + light: "Clair", + dark: "Sombre", + system: "Système" + }, + + // Language + language: { + english: "English", + french: "Français" + } +}; diff --git a/dream_layer_frontend/src/i18n/i18nContext.tsx b/dream_layer_frontend/src/i18n/i18nContext.tsx new file mode 100644 index 00000000..71ee2905 --- /dev/null +++ b/dream_layer_frontend/src/i18n/i18nContext.tsx @@ -0,0 +1,96 @@ +import React, { createContext, useContext, useState, ReactNode } from 'react'; +import { en } from './en'; +import { fr } from './fr'; + +// Define the translation structure type +type TranslationKeys = typeof en; + +// Available languages +const languages = { + en: { name: 'English', flag: '🇺🇸' }, + fr: { name: 'Français', flag: '🇫🇷' } +} as const; + +type LanguageCode = keyof typeof languages; + +// Context interface +interface I18nContextType { + language: LanguageCode; + setLanguage: (lang: LanguageCode) => void; + t: (key: string) => string; + availableLanguages: typeof languages; +} + +// Create the context +const I18nContext = createContext(undefined); + +// Translation function that handles nested keys +const getNestedValue = (obj: any, key: string): string => { + const keys = key.split('.'); + let value = obj; + + for (const k of keys) { + if (value && typeof value === 'object' && k in value) { + value = value[k]; + } else { + // Fallback to English if key not found + const fallbackValue = getNestedValue(en, key); + if (fallbackValue && typeof fallbackValue === 'object' && k in fallbackValue) { + value = fallbackValue[k]; + } else { + return key; // Return the key if not found anywhere + } + } + } + + return typeof value === 'string' ? value : key; +}; + +// Provider component +interface I18nProviderProps { + children: ReactNode; +} + +export const I18nProvider: React.FC = ({ children }) => { + const [language, setLanguage] = useState('en'); + + const translations: Record = { + en, + fr + }; + + const t = (key: string): string => { + const currentTranslations = translations[language]; + const value = getNestedValue(currentTranslations, key); + + // If the value is the same as the key, try English as fallback + if (value === key && language !== 'en') { + const fallbackValue = getNestedValue(translations.en, key); + return typeof fallbackValue === 'string' ? fallbackValue : key; + } + + return value; + }; + + const value: I18nContextType = { + language, + setLanguage, + t, + availableLanguages: languages + }; + + return ( + + {children} + + ); +}; + +// Hook to use the i18n context +export const useI18n = (): I18nContextType => { + const context = useContext(I18nContext); + if (context === undefined) { + throw new Error('useI18n must be used within an I18nProvider'); + } + return context; +}; diff --git a/dream_layer_frontend/src/i18n/index.ts b/dream_layer_frontend/src/i18n/index.ts new file mode 100644 index 00000000..183f9551 --- /dev/null +++ b/dream_layer_frontend/src/i18n/index.ts @@ -0,0 +1,3 @@ +export { I18nProvider, useI18n } from './i18nContext'; +export { en } from './en'; +export { fr } from './fr';