မေႃႇၵျူး:IPA/data/export
Appearance
< မေႃႇၵျူး:IPA | data
Uses Lua: |
Provides a verbose and sorted version of Module:IPA/data for Module:IPA/overview and Module:IPA/category documentation.
ၽိုၼ်ၵႅမ်မိုဝ်းလၢႆးၸႂ်ႉတိုဝ်း (documentation)တီႈၽၢႆႇၼိူဝ်ၼႆႉ လုၵ်ႉတီႈ မေႃႇၵျူး:IPA/data/export/doc သေ ၶၢႆႉသႂ်ႇၶဝ်ႈ (ႁဵတ်း transclude ဝႆႉၶႃႈဢေႃႈ။ (မႄးထတ်း | ပိုၼ်း) ၽူႈၸိူဝ်းမႄးထတ်းၶဝ် ၸၢင်ႈၸၢမ်းတူၺ်းလႆႈ ၸိူဝ်းပဵၼ်ၼႃႈလိၵ်ႈ sandbox (သၢင်ႈ | ငဝ်းမိူၼ်) လႄႈ testcases (သၢင်ႈ) ႁင်း မေႃႇၵျူးဢၼ်ၼႆႉ လႆႈယူႇၶႃႈ။ ၼႃႈလိၵ်ႈၽႄ ႁင်း မေႃႇၵျူး ဢၼ်ၼႆႉ။. |
require('strict')
local rawData = mw.title.getCurrentTitle().subpageText == 'sandbox'
and mw.loadData('Module:IPA/data/sandbox')
or mw.loadData('Module:IPA/data')
local data = {}
local function getNameAndLink(code)
local res = require('Module:Lang')._name_from_tag({ code, link = 'yes' })
local name = res:match('([^%[|%]]+)%]%]$')
local link = res:match('^%[%[([^|%]]+)')
return name, link
end
local function augmentData(lect)
if lect.name and not lect.link then
lect.generatedLink = lect.name:find(' languages$')
and lect.name
or lect.name .. ' language'
end
lect.extName, lect.extLink = getNameAndLink(lect.code)
end
for code, lang in pairs(rawData.langs) do
local langData = {
code = code,
name = lang.name,
text = lang.text,
link = lang.link,
key = lang.key
}
augmentData(langData)
table.insert(data, langData)
if lang.dialects then
local aliases = {}
for diaCode, dialect in pairs(lang.dialects) do
if dialect.aliasOf then
aliases[dialect.aliasOf] = aliases[dialect.aliasOf] or {}
table.insert(aliases[dialect.aliasOf], diaCode)
end
end
for _, t in pairs(aliases) do
table.sort(t)
end
for diaCode, dialect in pairs(lang.dialects) do
if not dialect.aliasOf then
local diaAliases = aliases[diaCode]
if dialect.isVariant then
diaCode = diaCode:lower()
end
local diaData = {
code = code .. '-' .. diaCode,
aliases = diaAliases,
name = dialect.name,
text = dialect.text,
link = dialect.link,
key = dialect.key,
parent = langData
}
augmentData(diaData)
table.insert(data, diaData)
end
end
end
end
table.sort(data, function (a, b) return a.code < b.code end)
return data