0 |
From d483c66fe082c5ee617e9fcbf4e80d6b5072feb5 Mon Sep 17 00:00:00 2001 |
1 |
From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> |
2 |
Date: Thu, 1 Aug 2024 00:30:39 -0500 |
3 |
Subject: [PATCH] Traduki kaj specialigi por Gemujo |
4 |
|
5 |
--- |
6 |
init.lua | 163 +++++++++++++++++-------------------------------------- |
7 |
1 file changed, 50 insertions(+), 113 deletions(-) |
8 |
|
9 |
diff --git a/init.lua b/init.lua |
10 |
index b74026e..30fa001 100644 |
11 |
--- a/init.lua |
12 |
+++ b/init.lua |
13 |
@@ -8,7 +8,7 @@ else |
14 |
end |
15 |
end |
16 |
|
17 |
-local f = io.open(minetest.get_worldpath()..DIR_DELIM.."newplayer-keywords.txt","r") |
18 |
+local f = io.open(minetest.get_modpath(minetest.get_current_modname())..DIR_DELIM.."ĉefvortoj.txt","r") |
19 |
if f then |
20 |
local d = f:read("*all") |
21 |
newplayer.keywords = minetest.deserialize(d) |
22 |
@@ -21,34 +21,34 @@ newplayer.assigned_keywords = {} |
23 |
|
24 |
newplayer.hudids = {} |
25 |
|
26 |
-local f = io.open(minetest.get_worldpath()..DIR_DELIM.."newplayer-rules.txt","r") |
27 |
+local f = io.open(minetest.get_modpath(minetest.get_current_modname())..DIR_DELIM.."reguloj.txt","r") |
28 |
if f then |
29 |
local d = f:read("*all") |
30 |
newplayer.rules = minetest.formspec_escape(d) |
31 |
f:close() |
32 |
else |
33 |
- newplayer.rules = "Rules file not found!\n\nThe file should be named \"newplayer-rules.txt\" and placed in the following location:\n\n"..minetest.get_worldpath()..DIR_DELIM |
34 |
+ newplayer.rules = "Rules file not found!\n\nThe file should be named \"reguloj.txt\" and placed in the following location:\n\n"..minetest.get_modpath(minetest.get_current_modname())..DIR_DELIM |
35 |
end |
36 |
|
37 |
function newplayer.savekeywords() |
38 |
- local f = io.open(minetest.get_worldpath()..DIR_DELIM.."newplayer-keywords.txt","w") |
39 |
+ local f = io.open(minetest.get_worldpath()..DIR_DELIM.."ĉefvortoj.txt","w") |
40 |
local d = minetest.serialize(newplayer.keywords) |
41 |
f:write(d) |
42 |
f:close() |
43 |
end |
44 |
|
45 |
local editformspec1 = "size[13,9]".. |
46 |
- "label[0,-0.1;Editing Server Rules]".. |
47 |
+ "label[0,-0.1;Redaktante servilajn regulojn]".. |
48 |
"textarea[0.25,0.5;12.5,7;rules;;" |
49 |
-- the rules get inserted between these two on demand |
50 |
local editformspec2 = "]".. |
51 |
- "button_exit[0.5,8.1;2,1;save;Save]".. |
52 |
- "button_exit[5,8.1;2,1;quit;Cancel]" |
53 |
+ "button_exit[0.5,8.1;2,1;save;Konservi]".. |
54 |
+ "button_exit[5,8.1;2,1;quit;Nuligi]" |
55 |
|
56 |
function newplayer.showrulesform(name) |
57 |
|
58 |
-- Word-wrap the file |
59 |
- local strstart = 1 |
60 |
+ local strstart = 0 |
61 |
local charpos = 0 |
62 |
local linelen = 0 |
63 |
local tline = 1 |
64 |
@@ -61,7 +61,7 @@ function newplayer.showrulesform(name) |
65 |
linelen = linelen + 1 |
66 |
local c = string.sub(newplayer.rules, charpos, charpos) |
67 |
if c == " " or c == "\t" or c == "\n" or c == "\r" then lastbreak = charpos end |
68 |
- if linelen > 70 or c == "\n" or c == "\r" then |
69 |
+ if linelen > 80 or c == "\n" or c == "\r" then |
70 |
newplayer.rules_formspec_buffer = newplayer.rules_formspec_buffer..","..string.sub(newplayer.rules, strstart, lastbreak-1) |
71 |
tline = tline + 1 |
72 |
strstart = lastbreak + 1 |
73 |
@@ -82,23 +82,23 @@ function newplayer.showrulesform(name) |
74 |
newplayer.rules_subbed_interact = newplayer.rules_formspec_buffer |
75 |
end |
76 |
local form_interact = "size[13,9]".. |
77 |
- "label[0,-0.1;Server Rules]".. |
78 |
+ "label[0,-0.1;Reguloj]".. |
79 |
"textlist[0.25,0.5;12.5,6.25;rules;"..newplayer.rules_subbed_interact.."]" |
80 |
local form_nointeract = "size[13,9]".. |
81 |
- "label[0,-0.1;Server Rules]".. |
82 |
+ "label[0,-0.1;Reguloj]".. |
83 |
"textlist[0.25,0.5;12.5,6.25;rules;"..newplayer.rules_subbed.."]".. |
84 |
- "button[1,8;2,1;yes;I agree]".. |
85 |
- "button[5,8;2,1;no;I do not agree]" |
86 |
+ "button[1,8;2,1;yes;Akcepti]".. |
87 |
+ "button[5,8;2,1;no;Malakcepti]" |
88 |
if #newplayer.keywords > 0 then |
89 |
- form_nointeract = form_nointeract.."field[0.5,7.6;8,1;keyword;Enter keyword from rules above:;]" |
90 |
+ form_nointeract = form_nointeract.."field[0.5,7.6;8,1;keyword;Tajpu la «emfazitan» vorton supre:;]" |
91 |
end |
92 |
local hasinteract = minetest.check_player_privs(name,{interact=true}) |
93 |
if hasinteract then |
94 |
if minetest.check_player_privs(name,{server=true}) then |
95 |
- form_interact = form_interact.."button_exit[0.4,8.1;2,1;quit;OK]" |
96 |
- form_interact = form_interact.."button[4,8.1;2,1;edit;Edit]" |
97 |
+ form_interact = form_interact.."button_exit[0.4,8.1;2,1;quit;Bone]" |
98 |
+ form_interact = form_interact.."button[4,8.1;2,1;edit;Redakti]" |
99 |
else |
100 |
- form_interact = form_interact.."button_exit[0.4,8.1;2,1;quit;OK]" |
101 |
+ form_interact = form_interact.."button_exit[0.4,8.1;2,1;quit;Bone]" |
102 |
end |
103 |
minetest.show_formspec(name,"newplayer:rules_interact",form_interact) |
104 |
else |
105 |
@@ -119,7 +119,7 @@ minetest.register_on_joinplayer(function(player) |
106 |
hud_elem_type = "text", |
107 |
position = {x=0.5,y=0.5}, |
108 |
scale = {x=100,y=100}, |
109 |
- text = "BUILDING DISABLED\nYou must agree to\nthe rules before building!\nUse the /rules command\nto see them.", |
110 |
+ text = "KONSTRUADO MALŜALTITA\nVi akordu la regulojn antaŭ konstruado!\nRulu la ordonon «/reguloj» por ilin vidi.", |
111 |
number = 0xFF6666, |
112 |
alignment = {x=0,y=0}, |
113 |
offset = {x=0,y=0} |
114 |
@@ -148,30 +148,28 @@ minetest.register_on_player_receive_fields(function(player,formname,fields) |
115 |
end |
116 |
local spawn = minetest.setting_get_pos("spawnpoint_interact") |
117 |
if spawn then |
118 |
- minetest.chat_send_player(name,"Teleporting to spawn...") |
119 |
+ minetest.chat_send_player(name,"Teleportante al naskejo…") |
120 |
player:setpos(spawn) |
121 |
else |
122 |
- minetest.chat_send_player(name,newplayer.colorize("#FF0000","ERROR: ").."The spawn point is not set!") |
123 |
+ minetest.chat_send_player(name,newplayer.colorize("#FF0000","Eraro: ").."Naskejo ne agordita!") |
124 |
end |
125 |
local form = "size[5,3]".. |
126 |
- "label[1,0;Thank you for agreeing]".. |
127 |
- "label[1,0.5;to the rules!]".. |
128 |
- "label[1,1;You are now free to play normally.]".. |
129 |
- "label[1,1.5;You can also use /spawn to return here.]".. |
130 |
- "button_exit[1.5,2;2,1;quit;OK]" |
131 |
+ "label[1,0;Bonvenon, samideano!]".. |
132 |
+ "label[1,0.5;Ĝuan ludadon!]".. |
133 |
+ "button_exit[1.5,2;2,1;quit;Bone]" |
134 |
minetest.show_formspec(name,"newplayer:agreethanks",form) |
135 |
else |
136 |
local form = "size[5,3]".. |
137 |
- "label[1,0;Incorrect keyword!]".. |
138 |
- "button[1.5,2;2,1;quit;Try Again]" |
139 |
+ "label[1,0;Malprava ĉefvorto!]".. |
140 |
+ "button[1.5,2;2,1;quit;Reprovu]" |
141 |
minetest.show_formspec(name,"newplayer:tryagain",form) |
142 |
end |
143 |
elseif fields.no then |
144 |
local form = "size[5,3]".. |
145 |
- "label[1,0;You may remain on the server,]".. |
146 |
- "label[1,0.5;but you may not dig or build]".. |
147 |
- "label[1,1;until you agree to the rules.]".. |
148 |
- "button_exit[1.5,2;2,1;quit;OK]" |
149 |
+ "label[1,0;Vi rajtas resti ĉi tie,]".. |
150 |
+ "label[1,0.5;tamen vi nek rajtas fosi]".. |
151 |
+ "label[1,1;nek konstrui ĝis regulakordo.]".. |
152 |
+ "button_exit[1.5,2;2,1;quit;Bone]" |
153 |
minetest.show_formspec(name,"newplayer:disagreewarning",form) |
154 |
end |
155 |
return true |
156 |
@@ -185,10 +183,10 @@ minetest.register_on_player_receive_fields(function(player,formname,fields) |
157 |
f:write(fields.rules) |
158 |
f:close() |
159 |
newplayer.rules = minetest.formspec_escape(fields.rules) |
160 |
- minetest.chat_send_player(name,newplayer.colorize("#55FF55","Success: ").."Rules/keyword updated.") |
161 |
+ minetest.chat_send_player(name,newplayer.colorize("#55FF55","Sukcese: ").."Reguloj/ĉefvorto redaktita.") |
162 |
end |
163 |
else |
164 |
- minetest.chat_send_player(name,"You hacker you... nice try!") |
165 |
+ minetest.chat_send_player(name,"Fia trompisto… bona provo!") |
166 |
end |
167 |
elseif formname == "newplayer:rules_interact" then |
168 |
if fields.edit and minetest.check_player_privs(name,{server=true}) then |
169 |
@@ -206,26 +204,16 @@ minetest.register_on_player_receive_fields(function(player,formname,fields) |
170 |
end |
171 |
end) |
172 |
|
173 |
-minetest.register_chatcommand("rules",{ |
174 |
+minetest.register_chatcommand("reguloj",{ |
175 |
params = "", |
176 |
- description = "View the rules", |
177 |
+ description = "Legi la servilregulojn.", |
178 |
func = newplayer.showrulesform |
179 |
} |
180 |
) |
181 |
|
182 |
-minetest.register_chatcommand("editrules",{ |
183 |
+minetest.register_chatcommand("agordu_naskejon_senrajtan",{ |
184 |
params = "", |
185 |
- description = "Edit the rules", |
186 |
- privs = {server=true}, |
187 |
- func = function(name) |
188 |
- minetest.show_formspec(name,"newplayer:editrules",editformspec1..newplayer.rules..editformspec2) |
189 |
- return true |
190 |
- end} |
191 |
-) |
192 |
- |
193 |
-minetest.register_chatcommand("set_no_interact_spawn",{ |
194 |
- params = "", |
195 |
- description = "Set the spawn point for players without interact to your current position", |
196 |
+ description = "Agordas la naskejon por ludantoj sen la «interact» rajto.", |
197 |
privs = {server=true}, |
198 |
func = function(name) |
199 |
local player = minetest.get_player_by_name(name) |
200 |
@@ -233,13 +221,13 @@ minetest.register_chatcommand("set_no_interact_spawn",{ |
201 |
local pos = player:get_pos() |
202 |
minetest.setting_set("spawnpoint_no_interact",string.format("%s,%s,%s",pos.x,pos.y,pos.z)) |
203 |
minetest.setting_save() |
204 |
- return true, newplayer.colorize("#55FF55","Success: ").."Spawn point for players without interact set to: "..newplayer.colorize("#00FFFF",minetest.pos_to_string(pos)) |
205 |
+ return true, newplayer.colorize("#55FF55","Success: ").."Naskejo por senrajtaj ludantoj agordita al: "..newplayer.colorize("#00FFFF",minetest.pos_to_string(pos)) |
206 |
end} |
207 |
) |
208 |
|
209 |
-minetest.register_chatcommand("set_interact_spawn",{ |
210 |
+minetest.register_chatcommand("agordu_naskejon",{ |
211 |
params = "", |
212 |
- description = "Set the spawn point for players with interact to your current position", |
213 |
+ description = "Agordas la naskejon por ludantoj kun la rajto «interact».", |
214 |
privs = {server=true}, |
215 |
func = function(name) |
216 |
local player = minetest.get_player_by_name(name) |
217 |
@@ -247,64 +235,13 @@ minetest.register_chatcommand("set_interact_spawn",{ |
218 |
local pos = player:get_pos() |
219 |
minetest.setting_set("spawnpoint_interact",string.format("%s,%s,%s",pos.x,pos.y,pos.z)) |
220 |
minetest.setting_save() |
221 |
- return true, newplayer.colorize("#55FF55","Success: ").."Spawn point for players with interact set to: "..newplayer.colorize("#00FFFF",minetest.pos_to_string(pos)) |
222 |
+ return true, newplayer.colorize("#55FF55","Success: ").."Naskejo por kunrajtaj ludantoj agordita al: "..newplayer.colorize("#00FFFF",minetest.pos_to_string(pos)) |
223 |
end} |
224 |
) |
225 |
|
226 |
-minetest.register_chatcommand("getkeywords",{ |
227 |
+minetest.register_chatcommand("naskejo",{ |
228 |
params = "", |
229 |
- description = "Gets the list of keywords used to obtain the interact privilege", |
230 |
- privs = {server=true}, |
231 |
- func = function(name) |
232 |
- local out = "" |
233 |
- if #newplayer.keywords > 0 then |
234 |
- out = "Currently configured keywords:" |
235 |
- for _,kw in pairs(newplayer.keywords) do |
236 |
- out = out.."\n"..newplayer.colorize("#00FFFF",kw) |
237 |
- end |
238 |
- else |
239 |
- out = "No keywords are currently set." |
240 |
- end |
241 |
- return true, out |
242 |
- end} |
243 |
-) |
244 |
- |
245 |
-minetest.register_chatcommand("addkeyword",{ |
246 |
- params = "<keyword>", |
247 |
- description = "Add a keyword to the list of keywords used to obtain the interact privilege", |
248 |
- privs = {server=true}, |
249 |
- func = function(name,param) |
250 |
- if (not param) or param == "" then |
251 |
- return true, newplayer.colorize("#FF0000","ERROR: ").."No keyword supplied" |
252 |
- end |
253 |
- table.insert(newplayer.keywords,param) |
254 |
- newplayer.savekeywords() |
255 |
- return true, string.format("Keyword \"%s\" added",param) |
256 |
- end} |
257 |
-) |
258 |
- |
259 |
-minetest.register_chatcommand("delkeyword",{ |
260 |
- params = "<keyword>", |
261 |
- description = "Remove a keyword from the list of keywords used to obtain the interact privilege", |
262 |
- privs = {server=true}, |
263 |
- func = function(name,param) |
264 |
- if (not param) or param == "" then |
265 |
- return true, newplayer.colorize("#FF0000","ERROR: ").."No keyword supplied" |
266 |
- end |
267 |
- for k,v in pairs(newplayer.keywords) do |
268 |
- if v == param then |
269 |
- newplayer.keywords[k] = nil |
270 |
- newplayer.savekeywords() |
271 |
- return true, "Keyword "..newplayer.colorize("#00FFFF",param).." removed" |
272 |
- end |
273 |
- end |
274 |
- return true, newplayer.colorize("#FF0000","ERROR: ").."Keyword "..newplayer.colorize("#00FFFF",param).." not found" |
275 |
- end} |
276 |
-) |
277 |
- |
278 |
-minetest.register_chatcommand("spawn",{ |
279 |
- params = "", |
280 |
- description = "Teleport to the spawn", |
281 |
+ description = "Teleportas onin al la naskejo.", |
282 |
func = function(name) |
283 |
local player = minetest.get_player_by_name(name) |
284 |
if not player then return end |
285 |
@@ -313,9 +250,9 @@ minetest.register_chatcommand("spawn",{ |
286 |
local pos = minetest.setting_get_pos("spawnpoint_interact") |
287 |
if pos then |
288 |
player:set_pos(pos) |
289 |
- return true, "Teleporting to spawn..." |
290 |
+ return true, "Teleportante al la naskejo…" |
291 |
else |
292 |
- return true, newplayer.colorize("#FF0000","ERROR: ").."The spawn point is not set!" |
293 |
+ return true, newplayer.colorize("#FF0000","Eraro: ").."La naskejo ne estas agordita!" |
294 |
end |
295 |
else |
296 |
local pos = minetest.setting_get_pos("spawnpoint_no_interact") |
297 |
@@ -323,7 +260,7 @@ minetest.register_chatcommand("spawn",{ |
298 |
player:set_pos(pos) |
299 |
return true, "Teleporting to spawn..." |
300 |
else |
301 |
- return true, newplayer.colorize("#FF0000","ERROR: ").."The spawn point is not set!" |
302 |
+ return true, newplayer.colorize("#FF0000","Eraro: ").."La naskejo ne estas agordita!" |
303 |
end |
304 |
end |
305 |
end} |
306 |
@@ -333,15 +270,15 @@ minetest.register_on_chat_message(function(name, message) |
307 |
if minetest.check_player_privs(name,{interact=true}) then |
308 |
return |
309 |
end |
310 |
- if message:lower():find("rules") then |
311 |
+ if message:lower():find("reguloj") then |
312 |
newplayer.showrulesform(name) |
313 |
elseif message:lower():find("help") then |
314 |
local fs = "size[5,3]".. |
315 |
- "label[0,0;In order to build,]".. |
316 |
- "label[0,0.5;you must read and agree to the rules.]".. |
317 |
- "label[0,1;View them now?]".. |
318 |
- "button[0,2;2,1;yes;Yes]".. |
319 |
- "button_exit[3,2;2,1;quit;No]" |
320 |
+ "label[0,0;Por povi konstrui,]".. |
321 |
+ "label[0,0.5;vi nepre akceptu la regulojn.]".. |
322 |
+ "label[0,1;Ĉu vi legos nun?]".. |
323 |
+ "button[0,2;2,1;yes;Jes]".. |
324 |
+ "button_exit[3,2;2,1;quit;Ne]" |
325 |
minetest.show_formspec(name,"newplayer:help",fs) |
326 |
end |
327 |
end) |
328 |
-- |
329 |
2.45.2 |
330 |
|