1
0
forked from GitHub/gf-core

lib/src/api/libraryBrowser/MkLang.hs - allow multiple arguments

This commit is contained in:
john.j.camilleri
2013-07-26 07:41:20 +00:00
parent eb2b5a65d6
commit d0f7df60d3

View File

@@ -1,16 +1,18 @@
import System.Environment (getArgs)
import Data.List.Utils (replace)
name = "LibraryBrowserEng.gf"
main = do
a <- getArgs
case a of
lang:_ -> do
contents <- readFile name
let name' = replace "Eng" lang name
let contents' = replace "Eng" lang contents
writeFile name' contents'
putStrLn $ "Wrote " ++ name'
_ -> print "You need to provide a language code"
[] -> print "You need to provide a language code"
langs -> mapM_ makeOne langs
name = "LibraryBrowserEng.gf"
makeOne "Eng" = putStrLn "Skipping Eng"
makeOne lang = do
contents <- readFile name
let name' = replace "Eng" lang name
let contents' = replace "Eng" lang contents
writeFile name' contents'
putStrLn $ "Wrote " ++ name'