{-# LANGUAGE OverloadedStrings #-} module Messages(l, Message(..), l', AttrMessage(..)) where import Text.Blaze.Html5 as H import Text.Blaze.Html5.Attributes as A import Text.Blaze.Html import Data.Text (Text) data Message = AmphiaraoIntro | CreateSession | CloseSession | LoadTimeout | SessionNotFound | ElementNotFound | NoResults | PromptPreview | ErrURL deriving Show l :: [Text] -> Message -> Html ---- Begin localizations l ("en":_) AmphiaraoIntro = do h1 "Amphiarao webpage debugger for Rhapsode" p $ do text "Amphiarao lets you analyze how webpages are parsed & styled in " a ! href "https://rhapsode.adrian.geek.nz/" $ "Rhapsode" text ", either programmatically via " a ! href "https://www.selenium.dev/" $ "Selenium" text " (using " a ! href "/webdriver/v1/" $ "this WebDriver endpoint" text ") or manually via this web UI which can be viewed in any web browser including Rhapsode. " p "Amphiarao is a locally-run webservice implemented using the same underlying libraries as Rhapsode." l ("en":_) CreateSession = "Open new test session" l ("en":_) LoadTimeout = "Load Timeout" l ("en":_) CloseSession = "Close Session" l ("en":_) SessionNotFound = "Session Not Found" l ("en":_) ElementNotFound = "Element Not Found" l ("en":_) NoResults = em "No Results" l ("en":_) PromptPreview = em "Click a search result to preview it here" l ("en":_) ErrURL = do h1 "Invalid Link!" p "The provided URL was not absolute." ---- End localizations l (_:langs) msg = l langs msg l [] msg = string $ show msg data AttrMessage = LoadTimeout' | CreateSession' | CloseSession' | Search' | DebugLink' | Reload' | Back' | Next' deriving Show l' :: [Text] -> AttrMessage -> AttributeValue ---- Begin localization l' ("en":_) LoadTimeout' = "Load Timeout" l' ("en":_) CreateSession' = "Open new test session" l' ("en":_) CloseSession' = "Close Session" l' ("en":_) Search' = "Search…" l' ("en":_) DebugLink' = "Debug link in this test session" l' ("en":_) Reload' = "Reload inspected page" l' ("en":_) Back' = "Previous inspected page" l' ("en":_) Next' = "Next inspected page" ---- End localization l' (_:langs) msg = l' langs msg l' [] msg = stringValue $ show msg