Yesod 的翻译文件中是否可以包含多行消息?
Is it possible to have messages with multiple lines in translation files of Yesod?
我正在按照以下链接中的说明在 Yesod 脚手架应用程序中进行国际化:https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding, https://www.yesodweb.com/book/internationalization and http://haddock.stackage.org/nightly-2016-04-19/shakespeare-2.0.8.1/Text-Shakespeare-I18N.html
它看起来像一个 en.msg
文件:
Hello: Hello World!
MultilineText:
line 1.
line 2.
etc...
SingleLine: A single line message.
不受支持,因为 MultilineText 定义。这是真的还是有一个 way/syntax 可以做到这一点?
从消息来源来看,不,不可能:
loadLangFile :: FilePath -> IO [Def]
loadLangFile file = do
bs <- S.readFile file
let s = unpack $ decodeUtf8 bs
defs <- fmap catMaybes $ mapM (parseDef . T.unpack . T.strip . T.pack) $ lines s
return defs
parseDef
函数对 lines
调用的结果进行操作,它按换行符拆分文件内容。
我正在按照以下链接中的说明在 Yesod 脚手架应用程序中进行国际化:https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding, https://www.yesodweb.com/book/internationalization and http://haddock.stackage.org/nightly-2016-04-19/shakespeare-2.0.8.1/Text-Shakespeare-I18N.html
它看起来像一个 en.msg
文件:
Hello: Hello World!
MultilineText:
line 1.
line 2.
etc...
SingleLine: A single line message.
不受支持,因为 MultilineText 定义。这是真的还是有一个 way/syntax 可以做到这一点?
从消息来源来看,不,不可能:
loadLangFile :: FilePath -> IO [Def]
loadLangFile file = do
bs <- S.readFile file
let s = unpack $ decodeUtf8 bs
defs <- fmap catMaybes $ mapM (parseDef . T.unpack . T.strip . T.pack) $ lines s
return defs
parseDef
函数对 lines
调用的结果进行操作,它按换行符拆分文件内容。