diff --git a/README b/README index 5b4de3942..177b40ada 100644 --- a/README +++ b/README @@ -418,9 +418,10 @@ Options By default, pandoc will include the following metadata elements: `<dc:title>` (from the document title), `<dc:creator>` (from the - document authors), `<dc:language>` (from the locale), and - `<dc:identifier id="BookId">` (a randomly generated UUID). Any of - these may be overridden by elements in the metadata file. + document authors), `<dc:language>` (from the `lang` variable, or, + if is not set, the locale), and `<dc:identifier id="BookId">` (a + randomly generated UUID). Any of these may be overridden by elements + in the metadata file. `-D` *FORMAT*, `--print-default-template=`*FORMAT* : Print the default template for an output *FORMAT*. (See `-t` diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index a817f07a5..af907a809 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -120,8 +120,11 @@ writeEPUB mbStylesheet opts doc@(Pandoc meta _) = do let chapterEntries = zipWith chapterToEntry [1..] chapters -- contents.opf - lang <- catch (liftM (takeWhile (/='.')) $ getEnv "LANG") - (\_ -> return "en-US") + localeLang <- catch (liftM (takeWhile (/='.')) $ getEnv "LANG") + (\_ -> return "en-US") + let lang = case lookup "lang" (writerVariables opts') of + Just x -> x + Nothing -> localeLang uuid <- getRandomUUID let chapterNode ent = unode "item" ! [("id", takeBaseName $ eRelativePath ent),