~alcinnz/amphiarao

ref: 86bfb71d981383978879c527f49f1f170636e6f7 amphiarao/src/Messages.hs -rw-r--r-- 2.2 KiB
86bfb71d — Adrian Cochrane Add WebDriver noops for frames. 3 years ago
                                                                                
d4c10f89 Adrian Cochrane
8a39949f Adrian Cochrane
d4c10f89 Adrian Cochrane
8a39949f Adrian Cochrane
7a6334be Adrian Cochrane
afb3d55d Adrian Cochrane
8a39949f Adrian Cochrane
7a6334be Adrian Cochrane
afb3d55d Adrian Cochrane
8a39949f Adrian Cochrane
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{-# 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 |
    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

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