Изменения
Перейти к навигации
Перейти к поиску
Строка 97:
Строка 97:
− +
− local i, j = 4, 1
− while args[i] or args[i - 1] or i <= 4 do
− local lang = args[i - 1]+
− local iw_title = args[i]+
− local iw_text = args[i + 1]+
− if is_empty(lang) then+
− lang = 'en'+
+
+
+
+
+
+
+
+
+
+
+
+
− +
− iw_title = title +
+
+
+
+
+
+
+
+
+
+
+
− +
− iw_text = iw_title+
− end+
− +
− +
− +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
− +
− +
− local show_original = show_originals and lang ~= 'd'+
− +
− local lang_text
− local lang_title
− local lang_link
−
− lang_text = 'd'
− elseif languages[lang] == nil then
− if allow_cat then
− categories = categories .. orphan_categories['error']
− end
− return error{'некорректный ISO-код «' .. lang .. '»'} .. categories
− lang_text = languages[lang][1] +
− lang_title = languages[lang][2]
− lang_link = wikilink(lang_title, lang_text)
− +
− local tooltip
− local ucfirst_title = mw.getContentLanguage():ucfirst(title)
− tooltip = string.format('Элемент статьи «%s» в Викиданных', ucfirst_title) +
− else
− tooltip = string.format('Версия статьи «%s» на %s', ucfirst_title, prepositional(lang))
− end
−
− local iw_link
− if show_original then
− iw_link = wikilink(iw_title, iw_text, tooltip, lang)
− iw_link = wikilink(iw_title, lang_text, tooltip, lang) +
− end
−
− if show_original then
− local lang_template = mw.title.new('Template:Lang-' .. lang)
− if not lang_template.exists then
− if allow_cat then
− categories = categories .. '[[Категория:Википедия:Статьи с шаблоном Не переведено 2, использующие несуществующий шаблон lang-XX]]'
− end
− return error{'не найден шаблон ' .. frame:expandTemplate{ title = 'tl', args = { 'lang-' .. lang } } } .. categories
− end
−
− if mw.isSubsting() or exists then
− post_text_list[j] = frame:expandTemplate{ title = 'lang-' .. lang, args = { iw_text } }
− else
− post_text_list[j] = frame:expandTemplate{ title = 'lang-' .. lang, args = { iw_link } }
− end
− elseif not ( mw.isSubsting() or exists ) then
− if lang == 'd' then
− wikidata_link = iw_link
− else
− post_text_list[j] = iw_link
− end
− end
−
− if show_original then
− i = i + 3
− else
− i = i + 2
− end
− if lang ~= 'd' then
− j = j + 1
Строка 196:
Строка 184:
− +
− +
− +
− +
+
Обсуждение шаблона:Не переведено#Несколько языков
end
end
local post_text_list = {}
local post_link = ''
local addition = args['a']
local addition = args['a']
local show_originals = yesno(args['o']) or addition ~= nil
local show_originals = yesno(args['o']) or addition ~= nil
local wikidata_link = ''
local wikidata_link = ''
local lang = args[3]
local iw_title = args[4]
local iw_text = args[5]
if is_empty(lang) then
lang = 'en'
end
if is_empty(iw_title) then
iw_title = title
end
if is_empty(iw_text) then
iw_text = iw_title
end
local iw_page = mw.title.new(iw_title)
if iw_page == nil then
if allow_cat then
categories = categories .. orphan_categories['error']
end
end
if is_empty(iw_title) then
return error{'некорректные символы в названии статьи'} .. categories
end
local show_original = show_originals and lang ~= 'd'
local lang_text
local lang_title
local lang_link
if lang == 'd' then
lang_text = 'd'
elseif languages[lang] == nil then
if allow_cat then
categories = categories .. orphan_categories['error']
end
end
if is_empty(iw_text) then
return error{'некорректный ISO-код «' .. lang .. '»'} .. categories
else
lang_text = languages[lang][1]
lang_title = languages[lang][2]
local iw_page = mw.title.new(iw_title)
lang_link = wikilink(lang_title, lang_text)
if iw_page == nil then
end
local tooltip
local ucfirst_title = mw.getContentLanguage():ucfirst(title)
if lang == 'd' then
tooltip = string.format('Элемент статьи «%s» в Викиданных', ucfirst_title)
else
tooltip = string.format('Версия статьи «%s» на %s', ucfirst_title, prepositional(lang))
end
local iw_link
if show_original then
iw_link = wikilink(iw_title, iw_text, tooltip, lang)
else
iw_link = wikilink(iw_title, lang_text, tooltip, lang)
end
if show_original then
local lang_template = mw.title.new('Template:Lang-' .. lang)
if not lang_template.exists then
if allow_cat then
if allow_cat then
categories = categories .. orphan_categories['error']
categories = categories .. '[[Категория:Википедия:Статьи с шаблоном Не переведено 2, использующие несуществующий шаблон lang-XX]]'
end
end
return error{'некорректные символы в названии статьи'} .. categories
return error{'не найден шаблон ' .. frame:expandTemplate{ title = 'tl', args = { 'lang-' .. lang } } } .. categories
end
end
if mw.isSubsting() or exists then
post_link = frame:expandTemplate{ title = 'lang-' .. lang, args = { iw_text } }
if lang == 'd' then
else
else
post_link = frame:expandTemplate{ title = 'lang-' .. lang, args = { iw_link } }
end
end
elseif not ( mw.isSubsting() or exists ) then
if lang == 'd' then
if lang == 'd' then
wikidata_link = iw_link
else
else
post_link = iw_link
end
end
end
end
addition = ''
addition = ''
end
end
if not is_empty(wikidata_link) and next(post_text_list) ~= nil then
if not is_empty(wikidata_link) and not is_empty(post_link) then
wikidata_link = wikidata_link .. '; '
wikidata_link = wikidata_link .. '; '
end
end
if next(post_text_list) ~= nil or not is_empty(wikidata_link) then
post_text = string.format(' (%s%s%s)', wikidata_link, table.concat(post_text_list, ', '), addition)
if not is_empty(post_link) or not is_empty(wikidata_link) then
if not show_originals or ( next(post_text_list) == nil and is_empty(addition) ) then
post_text = string.format(' (%s%s%s)', wikidata_link, post_link, addition)
if not show_originals or ( is_empty(post_link) and is_empty(addition) ) then --проверить
post_text = tostring(
post_text = tostring(
mw.html.create('span')
mw.html.create('span')