i18n-node
i18n-node copied to clipboard
Fix: multiple locale handling issues and add JSON validation (#387, #344, #501, #522, #378)
This PR addresses several critical locale handling issues and adds comprehensive JSON validation.
- Fixed undefined/null locale handling in translation APIs to prevent crashes and ensure graceful fallback to default locale (addresses #501).
- Enhanced getCatalog function to handle null parameters gracefully and return consistent results (addresses #522).
- Strengthened fallback logic to ensure missing keys properly use default locale translations (addresses #387, #344).
- Added new validateLocaleFiles method for runtime JSON validation and improved error handling for malformed locale files (addresses #378).
All changes are fully tested with 49 new comprehensive test cases covering edge cases and ensuring no regressions.
Welcome to Codecov :tada:
Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.
Thanks for integrating Codecov - We've got you covered :open_umbrella:
Thanks a lot for this PR! Clean code, perfect tests :) and a good improvement.
One question remains: Didn't you also want to call i18n.validateLocaleFiles on any file loading?