Skip to content

[feature] Add script to auto-generate test-translation.json from .po files#1084

Open
Kiru6413 wants to merge 13 commits into
openwisp:masterfrom
Kiru6413:kiruthiga_fix_generateTranslations
Open

[feature] Add script to auto-generate test-translation.json from .po files#1084
Kiru6413 wants to merge 13 commits into
openwisp:masterfrom
Kiru6413:kiruthiga_fix_generateTranslations

Conversation

@Kiru6413
Copy link
Copy Markdown

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.

Kiru6413 added 13 commits March 29, 2026 10:20
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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Warning

Rate limit exceeded

@Kiru6413 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 38 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fe236822-86fe-4cbc-9460-da58c698fae9

📥 Commits

Reviewing files that changed from the base of the PR and between 02266a9 and 9947d3b.

📒 Files selected for processing (2)
  • PR_DESCRIPTION.md
  • scripts/generateTranslations.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openwisp-companion
Copy link
Copy Markdown

Commit Message Format Failure

Hello @Kiru6413,
(Analysis for commit 9947d3b)

The commit message does not follow the required format.

Fix:
Please reformat your commit message according to the OpenWISP conventions. A correct example is:

[tag] Capitalized short title #<issue>

<description>

Fixes #<issue>

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.

1 participant