Skip to content

Conversation

@yashwanth535
Copy link

@yashwanth535 yashwanth535 commented Jul 29, 2025

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #902

Please open a new issue if there isn't an existing issue yet.

Description of Changes

Added a Node.js script (config/convert-po-to-json.js) to automate conversion of .po files to .json format using ttag po2json.

Reads from i18n/en.po and generates client/test-translation.json.

Parses the output to ensure clean, formatted JSON.

Prevents manual editing of test-translation.json, reducing human error and improving consistency across test snapshots.

Screenshot

Please include any relevant screenshots.

@pranshustuff
Copy link
Contributor

pranshustuff commented Oct 30, 2025

I just checked out your PR and here's a few notes:

  1. Please keep the commit message in the format as mentioned in the documentation

  2. The package-lock.json and yarn.lock changes are not needed. Also remove changes to the client/test-translations.json.

  3. There's an issue with your solution at the moment. While converting from .po to .json the header section's keys are capitalised like so:

  "headers": {
    "Language": "en",
    "MIME-Version": "1.0",
    "Content-Type": "text/plain; charset=UTF-8",
    "Content-Transfer-Encoding": "8bit",
    "Plural-Forms": "nplurals = 2; plural = (n != 1);"
  },

Instead of:

  "headers": {
    "language": "en",
    "mime-version": "1.0",
    "content-type": "text/plain; charset=UTF-8",
    "content-transfer-encoding": "8bit",
    "plural-forms": "nplurals = 2; plural = (n != 1);"
  },

This can cause problems later on. Please take care of this.

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.

[feature] Automate generation of client/test-translation.json from .po files

2 participants