chore(i18n): remove verbose debug logging from translation loader
Removed diagnostic console.log statements that were added for troubleshooting service worker cache issues. Retained essential operational logging (translation load confirmations). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f4be262086
commit
97691e3ef4
1 changed files with 1 additions and 13 deletions
|
|
@ -104,12 +104,7 @@ const I18n = {
|
||||||
const pageResponse = await fetch(`/locales/${lang}/${pageName}.json`);
|
const pageResponse = await fetch(`/locales/${lang}/${pageName}.json`);
|
||||||
let pageTranslations = {};
|
let pageTranslations = {};
|
||||||
if (pageResponse.ok) {
|
if (pageResponse.ok) {
|
||||||
const responseText = await pageResponse.text();
|
pageTranslations = await pageResponse.json();
|
||||||
console.log(`[i18n] DEBUG: Fetched ${responseText.length} characters from ${lang}/${pageName}.json`);
|
|
||||||
console.log(`[i18n] DEBUG: Response contains "faqs":`, responseText.includes('"faqs"'));
|
|
||||||
|
|
||||||
pageTranslations = JSON.parse(responseText);
|
|
||||||
console.log(`[i18n] DEBUG: After JSON.parse, pageTranslations has faqs?`, !!pageTranslations.faqs);
|
|
||||||
} else if (pageName !== 'homepage') {
|
} else if (pageName !== 'homepage') {
|
||||||
// If page-specific translations don't exist, that's okay for some pages
|
// If page-specific translations don't exist, that's okay for some pages
|
||||||
console.warn(`[i18n] No translations found for ${lang}/${pageName}, using common only`);
|
console.warn(`[i18n] No translations found for ${lang}/${pageName}, using common only`);
|
||||||
|
|
@ -119,18 +114,11 @@ const I18n = {
|
||||||
|
|
||||||
// Deep merge common and page-specific translations (page-specific takes precedence)
|
// Deep merge common and page-specific translations (page-specific takes precedence)
|
||||||
// Uses deep merge to preserve nested objects like footer in common.json
|
// Uses deep merge to preserve nested objects like footer in common.json
|
||||||
console.log(`[i18n] DEBUG BEFORE MERGE: pageTranslations has faqs?`, !!pageTranslations.faqs, pageTranslations.faqs ? pageTranslations.faqs.length : 0);
|
|
||||||
console.log(`[i18n] DEBUG BEFORE MERGE: pageTranslations keys:`, Object.keys(pageTranslations));
|
|
||||||
|
|
||||||
this.translations = this.deepMerge(commonTranslations, pageTranslations);
|
this.translations = this.deepMerge(commonTranslations, pageTranslations);
|
||||||
|
|
||||||
console.log(`[i18n] DEBUG AFTER MERGE: this.translations has faqs?`, !!this.translations.faqs, this.translations.faqs ? this.translations.faqs.length : 0);
|
|
||||||
console.log(`[i18n] DEBUG AFTER MERGE: this.translations keys:`, Object.keys(this.translations));
|
|
||||||
|
|
||||||
// Expose translations globally for components like interactive-diagram
|
// Expose translations globally for components like interactive-diagram
|
||||||
window.i18nTranslations = this.translations;
|
window.i18nTranslations = this.translations;
|
||||||
console.log(`[i18n] Loaded translations: common + ${pageName}`);
|
console.log(`[i18n] Loaded translations: common + ${pageName}`);
|
||||||
console.log(`[i18n] DEBUG: faqs in window.i18nTranslations?`, !!window.i18nTranslations.faqs, window.i18nTranslations.faqs ? window.i18nTranslations.faqs.length : 0);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[i18n] Error loading translations:`, error);
|
console.error(`[i18n] Error loading translations:`, error);
|
||||||
// Fallback to English if loading fails
|
// Fallback to English if loading fails
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue