~alcinnz/amphiarao

ref: d4c10f895dce29c0eb5b6209fb228abc731e7b5a amphiarao/src/Messages.hs -rw-r--r-- 1.5 KiB
d4c10f89 — Adrian Cochrane Allow loading webpage, commit missing files. 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{-# LANGUAGE OverloadedStrings #-}
module Messages(l, Message(..)) 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 |
    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":_) 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