Skip to content

Include translator comments from parent nodes in en.json5 instead of just terminal nodes #4565

Open

Description

Problem

Given the following en.json5 fragment, the intended translator comments do not appear in the .pot:

{
    homepage: {
        /** homepage.content.a-b are used to describe blah blah blah */
        content: {
            a: "",
            b: "",
        },
    },
}

Instead, it's necessary to move the comment on content to each of homepage.content.a and .b, which means duplicating this information. This can be quite tedious to maintain, especially when details about a string change. The repeated comments also make the file harder to read (and it's already pretty bad in that regard, being just a huge blob of json!).

Description

We should include comments from parent nodes when pulling the comments for each Entry in json-to-pot. Currently, it only retrieves the comment from the current Entry node (which is always a terminal one in getComment). It should walk up the tree of entry.parent... until !parent and include each comment.

Additional context

Noticed during #4549.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    🟩 priority: lowLow priority and doesn't need to be rushed🤖 aspect: dxConcerns developers' experience with the codebase🧰 goal: internal improvementImprovement that benefits maintainers, not users🧱 stack: mgmtRelated to repo management and automations

    Type

    No type

    Projects

    • Status

      📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions