EPUB reader: convert e.g. en_US from locale to en-US in language.

This commit is contained in:
John MacFarlane 2012-03-09 09:25:24 -08:00
parent 95b0f28831
commit 4a17d661ff

View file

@ -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