feat(i18n): add multilingual platform descriptions and HostWizard demo data
Some checks failed
Some checks failed
- Add description_translations JSON column to Platform model + migration - Add language tabs to platform admin edit form for multilingual descriptions - Update API schemas to include description_translations in request/response - Translate pricing section UI labels via _t() macro (monthly/annual/CTA/etc.) - Add Luxembourgish (lb) support to all platforms (OMS, Main, Loyalty, Hosting) - Seed description_translations, contact emails, and social links for all platforms - Add LuxWeb Agency demo merchant with hosting stores, team, and content pages - Fix language code typo: lu → lb in platform-edit.js availableLanguages - Fix store content pages to use correct primary platform instead of hardcoded OMS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,10 +22,20 @@ function platformEdit() {
|
||||
success: null,
|
||||
platformCode: null,
|
||||
|
||||
// Language editing
|
||||
currentLang: 'fr',
|
||||
languageNames: {
|
||||
fr: 'Fran\u00e7ais',
|
||||
de: 'Deutsch',
|
||||
en: 'English',
|
||||
lb: 'L\u00ebtzebuergesch',
|
||||
},
|
||||
|
||||
// Form data
|
||||
formData: {
|
||||
name: '',
|
||||
description: '',
|
||||
description_translations: {},
|
||||
domain: '',
|
||||
path_prefix: '',
|
||||
logo: '',
|
||||
@@ -46,7 +56,7 @@ function platformEdit() {
|
||||
{ code: 'fr', name: 'French' },
|
||||
{ code: 'de', name: 'German' },
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'lu', name: 'Luxembourgish' },
|
||||
{ code: 'lb', name: 'Luxembourgish' },
|
||||
],
|
||||
|
||||
// Lifecycle
|
||||
@@ -92,23 +102,34 @@ function platformEdit() {
|
||||
const response = await apiClient.get(`/admin/platforms/${this.platformCode}`);
|
||||
this.platform = response;
|
||||
|
||||
// Build description_translations with empty strings for all supported languages
|
||||
const langs = response.supported_languages || ['fr', 'de', 'en'];
|
||||
const descTranslations = {};
|
||||
for (const lang of langs) {
|
||||
descTranslations[lang] = (response.description_translations && response.description_translations[lang]) || '';
|
||||
}
|
||||
|
||||
// Populate form data
|
||||
this.formData = {
|
||||
name: response.name || '',
|
||||
description: response.description || '',
|
||||
description_translations: descTranslations,
|
||||
domain: response.domain || '',
|
||||
path_prefix: response.path_prefix || '',
|
||||
logo: response.logo || '',
|
||||
logo_dark: response.logo_dark || '',
|
||||
favicon: response.favicon || '',
|
||||
default_language: response.default_language || 'fr',
|
||||
supported_languages: response.supported_languages || ['fr', 'de', 'en'],
|
||||
supported_languages: langs,
|
||||
is_active: response.is_active ?? true,
|
||||
is_public: response.is_public ?? true,
|
||||
theme_config: response.theme_config || {},
|
||||
settings: response.settings || {},
|
||||
};
|
||||
|
||||
// Set current language tab to default language
|
||||
this.currentLang = response.default_language || 'fr';
|
||||
|
||||
platformEditLog.info(`Loaded platform: ${this.platformCode}`);
|
||||
} catch (err) {
|
||||
platformEditLog.error('Error loading platform:', err);
|
||||
@@ -126,9 +147,14 @@ function platformEdit() {
|
||||
|
||||
try {
|
||||
// Build update payload (only changed fields)
|
||||
// Sync base description from default language translation
|
||||
const defaultLang = this.formData.default_language || 'fr';
|
||||
const baseDesc = this.formData.description_translations[defaultLang] || this.formData.description;
|
||||
|
||||
const payload = {
|
||||
name: this.formData.name,
|
||||
description: this.formData.description || null,
|
||||
description: baseDesc || null,
|
||||
description_translations: this.formData.description_translations,
|
||||
domain: this.formData.domain || null,
|
||||
path_prefix: this.formData.path_prefix || null,
|
||||
logo: this.formData.logo || null,
|
||||
@@ -199,9 +225,17 @@ function platformEdit() {
|
||||
// Don't allow removing the last language
|
||||
if (this.formData.supported_languages.length > 1) {
|
||||
this.formData.supported_languages.splice(index, 1);
|
||||
// Switch tab if the removed language was active
|
||||
if (this.currentLang === code) {
|
||||
this.currentLang = this.formData.supported_languages[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.formData.supported_languages.push(code);
|
||||
// Initialize empty translation for new language
|
||||
if (!this.formData.description_translations[code]) {
|
||||
this.formData.description_translations[code] = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user