Language flag (`--lang`) fails on case-sensitive filesystems due to uppercase subtag mapping
Author: codeCraft-RitikCreated Sep 14, 2026Updated Sep 14, 2026
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
--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:
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.mdREADME-zh-cn.mdREADME-fr-fr.mdREADME-it-it.mdREADME-pl-pl.mdREADME-kr.mdREADME-si.mdREADME-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
$ wtfjs --lang pt-brActual Output
The pt-BR translation does not existExpected 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("-");Source: denysdovhan/wtfjs