Skip to content

docs: correct header casing claim in README - #115

Merged
smhg merged 1 commit into
smhg:mainfrom
rusackas:docs/fix-header-casing-readme
Sep 29, 2026
Merged

smhg merged 1 commit into
smhg:mainfrom
rusackas:docs/fix-header-casing-readme

Conversation

@rusackas

Copy link
Copy Markdown
Contributor

Summary

The Headers section of the README says "all keys are lowercase," but that hasn't been accurate since #52's fix (Feb 2020). lib/shared.js's parseHeader() only normalizes the ~10 standard gettext headers (via the HEADERS map, matched case-insensitively) to their canonical Title-Case form; any other header — e.g. a tool-specific X-Poedit-* header, which is exactly what #52 was about — keeps whatever casing the source .po file used, untouched. The docs were just never updated to reflect that fix.

Why

Ran into this directly integrating gettext-parser into apache/superset: a naive reading of "all keys are lowercase" led to looking up a parsed header with a lowercased key (parsed.headers.language), which silently returned undefined for every real-world .po file, since the actual key is Language. Wanted to send the fix back rather than just work around it locally.

Change

Doc-only, no code/behavior change: replaces the stale claim with a short, accurate description of the actual (and clearly intentional, per #52) behavior.

The "all keys are lowercase" line has been inaccurate since smhg#52's fix
(Feb 2020): only the ~10 standard gettext headers are normalized, to their
canonical Title-Case form via a case-insensitive lookup (lib/shared.js's
HEADERS map), specifically so a translation tool's own custom headers
(e.g. Poedit's X-Poedit-*) are preserved verbatim rather than mangled by a
blanket case transform. The docs were never updated to match.

Found while consuming this library directly in apache/superset -- a naive
reading of the README led to looking up a parsed header with a lowercased
key, silently returning undefined for every standard header.

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@smhg
smhg merged commit 39dcc5e into smhg:main Sep 29, 2026
6 checks passed
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.

2 participants