Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Language/data/ISO 639-3 (dep)/make
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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;
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Language/data/ISO 639-3 (dep)/make/doc
(
edit
)