Issue : Language flag (--lang) fails on case-sensitive filesystems due to uppercase subtag mapping
Severity & Impact
- Severity: High
- Impact: All non-English translation manuals fail to load on Linux, Docker, and case-sensitive macOS/FreeBSD installations. Even the exact example printed in the tool's own
--help output (wtfjs --lang pt-br) fails with an error stating the translation does not exist.
Affected File
Root Cause Analysis
In wtfjs.js:
const lang = (cli.flags.lang || "")
.toLowerCase()
.split("-")
.map((l, i) => (i === 0 ? l : l.toUpperCase()))
.join("-");
const translation = join(
__dirname,
!lang ? "./README.md" : `./README-${lang}.md`
);
The mapping .map((l, i) => (i === 0 ? l : l.toUpperCase())) converts language subtags into uppercase region codes (e.g. pt-br $\to$ pt-BR, zh-cn $\to$ zh-CN, fr-fr $\to$ fr-FR).
However, all translation files in the repository are named strictly in all lowercase:
README-pt-br.md
README-zh-cn.md
README-fr-fr.md
README-it-it.md
README-pl-pl.md
README-kr.md
README-si.md
README-hi.md
On case-sensitive filesystems (standard on Linux servers and CI runners), fs.stat("./README-pt-BR.md") returns ENOENT because Linux does not recognize README-pt-BR.md as README-pt-br.md.
Minimal Reproducible Example
Actual Output
The pt-BR translation does not exist
Expected Output
The Brazilian Portuguese translation (README-pt-br.md) opens in the pager.
Proposed Fix
Keep the language parameter lowercase so it matches the files on disk:
--- a/wtfjs.js
+++ b/wtfjs.js
@@ -57,5 +57,2 @@
const lang = (cli.flags.lang || "")
.toLowerCase()
- .split("-")
- .map((l, i) => (i === 0 ? l : l.toUpperCase()))
- .join("-");
Issue : Language flag (
--lang) fails on case-sensitive filesystems due to uppercase subtag mappingSeverity & Impact
--helpoutput (wtfjs --lang pt-br) fails with an error stating the translation does not exist.Affected File
wtfjs.js(Line 57–66)Root Cause Analysis
In
wtfjs.js:The mapping$\to$ $\to$ $\to$
.map((l, i) => (i === 0 ? l : l.toUpperCase()))converts language subtags into uppercase region codes (e.g.pt-brpt-BR,zh-cnzh-CN,fr-frfr-FR).However, all translation files in the repository are named strictly in all lowercase:
README-pt-br.mdREADME-zh-cn.mdREADME-fr-fr.mdREADME-it-it.mdREADME-pl-pl.mdREADME-kr.mdREADME-si.mdREADME-hi.mdOn case-sensitive filesystems (standard on Linux servers and CI runners),
fs.stat("./README-pt-BR.md")returnsENOENTbecause Linux does not recognizeREADME-pt-BR.mdasREADME-pt-br.md.Minimal Reproducible Example
Actual Output
Expected Output
The Brazilian Portuguese translation (
README-pt-br.md) opens in the pager.Proposed Fix
Keep the language parameter lowercase so it matches the files on disk: