Module:In lang/sandbox: Difference between revisions

Content deleted Content added
remove Nihongo support; now in Module:Nihongo/sandbox;
m Removed protection from "Module:In lang/sandbox": No longer necessary: Requested at RfPP with one transclusion
 
(5 intermediate revisions by 3 users not shown)
Line 1:
require ('Module:No globalsstrict');
 
 
--[[--------------------------< _ I N _ L A N G >----------------------------------------------------------------
 
implements {{in lang}}
 
Module entry point from another module
Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|<code>|<code2>|<code3>|<code...>|link=yes|template=in lang|list-cats=yes}}
 
|link=yes - creates wikilinked language names
Line 16:
]]
 
local function in_lang_in_lang (frameargs)
local getArgs = require ('Module:Arguments').getArgs;
local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code
local list_cats = 'yes' == args['list-cats']; -- make a boolean
local args = getArgs(frame);
local list_cats = 'yes' == args['list-cats']; -- make a boolean
local list = {};
local cats = {};
Line 30 ⟶ 28:
end
 
local module = 'Module:Lang' .. (framemw.getCurrentFrame():getTitle():match ('/sandbox') or ''); -- if this module is the sandbox,
 
local name_from_tag = require (module)._name_from_tag; -- use Module:Lang/sandbox; Module:Lang else
 
Line 55 ⟶ 54:
end
 
if (0 == namespace) or list_cats then -- when in article space
if lang:find ('error') then -- add error category (message provided by Module:Lang)
if not list_cats then -- don't include this cat when listin cats; TODO: right choice?
Line 86 ⟶ 85:
 
table.insert (result, ')</span>'); -- add closing ) and closing span
table.insert (result, table.concat (maint_msgs) or ''); -- add maint messages, if any
table.insert (result, table.concat (cats)); -- add categories
return table.concat (result); -- make a big string and done
end
 
 
--[[--------------------------< I N _ L A N G >----------------------------------------------------------------
 
implements {{in lang}}
 
Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|<code>|<code2>|<code3>|<code...>|link=yes|template=in lang|list-cats=yes}}
 
]]
 
local function in_lang (frame)
local getArgsargs = require ('Module:Arguments').getArgs (frame);
return _in_lang (args);
end
 
 
Line 189 ⟶ 202:
 
return {
in_lang = in_lang, -- module entry from {{#invoke:}}
native_name_lang = native_name_lang, -- experimental code; may not be retained
_in_lang = _in_lang, -- module entry from another module
 
cat_test = cat_test, -- temporary test code to be deleted