Module:IPA/category documentation/sandbox explained

require('strict')

local p = local data = mw.loadData('Module:IPA/data')local mLang = require('Module:Lang')

function p.main(frame) local args = for k, v in pairs(frame:getParent.args) do if v ~= then args[k] = v end end local langName = mw.title.getCurrentTitle.text:sub(12, -5) local langCode, regionCode, langData, dialectData local fullLangCode = args.code if not fullLangCode then for code, lang in pairs(data.langs) do if lang.name

langName then fullLangCode = code langCode = code langData = lang break end if lang.dialects then for diaCode, dialect in pairs(lang.dialects) do if dialect.name

langName then fullLangCode = code .. '-' .. diaCode langCode = code regionCode = diaCode langData = lang dialectData = dialect break end end if fullLangCode then break end end end end if not fullLangCode then fullLangCode = mLang._tag_from_name() if fullLangCode:sub(1, 5)

'

', fullLangCode) or '' ) } if key then table.insert(ret, string.format('By default, the transcriptions are linked to the %s key. Transcriptions that do not adhere to the conventions of the key must have |generic=yes.', key )) end if isCollective then table.insert(ret, string.format('The %s are a language collective. Please replace the code%s with those of more specific languages where possible.', langName, fullLangCode and ' (' .. fullLangCode .. ')' )) end if not fullLangCode then table.insert(ret, string.format('Documentation error: language code for "%s" not found.', langName )) end if args.content then table.insert(ret, args.content) end if langCat and langCatCount ~= 0 then table.insert(ret, string.format('

See also

\n* (%s)', langCat, mw.language.new('en'):formatNum(langCatCount) )) end if cat then table.insert(ret, string.format('', cat, sortkey)) end return table.concat(ret, '\n\n')end

return p