diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-09 09:25:24 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-09 09:25:24 -0800 |
commit | 4a17d661ff28c0d0cf3dcebbea24faaf54c2ffea (patch) | |
tree | 9455e3c0bd8a7dac5e0e96989bd7267cdc778fc7 | |
parent | 95b0f288318bb763583f03d3a43099c5abdc66f7 (diff) | |
download | pandoc-4a17d661ff28c0d0cf3dcebbea24faaf54c2ffea.tar.gz |
EPUB reader: convert e.g. en_US from locale to en-US in language.
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index a04172a6d..b423f136f 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -128,7 +128,8 @@ writeEPUB mbStylesheet fonts opts doc@(Pandoc meta _) = do let chapterEntries = zipWith chapterToEntry [1..] chapters -- contents.opf - localeLang <- catch (liftM (takeWhile (/='.')) $ getEnv "LANG") + localeLang <- catch (liftM (map (\c -> if c == '_' then '-' else c) . + takeWhile (/='.')) $ getEnv "LANG") (\e -> let _ = (e :: SomeException) in return "en-US") let lang = case lookup "lang" (writerVariables opts') of Just x -> x |