fix: I18n not defined — defer race condition in all base templates
Inline scripts calling I18n.init() ran before the deferred i18n.js
loaded. Wrap in DOMContentLoaded so deferred scripts execute first.
Regression from 8ee8c39 (add defer to scripts).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,10 +113,11 @@
|
||||
<script defer src="{{ url_for('static', path='shared/js/i18n.js') }}"></script>
|
||||
<script>
|
||||
// Initialize i18n with current language and preload modules
|
||||
(async function() {
|
||||
// Wrapped in DOMContentLoaded so deferred i18n.js has loaded
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
const modules = {% block i18n_modules %}[]{% endblock %};
|
||||
await I18n.init('{{ current_language | default("en") }}', modules);
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 5. FIFTH: API Client (depends on Utils) -->
|
||||
|
||||
@@ -72,10 +72,11 @@
|
||||
<script defer src="{{ url_for('static', path='shared/js/i18n.js') }}"></script>
|
||||
<script>
|
||||
// Initialize i18n with dashboard language and preload modules
|
||||
(async function() {
|
||||
// Wrapped in DOMContentLoaded so deferred i18n.js has loaded
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
const modules = {% block i18n_modules %}[]{% endblock %};
|
||||
await I18n.init('{{ dashboard_language | default("en") }}', modules);
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 5. FIFTH: API Client (depends on Utils) -->
|
||||
|
||||
@@ -330,10 +330,11 @@
|
||||
<script defer src="{{ url_for('static', path='shared/js/i18n.js') }}"></script>
|
||||
<script>
|
||||
// Initialize i18n with storefront language and preload modules
|
||||
(async function() {
|
||||
// Wrapped in DOMContentLoaded so deferred i18n.js has loaded
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
const modules = {% block i18n_modules %}[]{% endblock %};
|
||||
await I18n.init('{{ storefront_language | default("en") }}', modules);
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
|
||||
{# 6. API Client #}
|
||||
|
||||
Reference in New Issue
Block a user