Изменения
перевод сообщений на русский язык + категория ошибок модуля
if i > len or j > len or i < 1 or j < 1 then
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' );
return str._error( 'Значение индекса подстроки выходит за допустимые границы' );
end
end
if j < i then
if j < i then
return str._error( 'String subset indices out of order' );
return str._error( 'Неверный порядок индексов подстроки' );
end
end
if s == '' then
if s == '' then
return str._error( 'Target string is empty' );
return str._error( 'Пустая строка поиска' );
end
end
if pattern == '' then
if pattern == '' then
return str._error( 'Pattern string is empty' );
return str._error( 'Пустой шаблон поиска' );
end
end
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' );
return str._error( 'Индекс начала поиска выходит за допустимые границы' );
end
end
if match_index == 0 then
if match_index == 0 then
return str._error( 'Match index is out of range' );
return str._error( 'Индекс совпадения выходит за допустимые границы' );
end
end
if plain_flag then
if plain_flag then
if result == nil then
if result == nil then
if nomatch == nil then
if nomatch == nil then
return str._error( 'Match not found' );
return str._error( 'Совпадение не найдено' );
else
else
return nomatch;
return nomatch;
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' );
return str._error( 'Значение индекса строки выходит за допустимые границы' );
end
end
function str._error( error_str )
function str._error( error_str )
local frame = mw.getCurrentFrame();
local frame = mw.getCurrentFrame();
local error_category = frame.args.error_category or 'Errors reported by Module String';
local error_category = frame.args.error_category or 'Страницы с ошибками модуля String';
local ignore_errors = frame.args.ignore_errors or false;
local ignore_errors = frame.args.ignore_errors or false;
local no_category = frame.args.no_category or false;
local no_category = frame.args.no_category or false;
end
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
local error_str = '<strong class="error">Ошибка модуля String: ' .. error_str .. '</strong>';
if error_category ~= '' and not str._getBoolean( no_category ) then
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str;
error_str = '[[Категория:' .. error_category .. ']]' .. error_str;
end
end
boolean_value = boolean_str;
boolean_value = boolean_str;
else
else
error( 'No boolean value found' );
error( 'Логическое значение не найдено' );
end
end
return boolean_value
return boolean_value