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
68
69
70
71
72
73
74
75
76
77
78
79
{-# 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 |
LinkSearchExact | LinkSearch |
Click
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."
l ("en":_) LinkSearchExact = "Links (Exact)"
l ("en":_) LinkSearch = "Links"
l ("en":_) Click = "Click"
---- End localizations
l (_:langs) msg = l langs msg
l [] msg = string $ show msg
data AttrMessage =
LoadTimeout' |
CreateSession' |
CloseSession' |
Search' |
DebugLink' |
Reload' |
Back' |
Next' |
SearchChildren' |
Click' 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"
l' ("en":_) SearchChildren' = "Search Children…"
l' ("en":_) Click' = "Click"
---- End localization
l' (_:langs) msg = l' langs msg
l' [] msg = stringValue $ show msg