smhg / smhg/gettext-parser

Preserve ordering of comments in .po files

Open
#103 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
169
Forks
48
PR merge metrics
No merged PRs in 30d

Description

An option to preserve the order of comment fields in the translation data would be very useful for me. This library almost works for my use case, but parsing a .po file with the library, modifying the translation data, and re-compiling the translation data back into a .po file with the library changes the ordering of comment fields. For example:

-#. ~ Snippet in category "tip"
 #: data/core/tips.json
+#. ~ Snippet in category "tip"
 msgid "Moose may not be your friend."
 msgstr "Elche sind vielleicht nicht deine Freunde."

This seems consistent behavior, #. lines are always moved below #: lines. This causes diffs for translation files to become very large and hard to review. This is inconvenient for our workflow. The original translation files are generated with a process that orders the comments like this, which I can't affect.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the library's .po parsing and compilation paths, focusing on how comment fields are stored and emitted. Done means parsing, modifying, and recompiling a .po file preserves the original relative order of comment fields such as #. and #:, avoiding unrelated translation-file diffs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
localization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.