Skip to content

fix: accept msgids named like Object.prototype members when validating - #117

Open
bardrop wants to merge 1 commit into
smhg:mainfrom
bardrop-oss:fix-validate-object-prototype-msgid
Open

bardrop wants to merge 1 commit into
smhg:mainfrom
bardrop-oss:fix-validate-object-prototype-msgid

Conversation

@bardrop

@bardrop bardrop commented Nov 25, 2026

Copy link
Copy Markdown

With validation: true, a msgid such as constructor, toString or valueOf is always reported as a duplicate:

po.parse('msgid ""\nmsgstr ""\n\nmsgid "constructor"\nmsgstr "x"\n', { validation: true });
// SyntaxError: Duplicate msgid error: entry "constructor" in "" context has already been declared.

msgid in translations[msgctxt] also looks at Object.prototype. This uses Object.hasOwn, like the other lookups of the table. Real duplicates of these names still throw.

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