aboutsummaryrefslogtreecommitdiff
path: root/v0.9.5/patches/03_bloated_i18n_implementation.patch
blob: dff14f3d52581abc27f17cae854d06c73cc07308 (plain) (blame)
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
diff --git a/web.go b/web.go
index 11adf5b..8e42bae 100644
--- a/web.go
+++ b/web.go
@@ -85,6 +85,9 @@ func getInfo(r *http.Request) map[string]interface{} {
 	templinfo["IconName"] = iconName
 	templinfo["UserInfo"] = u
 	templinfo["UserSep"] = userSep
+    templinfo["Lang"] = getLangCookie(r)
+    templinfo["i18n"] = setLangStr(getLangCookie(r))
+
 	if u != nil {
 		var combos []string
 		combocache.Get(u.UserID, &combos)
@@ -99,7 +102,7 @@ func homepage(w http.ResponseWriter, r *http.Request) {
 	var honks []*Honk
 	var userid int64 = -1
 
-	templinfo["ServerMessage"] = serverMsg
+    templinfo["ServerMessage"] = serverMsg
 	if u == nil || r.URL.Path == "/front" {
 		switch r.URL.Path {
 		case "/events":
@@ -733,6 +736,8 @@ func showhonker(w http.ResponseWriter, r *http.Request) {
 	templinfo["PageArg"] = name
 	templinfo["ServerMessage"] = msg
 	templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
+    templinfo["Lang"] = getLangCookie(r)
+
 	honkpage(w, u, honks, templinfo)
 }
 
@@ -1109,8 +1114,9 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
 		options.MapLink = ""
 	}
 	options.Reaction = r.FormValue("reaction")
-
-	sendupdate := false
+    setLangCookie(w, r)
+	
+    sendupdate := false
 	ava := re_avatar.FindString(whatabout)
 	if ava != "" {
 		whatabout = re_avatar.ReplaceAllString(whatabout, "")
@@ -2436,6 +2442,7 @@ func serve() {
 	getters.HandleFunc("/server", serveractor)
 	posters.HandleFunc("/server/inbox", serverinbox)
 	posters.HandleFunc("/inbox", serverinbox)
+    posters.HandleFunc("/langcookie", setLangCookie)
 
 	getters.HandleFunc("/style.css", serveasset)
 	getters.HandleFunc("/local.css", serveasset)