Module:fi:Dialects
- පහත දැක්වෙන උපදෙස්, Template:dialectal data module මගින් ජනනය කොට ඇත. [සංස්කරණය කරන්න]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
This module provides labels to the templates {{alter}}
/{{alt}}
, {{descendant}}
/{{desc}}
as well as the templates derived from Module:nyms ({{synonyms}}
/{{syn}}
etc.).
How-to[සංස්කරණය]
Additions take this form. Remove < >
and the stuff between them and replace with the label you would like to use, the form you would like it to display as, and the Wikipedia entry (if any) that the label should link to. If you do not want to link to a Wikipedia article, simply remove the link
line altogether.
labels['<label>'] = {
display = '<link text>',
link = '<Wikipedia article>',
}
Blank form:
labels[''] = {
display = '',
link = '',
For alternative forms of the labels, use the following code:
aliases['<alternative form>'] = '<label with data table>'
aliases[''] = ''
local labels, aliases = {}, {}
local m_data = mw.loadData("Module:fi-dialects/data/area")
labels['Western Finnish'] = {
link = 'Finnish language#Western dialects',
display = 'Western Finnish',
}
aliases['Western'] = 'Western Finnish'
aliases['Western Finland'] = 'Western Finnish'
labels['Eastern Finnish'] = {
link = 'Finnish language#Eastern dialects',
display = 'Eastern Finnish',
}
aliases['Eastern'] = 'Eastern Finnish'
aliases['Eastern Finland'] = 'Eastern Finnish'
local function visit(area_key, area)
labels[area_key] = {
link = area.Wikipedia,
display = area.english
}
aliases[area.english] = area_key
if area.subareas then
for subarea_key, subarea in pairs(area.subareas) do
visit(area_key .. "/" .. subarea_key, subarea)
end
end
end
for area_key, area in pairs(m_data.areas) do
visit(area_key, area)
end
for alias_key, alias in pairs(m_data.area_aliases) do
aliases[alias_key] = alias
end
local function northern_to_north_etc(key)
local words = { "(North)ern", "(West)ern", "(South)ern", "(Southwest)ern", "(East)ern", "(Southeast)ern" }
for _, word in ipairs(words) do
key = mw.ustring.gsub(key, word .. " ", "%1 ")
key = mw.ustring.gsub(key, word .. "$", "%1")
end
return key
end
local old_aliases = aliases
aliases = {}
for alias_key, alias in pairs(old_aliases) do
aliases[alias_key] = alias
if mw.ustring.find(alias_key, "ern ") then
local alias_key2 = northern_to_north_etc(alias_key)
if alias_key ~= alias_key2 then
aliases[alias_key2] = alias
end
end
end
return {
labels = labels,
aliases = aliases,
}