Skip to content

Conversation

@ssz2605
Copy link
Contributor

@ssz2605 ssz2605 commented Dec 30, 2025

Description

This PR fixes a runtime ReferenceError caused by an undefined lang variable during i18next initialization.

The application previously called i18next.changeLanguage(lang, ...) without defining lang, which resulted in a console error and interrupted the language initialization flow.

Changes Made

Defined a default language ("en") before calling i18next.changeLanguage

Ensured the language change occurs only after i18next is successfully initialized

Expected Behavior

The application initializes i18next without throwing any runtime errors, and translations load correctly using the default language.

closes #4946

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@ssz2605 ssz2605 force-pushed the fix-i18n-lang-reference branch from 6e333bd to cd77e78 Compare December 30, 2025 10:39
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@ssz2605 ssz2605 force-pushed the fix-i18n-lang-reference branch from cd77e78 to 2eb6ef7 Compare December 30, 2025 10:43
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Fix ReferenceError by defining default language for i18next
@ssz2605 ssz2605 force-pushed the fix-i18n-lang-reference branch from 2eb6ef7 to 3781aaa Compare December 30, 2025 10:53
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@ssz2605
Copy link
Contributor Author

ssz2605 commented Dec 30, 2025

@walterbender I ran npm run lint and npx prettier --check locally and both pass without any issues.

The ESLint failure in CI seems to be related to the workflow trying to lint a file path that doesn’t resolve correctly in the GitHub Actions environment (Linux), not due to a linting or formatting error in this PR’s code.

@walterbender
Copy link
Member

Were you testing from a local server or directly from the file system? I tried the latter with Firefox:

before your change
Screenshot From 2025-12-30 08-48-47

MB launches nonetheless.

after your change
Screenshot From 2025-12-30 08-47-07

MB does not launch

Any ideas?

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@ssz2605
Copy link
Contributor Author

ssz2605 commented Dec 30, 2025

@walterbender Yes I was testing on local server , maybe the issue was that my earlier code made i18next initialization blocking. When locales/en.json failed to load over file://, the promise never resolved, so MB never reached requirejs(["utils/utils", "activity/activity"]). I’ve updated the code so i18next always resolves (errors are logged), restoring the old behavior. Could you please check if MB is opening now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bugfix: Fix ReferenceError caused by undefined lang variable in i18next

2 participants