Изменения

Перейти к навигации Перейти к поиску
русификация сообщений об ошибках
Строка 159: Строка 159:  
         table.insert(nums,purif(num))
 
         table.insert(nums,purif(num))
 
     end
 
     end
     if #nums ~= 3 then error("Wrong format: 3 numbers expected")
+
     if #nums ~= 3 then error("В поле даты вместо 3х чисел с разделителями указано " .. #nums)
     elseif not inbord(nums[2],1,12) then error("Wrong month")
+
     elseif not inbord(nums[2],1,12) then error("Месяц с номером " .. nums[2] .. " не найден")
 
     elseif not inbord(nums[3],1,31) then
 
     elseif not inbord(nums[3],1,31) then
 
         dateout = {["year"]=nums[3], ["month"]=nums[2], ["day"]=nums[1]}
 
         dateout = {["year"]=nums[3], ["month"]=nums[2], ["day"]=nums[1]}
Строка 170: Строка 170:  
-- local lang = mw.getContentLanguage()
 
-- local lang = mw.getContentLanguage()
 
-- implement lang:formatDate(format,datein,true) here
 
-- implement lang:formatDate(format,datein,true) here
         return error("Unable to recognize date")
+
         return error("Не распознано " .. numstr .. " как дата")
 
     end
 
     end
 
     return dateout
 
     return dateout
Строка 221: Строка 221:  
right = "]"
 
right = "]"
 
end
 
end
if (not isdate(jdate,true)) or (not isdate(gdate)) then return error("Some wrong date") end
+
if (not isdate(jdate,true)) then return error((jdate.day or "") .. "." .. (jdate.month or "") .."." .. (jdate.year or "") .. " неподходящая дата")
 +
elseif (not isdate(gdate)) then return error((gdate.day or "") .. "." .. (gdate.month or "") .."." .. (gdate.year or "") .. " неподходящая дата") end
 
if jd.year == gd.year then
 
if jd.year == gd.year then
 
cd.year = gd.year
 
cd.year = gd.year
Строка 243: Строка 244:     
function gri2jd( datein )
 
function gri2jd( datein )
if not isdate(datein) then return error("Wrong date") end
+
if not isdate(datein) then return error((datein.day or "") .. "." .. (datein.month or "") .."." .. (datein.year or "") .. " неподходящая дата") end
 
     local year = datein.year
 
     local year = datein.year
 
     local month = datein.month
 
     local month = datein.month
Строка 256: Строка 257:  
     local low, high = -1931076.5, 5373557.49999
 
     local low, high = -1931076.5, 5373557.49999
 
     if not (low <= jd and jd <= high) then
 
     if not (low <= jd and jd <= high) then
         return error("Wrong date")
+
         return error((datein.day or "") .. "." .. (datein.month or "") .. "." .. (datein.year or "") .. " выходит за пределы разрешённого диапазона")
 
     end
 
     end
 
return jd
 
return jd
Строка 262: Строка 263:     
function jd2jul( jd )
 
function jd2jul( jd )
if type(jd) ~= "number" then return error("Wrong jd") end
+
if type(jd) ~= "number" then return error("Промежуточная переменная " .. (jd or "") .. " не является числом") end
 
     -- calendar date calculation
 
     -- calendar date calculation
 
     local c = jd + 32082
 
     local c = jd + 32082
Строка 277: Строка 278:     
function jul2jd( datein )
 
function jul2jd( datein )
if not isdate(datein,true) then return error("Wrong date") end
+
if not isdate(datein,true) then return error((datein.day or "") .. "." .. (datein.month or "") ..".".. (datein.year or "") .. " неподходящая дата") end
 
     local year = datein.year
 
     local year = datein.year
 
     local month = datein.month
 
     local month = datein.month
Строка 290: Строка 291:  
     local low, high = -1930999.5, 5373484.49999
 
     local low, high = -1930999.5, 5373484.49999
 
     if not (low <= jd and jd <= high) then
 
     if not (low <= jd and jd <= high) then
         return error("Wrong date")
+
         return error((datein.day or "") .. "." .. (datein.month or "") .."." .. (datein.year or "") .. " выходит за пределы разрешённого диапазона")
 
     end
 
     end
 
return jd
 
return jd
Строка 296: Строка 297:     
function jd2gri( jd )
 
function jd2gri( jd )
 +
if type(jd) ~= "number" then return error("Промежуточная переменная " .. (jd or "") .. " не является числом") end
 
     -- calendar date calculation
 
     -- calendar date calculation
 
     local a = jd + 32044
 
     local a = jd + 32044
Строка 322: Строка 324:  
   elseif inlist(calend,params[2]) then
 
   elseif inlist(calend,params[2]) then
 
return datein, jd2gri(jul2jd(datein))
 
return datein, jd2gri(jul2jd(datein))
   else error("Second argument must be 'g' or 'j'")
+
   else error("Параметр " .. (calend or "") .. " не опознан, разрешённые: " .. table.concat(params[1]," ") .. " и " .. table.concat(params[2]," "))
 
   end
 
   end
 
end
 
end
Строка 345: Строка 347:  
end
 
end
 
if type(str) ~= 'string' then
 
if type(str) ~= 'string' then
error("String missing")
+
error("Нет входящей строки")
 
elseif str:byte(1) == 43 then
 
elseif str:byte(1) == 43 then
 
elseif inbord(str:byte(1),48,57) then cat = "[[Категория:Википедия:Ошибка в часовом поясе НП]]"
 
elseif inbord(str:byte(1),48,57) then cat = "[[Категория:Википедия:Ошибка в часовом поясе НП]]"
 
elseif str:byte(1) == 45 or string.sub(str,1,3) == "−" or string.sub(str,1,1)=="-" then d = -1
 
elseif str:byte(1) == 45 or string.sub(str,1,3) == "−" or string.sub(str,1,1)=="-" then d = -1
 
else
 
else
error(string.char(str:byte(1)) .. " is not valid first char somehow")
+
error(string.char(str:byte(1)) .. " недопустимый первый символ")
 
end
 
end
 
-- parsing input
 
-- parsing input
Строка 356: Строка 358:  
         table.insert(nums,purif(num))
 
         table.insert(nums,purif(num))
 
     end
 
     end
if #nums > 2 then error("Max 2 numbers expected")
+
if #nums > 2 then error("Ожидается всего 2 числа, а не " .. #nums)
elseif #nums == 0 then error("If you mean 0 — type it in")
+
elseif #nums == 0 then error("Необходимо что-то ввести")
 
elseif #nums == 1 then
 
elseif #nums == 1 then
 
if inbord(nums[1],0,14) then timedec = d*nums[1] + margin
 
if inbord(nums[1],0,14) then timedec = d*nums[1] + margin
else error("From -14 to 14 only") end
+
else error("Только часы от -14 до 14") end
 
elseif #nums == 2 then
 
elseif #nums == 2 then
if not inbord(nums[1],0,14) then error("Hours from -14 to 14 only")
+
if not inbord(nums[1],0,14) then error("Только часы от -14 до 14")
elseif not inbord(nums[2],0,59) then error("Minutes from 0 to 59 only")
+
elseif not inbord(nums[2],0,59) then error("Минуты только от 0 до 59")
 
else
 
else
 
timedec = d*(nums[1] + nums[2]/60) + margin
 
timedec = d*(nums[1] + nums[2]/60) + margin
Анонимный участник

Реклама:

Навигация