Skip to content

fix: resolve ReferenceError for undefined lang in loader.js#5268

Closed
Rohit-rk07 wants to merge 3 commits intosugarlabs:masterfrom
Rohit-rk07:fix/5197-lang-undefined
Closed

fix: resolve ReferenceError for undefined lang in loader.js#5268
Rohit-rk07 wants to merge 3 commits intosugarlabs:masterfrom
Rohit-rk07:fix/5197-lang-undefined

Conversation

@Rohit-rk07
Copy link
Contributor

@Rohit-rk07 Rohit-rk07 commented Jan 20, 2026

Fix: ReferenceError - lang is not defined in loader.js

Fixes #5197

Changes

  • Fixed typo in RequireJS paths: twewntween
  • Refactored i18n initialization to remove redundant changeLanguage() call
  • Consolidated lang variable inside main() function
  • Language is now set during initialization via lng parameter
  • Updated tests to reflect new implementation

Benefits

  • ✅ Eliminates ReferenceError: lang is not defined error
  • ✅ Prevents unnecessary duplicate DOM updates
  • ✅ Clearer bootstrap flow

Testing

  • Jest tests: ✅ All 5 tests passing
  • Loader initialization: ✅ Complete coverage (100%)
  • DOM updates: ✅ Verified
  • Language change events: ✅ Verified

@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

loader.test.js

- Fix typo: twewn -> tween in RequireJS paths
- Refactor i18n initialization flow
- Remove redundant language change logic
- Consolidate lang variable inside main() function
- Update tests to match new implementation

Fixes sugarlabs#5197
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@Rohit-rk07
Copy link
Contributor Author

@omsuneri @haroon10725 @walterbender Plz review the chnages.

@vanshika2720
Copy link
Contributor

@Rohit-rk07 removing changeLanguage() and deleting its related tests goes beyond the minimal fix. Please confirm this behavioral change is intentional and does not affect dynamic language switching.

Also resolve merge conflicts.

@Rohit-rk07 Rohit-rk07 closed this Feb 21, 2026
@Rohit-rk07 Rohit-rk07 deleted the fix/5197-lang-undefined branch February 21, 2026 12:27
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.

ReferenceError: lang is not defined in loader.js

2 participants