Leehan020816 (토론 | 기여) 편집 요약 없음 |
잔글편집 요약 없음 |
||
1번째 줄: | 1번째 줄: | ||
local p = {} |
local p = {} |
||
− | local block = mw.loadData( ' |
+ | local block = mw.loadData( '모듈:Autolink/Block' ) |
− | local item = mw.loadData( ' |
+ | local item = mw.loadData( '모듈:Autolink/Item' ) |
− | local other = mw.loadData( ' |
+ | local other = mw.loadData( '모듈:Autolink/Other' ) |
local colors = { 'white ', 'orange ', 'magenta ', 'light blue ', 'yellow ', 'lime ', 'pink ', 'gray ', 'light gray ', 'cyan ', 'purple ', 'blue ', 'brown ', 'green ', 'red ', 'black ' } |
local colors = { 'white ', 'orange ', 'magenta ', 'light blue ', 'yellow ', 'lime ', 'pink ', 'gray ', 'light gray ', 'cyan ', 'purple ', 'blue ', 'brown ', 'green ', 'red ', 'black ' } |
||
local colorc = { '하얀색 ', '주황색 ', '자홍색 ', '하늘색 ', '노란색 ', '연두색 ', '분홍색 ', '회색 ', '회백색 ', '청록색 ', '보라색 ', '파란색 ', '갈색 ', '초록색 ', '빨간색 ', '검은색 ' } |
local colorc = { '하얀색 ', '주황색 ', '자홍색 ', '하늘색 ', '노란색 ', '연두색 ', '분홍색 ', '회색 ', '회백색 ', '청록색 ', '보라색 ', '파란색 ', '갈색 ', '초록색 ', '빨간색 ', '검은색 ' } |
2018년 4월 5일 (목) 02:15 판
Autolink(자동번역) 모듈은 틀 내의 게임 아이템 이름을 자동으로 번역해줍니다. 용어 번역용인 만큼 영어 위키는 사용하지 않으며, 유지보수 시 보통 일본판 코드를 참조합니다.
쓰임새
{{BlockLink}}
,{{ItemLink}}
등에서 아이템 이름을 영어로 입력했을 때 결과물이 한국어로 변환됩니다.- 모듈 입력값은 영어지만 출력값이 한국어여야 할 때 사용됩니다.
같이 보기
- /Block - 에디션 공통 블록
- /Item - 에디션 공통 아이템
- /Other - 기타
- /Exclusive - 각 에디션 전용 기능
- /Dungeons - Minecraft Dungeons 관련 용어
- /Earth - Minecraft Earth 관련 용어
[보기 | 편집 | 역사 | 캐시 제거]위 설명문서는 모듈:Autolink/doc에서 왔습니다.
local p = {}
local block = mw.loadData( '모듈:Autolink/Block' )
local item = mw.loadData( '모듈:Autolink/Item' )
local other = mw.loadData( '모듈:Autolink/Other' )
local colors = { 'white ', 'orange ', 'magenta ', 'light blue ', 'yellow ', 'lime ', 'pink ', 'gray ', 'light gray ', 'cyan ', 'purple ', 'blue ', 'brown ', 'green ', 'red ', 'black ' }
local colorc = { '하얀색 ', '주황색 ', '자홍색 ', '하늘색 ', '노란색 ', '연두색 ', '분홍색 ', '회색 ', '회백색 ', '청록색 ', '보라색 ', '파란색 ', '갈색 ', '초록색 ', '빨간색 ', '검은색 ' }
local function Set (list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
end
local coloredItems = Set { 'firework star', 'hardened clay', 'stained clay', 'banner', 'carpet', 'concrete', 'concrete powder', 'glazed terracotta', 'terracotta', 'shield', 'shulker box', 'stained glass', 'stained glass pane', 'wool', 'bed' }
function p.link( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
end
local arg = args[1]
arg = string.lower(arg)
local color
for i, c in ipairs( colors ) do
if string.find(arg, c) == 1 then
local item = string.sub(arg, string.len(c)+1)
if coloredItems[item] then
color = colorc[i]
arg = item
end
end
end
local result = block[arg]
if result == nil then
result = item[arg]
end
if result == nil then
--check for spawn egg
if string.find(arg,'spawn ',0,true) == nil or string.len(arg) < 7 then
result = other[arg]
else
local mob = other[string.sub(arg,7)]
index = string.find(mob,'|',0,true)
if index ~= nil then
mob = string.sub(mob, index+1)
end
result = "스폰 알|스폰 " .. mob
end
end
local index
if result == nil then
result = args[1]
index = string.find(result,'|',0,true)
else
if color then
result = result .. '|' .. color .. result
end
index = string.find(result,'|',0,true)
if pe then
if index then
result = result .. '(포켓 에디션)'
else
result = result .. '|' .. result .. '(포켓 에디션)'
end
end
end
local mode = args[2]
if mode and index then
-- return the fully translated part
if mode == 'nolink' then
result = string.sub(result, index+1)
end
-- return the page link part
if mode == 'linkonly' then
result = string.sub(result, 1 , index-1)
end
end
return result
end
function p.xlink( str , mode )
if str == nil then
return nil
end
local arg = string.lower(str)
if mode == nil then
mode = 'default'
end
local pe
if string.sub(arg, -3) == ' pe' then
pe = 1
arg = string.sub(arg, 0, -4)
end
local color
for i, c in ipairs( colors ) do
if string.find(arg, c) == 1 then
local item = string.sub(arg, string.len(c)+1)
if coloredItems[item] then
color = colorc[i]
arg = item
end
end
end
local result = block[arg]
if result == nil then
result = item[arg]
end
if result == nil then
--check for spawn egg
if string.find(arg,'spawn ',0,true) == nil or string.len(arg) < 7 then
result = other[arg]
else
local mob = other[string.sub(arg,7)]
index = string.find(mob,'|',0,true)
if index ~= nil then
mob = string.sub(mob, index+1)
end
result = "스폰 알|스폰 " .. mob
end
end
local index
if result == nil then
result = str
index = string.find(result,'|',0,true)
else
if color then
result = result .. '|' .. color .. result
end
index = string.find(result,'|',0,true)
if pe then
if index then
result = result .. '(포켓 에디션)'
else
result = result .. '|' .. result .. '(포켓 에디션)'
index = string.find(result,'|',0,true)
end
end
end
if index then
-- return the fully translated part
if mode == 'nolink' then
result = string.sub(result, index+1)
end
-- return the page link part
if mode == 'linkonly' then
result = string.sub(result, 1 , index-1)
end
end
return result
end
return p