[web-devel] [Yesod] rendering different templates for different languages

Ian Duncan iand675 at gmail.com
Mon Feb 21 08:37:52 CET 2011


My reasoning for typeclasses is this:
Keep in mind this is just a mental exercise, not saying that this would compile...
Suppose for your example we wanted to translate it into french:

-- Nouns for languages have some way to decide gender, if that matters for the given language
class Translate a where
toPlural :: Noun a -> Int -> [Words a]

data French = French {
... stuff ...
languageCode = "FR"
}

instance Translate French where
toPlural = frenchPluralizationEngine



More information about the web-devel mailing list