မေႃႇၵျူး:Language/data/ISO 639-3 (dep)/make
ၽိုၼ်ၵႅမ်မိုဝ်းမေႃႇၵျူး[သၢင်ႈ]
တွၼ်ႈတႃႇ Scribunto module ဢၼ်ၼႆႉ ၸဝ်ႈၵဝ်ႇ ၸၢင်ႈ သၢင်ႈ ၼႃႈလိၵ်ႈ ၼႆႉလႆႈယူႇၶႃႈ။ ၽူႈၸိူဝ်းမႄးထတ်းၶဝ် ၸၢင်ႈၸၢမ်းတူၺ်းလႆႈ ၸိူဝ်းပဵၼ်ၼႃႈလိၵ်ႈ sandbox (သၢင်ႈ | ငဝ်းမိူၼ်) လႄႈ testcases (သၢင်ႈ) ႁင်း မေႃႇၵျူးဢၼ်ၼႆႉ လႆႈယူႇၶႃႈ။ သႂ်ႇပိူင်ထၢၼ်ႈ ၵႃႈတီႈ ၼႃႈလိၵ်ႈၽႄ /doc လႄႈ။ ၼႃႈလိၵ်ႈၽႄ ႁင်း မေႃႇၵျူး ဢၼ်ၼႆႉ။. |
require('strict');
local p = {};
--[=[------------------------< I S O _ 6 3 9 _ 3 _ E X T R A C T >---------------------------------------------
{{#invoke:Language/data/ISO 639-3/make|ISO_639_3_extract|file-date=20170217}}
Reads a local copy of iso-639-3_Retirements_YYYYMMDD.tab where (YYYYMMDD is the release date). Download that file
in zip form from http://www-01.sil.org/iso639-3/download.asp (use the UTF-8 zip)
useful lines in the file have the form:
<id>\t<Ref_Name>\t<Ret_Reason>\t<Change_To>\t<Ret_Remedy>\t<Effective>
where:
<id> is the three-character ISO 639-3 language code
<Ref_Name> is the language 'name'
all other parts ignored
like this:
fri Western Frisian C fry 2007-02-01
]=]
function p.ISO_639_3_dep_extract (frame)
local page = mw.title.getCurrentTitle(); -- get a page object for this page
local content = page:getContent(); -- get unparsed content
local lang_table = {}; -- languages go here
local code;
local names;
local file_date = 'File-Date: ' .. frame.args["file-date"]; -- set the file date line from |file-date=
for code, name in mw.ustring.gmatch (content, '%f[%a](%a%a%a)\t([^\t]+)\t[^\n]+\n') do -- get code and 'forward' name
if code then
table.insert (lang_table, "[\"" .. code .. "\"] = {\"" .. name .. "\"}"); -- make new table entry
elseif not code then
table.insert (lang_table, "[\"error\"] = {" .. record .. "}"); -- code should never be nil, but inserting an error entry in the final output can be helpful
end
end
table.sort (lang_table)
-- make pretty output
return "<br /><pre>-- " .. file_date .. "<br />return {<br />	" .. table.concat (lang_table, ',<br />	') .. "<br />	}<br />" .. "</pre>";
end
return p;