i18n-node icon indicating copy to clipboard operation
i18n-node copied to clipboard

Fix: multiple locale handling issues and add JSON validation (#387, #344, #501, #522, #378)

Open Kofacts opened this issue 1 month ago • 2 comments

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.

Kofacts avatar Nov 08 '25 20:11 Kofacts

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:

codecov-commenter avatar Nov 09 '25 10:11 codecov-commenter

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?

mashpie avatar Nov 21 '25 08:11 mashpie