aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 09:25:24 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-03-09 09:25:24 -0800
commit4a17d661ff28c0d0cf3dcebbea24faaf54c2ffea (patch)
tree9455e3c0bd8a7dac5e0e96989bd7267cdc778fc7
parent95b0f288318bb763583f03d3a43099c5abdc66f7 (diff)
downloadpandoc-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.hs3
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