From efa34a8de67409a5604207e016b0a49e525c2db6 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 17 Nov 2020 23:12:32 -0800 Subject: Bibtex reader: fall back on en-US if locale for LANG not found. This reproduces earlier pandoc-citeproc behavior. Closes jgm/citeproc#26. --- src/Text/Pandoc/Readers/BibTeX.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/BibTeX.hs b/src/Text/Pandoc/Readers/BibTeX.hs index b7285e306..6c96ab30a 100644 --- a/src/Text/Pandoc/Readers/BibTeX.hs +++ b/src/Text/Pandoc/Readers/BibTeX.hs @@ -51,7 +51,10 @@ readBibTeX' variant _opts t = do lang <- maybe (Lang "en" (Just "US")) parseLang <$> lookupEnv "LANG" locale <- case getLocale lang of - Left e -> throwError $ PandocCiteprocError e + Left e -> + case getLocale (Lang "en" (Just "US")) of + Right l -> return l + Left _ -> throwError $ PandocCiteprocError e Right l -> return l case BibTeX.readBibtexString variant locale (const True) t of Left e -> throwError $ PandocParsecError t e -- cgit v1.2.3