[feature] Add script to auto-generate test-translation.json from .po files#1084
[feature] Add script to auto-generate test-translation.json from .po files#1084Kiru6413 wants to merge 13 commits into
Conversation
Currently, client/test-translation.json requires manual updates whenever translations change, which can lead to inconsistencies in snapshot tests. This PR adds a new script, generateTranslations.js, that automatically reads the i18n/en.po file and generates the corresponding JSON in client/test-translation.json. The generated JSON includes all msgid entries along with their msgstr values and necessary headers for proper test handling. With this script, developers no longer need to manually update test-translation.json. It ensures that snapshot tests always have up-to-date translations, reducing maintenance overhead and minimizing inconsistencies. Usage: node generateTranslations.js Next steps could include integrating this script with the test runner to automatically populate test-translation.json before tests are executed.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 7 minutes and 38 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Commit Message Format FailureHello @Kiru6413, The commit message does not follow the required format. Fix: |
Checklist
[X] I have read the OpenWISP Contributing Guidelines
.
[X]I have manually tested the changes proposed in this pull request.
[X]I have written new test cases for new code and/or updated existing tests for changes to existing code.
[X]I have updated the documentation.
Reference to Existing Issue
Description of Changes
This pull request fixes the generateTranslations.js script by:
Removing merge conflict markers that caused syntax errors.
Resolving duplicate parseQuoted function declarations.
Cleaning up parsing logic for msgid and msgstr entries, including multiline strings.
Ensuring the script generates client/test-translation.json correctly.
Improving error messages with line numbers for easier debugging.
These changes ensure smooth translation JSON generation without syntax or runtime errors.
Screenshot
No UI changes; script-only functionality.