0
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
1
|
3 local ipairs = Luan.ipairs or error()
|
91
|
4 local pairs = Luan.pairs or error()
|
|
5 local Time = require "luan:Time.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
92
|
7 local Translator = require "luan:gpt/Translator.luan"
|
91
|
8 local Site_translator = require "luan:gpt/Site_translator.luan"
|
|
9 local get_lang = Site_translator.get_lang or error()
|
|
10 local languages = Site_translator.languages or error()
|
0
|
11
|
|
12
|
|
13 local Shared = {}
|
|
14
|
92
|
15 function Translator.prompt(html,language)
|
|
16 %>
|
|
17 Please translate the HTML below delimited by triple quotes from English to <%=language%>.
|
|
18
|
|
19 Note that the content is related to computer programming, so keep that in mind while translating. The English word "library" refers to a programming library, not a place to borrow books, so translate to the word in the target language that means programming library. So for Spanish, use "librerÃa".
|
|
20
|
|
21 Do not translate file names.
|
|
22
|
|
23 Do not translate the contents of <code> tags.
|
|
24
|
|
25 """
|
|
26 <%=html%>
|
|
27 """
|
|
28 <%
|
|
29 end
|
|
30
|
91
|
31 Http.not_found_handler = Site_translator.not_found_handler or error()
|
|
32
|
|
33 local started = Time.now()
|
|
34
|
0
|
35 function Shared.head()
|
|
36 %>
|
|
37 <meta name="viewport" content="width=device-width, initial-scale=1">
|
|
38 <style>
|
91
|
39 @import "/site.css?s=<%=started%>";
|
0
|
40 </style>
|
91
|
41 <script src="/site.js?s=<%=started%>"></script>
|
0
|
42 <%
|
|
43 end
|
|
44
|
1
|
45 local function header(crumbs)
|
91
|
46 local lang = get_lang()
|
|
47 local home
|
|
48 if lang == "en" then
|
|
49 home = "/"
|
|
50 else
|
|
51 home = "/"..lang.."/"
|
|
52 end
|
0
|
53 %>
|
|
54 <div header>
|
31
|
55 <span breadcrumbs>
|
91
|
56 <a href="<%=home%>">Reactionary Software</a>
|
1
|
57 <% for _, crumb in ipairs(crumbs or {}) do %>
|
31
|
58 / <%=crumb%>
|
1
|
59 <% end %>
|
91
|
60 - <select onchange="setLanguage(value)">
|
|
61 <% for code, name in pairs(languages) do
|
|
62 local selected = code==lang and "selected" or ""
|
|
63 %>
|
|
64 <option value="<%=code%>" <%=selected%> ><%=name%></option>
|
|
65 <% end %>
|
|
66 </select>
|
31
|
67 </span>
|
34
|
68 <span>by <a href="https://linkmy.style/fschmidt">fschmidt</a></span>
|
0
|
69 </div>
|
|
70 <%
|
|
71 end
|
1
|
72 Shared.header = header
|
|
73
|
|
74 function Shared.existing_header()
|
91
|
75 header{[[<a href="existing.html">Existing</a>]]}
|
1
|
76 end
|
|
77
|
|
78 function Shared.needed_header()
|
91
|
79 header{[[<a href="needed.html">Needed</a>]]}
|
|
80 end
|
|
81
|
|
82 function Shared.luan_url()
|
|
83 local url = "https://www.luan.software"
|
|
84 local lang = get_lang()
|
|
85 if lang ~= "en" then
|
|
86 url = url.."/"..lang
|
|
87 end
|
|
88 return url
|
1
|
89 end
|
0
|
90
|
|
91 return Shared
|