When a user sets lang: zh-TW, Pandoc emits:
[WARNING] Could not load translations for zh-TW
data file translations/zh.yaml not found
Pandoc ships only zh-Hans.yaml and zh-Hant.yaml (IETF-recommended script subtags for Chinese). Its fallback logic strips to the primary language subtag (zh), which also doesn't exist — hence the warning:
https://github.com/jgm/pandoc/blob/8799ad87b797e67577bc5368580685c3fa8e97fb/src/Text/Pandoc/Translations.hs#L58-L86
Quarto already has one special-case rewrite at pandoc invocation that rewrites bare zh to zh-Hans:
|
// If the user provides only `zh` as a lang, disambiguate to 'simplified' |
|
if (pandocMetadata.lang === "zh") { |
|
pandocMetadata.lang = "zh-Hans"; |
|
} |
Suggestion
We could extend the mapping in pandoc.ts with region → script:
zh-TW, zh-HK, zh-MO → pass zh-Hant to Pandoc
zh-CN, zh-SG → pass zh-Hans to Pandoc
This would only affect the value handed to Pandoc. Quarto's own file resolution in src/core/language.ts would be unaffected — _language-zh-TW.yml would still load for users writing lang: zh-TW.
Repro
Render any format that uses Pandoc translations (e.g. LaTeX/PDF with chapters). Warning appears in the render log.
From #14409.
When a user sets
lang: zh-TW, Pandoc emits:Pandoc ships only
zh-Hans.yamlandzh-Hant.yaml(IETF-recommended script subtags for Chinese). Its fallback logic strips to the primary language subtag (zh), which also doesn't exist — hence the warning:https://github.com/jgm/pandoc/blob/8799ad87b797e67577bc5368580685c3fa8e97fb/src/Text/Pandoc/Translations.hs#L58-L86
Quarto already has one special-case rewrite at pandoc invocation that rewrites bare
zhtozh-Hans:quarto-cli/src/command/render/pandoc.ts
Lines 1251 to 1254 in e4b75c1
Suggestion
We could extend the mapping in
pandoc.tswith region → script:zh-TW,zh-HK,zh-MO→ passzh-Hantto Pandoczh-CN,zh-SG→ passzh-Hansto PandocThis would only affect the value handed to Pandoc. Quarto's own file resolution in
src/core/language.tswould be unaffected —_language-zh-TW.ymlwould still load for users writinglang: zh-TW.Repro
Render any format that uses Pandoc translations (e.g. LaTeX/PDF with chapters). Warning appears in the render log.
From #14409.