git.iko.soy/typeable/pandoc
on master help sign in
Bibtex reader: fall back on en-US if locale for LANG not found.

This reproduces earlier pandoc-citeproc behavior. Closes jgm/citeproc#26.

commitefa34a8de67409a5604207e016b0a49e525c2db6 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 17 Nov 2020, 23:12 (6 years ago) parentbf3fea0
1 file changed+4−1
src/Text/Pandoc/Readers/BibTeX.hs+4−1
src/Text/Pandoc/Readers/BibTeX.hs+4−1
@@ -51,7 +51,10 @@ readBibTeX' variant _opts t = do
5151 lang <- maybe (Lang "en" (Just "US")) parseLang
5252 <$> lookupEnv "LANG"
5353 locale <- case getLocale lang of
54− Left e -> throwError $ PandocCiteprocError e
54+ Left e ->
55+ case getLocale (Lang "en" (Just "US")) of
56+ Right l -> return l
57+ Left _ -> throwError $ PandocCiteprocError e
5558 Right l -> return l
5659 case BibTeX.readBibtexString variant locale (const True) t of
5760 Left e -> throwError $ PandocParsecError t e