Module:CentralSchool/
La documentation pour ce module peut être créée à Module:CentralSchool//Documentation
local CentralSchool = require("Module:CentralSchool") -- The main central module install central libraries and bind the main and its sub-modules
local p = CentralSchool -- Save as ModuleCentralSchool French town coutry monument 20181008.lua
-- See the documentation in: mediawiki:Scribunto/CentralScool_modules_reference_manual
-- Module:CentralSchool only tests sections titles when renew drop_box.lua From 2018-07-19
p.version = { -- Modules dependencies. Dependencias del módulo. Dépendances du module.
versionName = "CentralSchool-s-fr", versionNumber = "1.0.0(181008T08:15)", versionDate = "2018-10-08T08:15:00", --MWMW NOWNOW
-- UTC version structure : main.fonction.task(yymmddThh:mm)
mainDescription = "Begin to use", functionDescription = "first functional support", taskDescription = "Update modes.get_args(args_known) -- Interactions between arguments",
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis
-- function tableview.table_rows(t) -- Formats rows of tables in direct html
sought = "Centralizer;CentralSchool;CentralSchool/I18N;Mathroman;TestRequire", -- Sought module and submodules versions
known = "Centralizer;Centralizer-s-fr * CentralSchool;CentralSchool-s-fr;CentralSchool-14 * CentralSchool/I18N;CentralSchool/i18n * Mathroman22;Mathroman34", -- Known module and submodules versions
} -- Task details : ...() from 2018-07-28 = for 14 days.
-- https://www.mediawiki.org/wiki/Module:drop_box https://fr.wikisource.org/wiki/Module:drop_box
CentralSchool.CentralScool_version = CentralSchool.version.versionName
p.ModuleNS = mw.site.namespaces.Module.name .. ":" -- translate Module: in other languages
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- Development guide line for i18n translations
-- A central module could need a translation service and a versioning service to enhance its functions or its stability without disturbing the preview normal use.
-- A main module can define its sought sub-modules versions names and its known sub-modules versions names.
-- The Library:versions installs other libraries, supports versions, binds modules, libraries and i18n translations.
-- A central module and its translations can inpedendently change. Its p.version{} identifications change also.
-- For this goal a module contains at least one i18n tranlations table. Its /I18N sub-modules contains translations in several languages.
-- CentralSchool Libraries, like modules, contain their own p.version{} identifications and i18n translations in Module:Library/library_name/I18N.
-- The adaptation to any number of languages is automatic.
-- The highest level is the main module. The lowest level is the libraries level.
--
-- Any module or library can contain i18n tables.
-- i18n tables are mixed from the lowest to the highest level, to permit at upper module to adapt the meaning of string to a new use.
-- Each library is independent of other ones and they can be mixed in any order.
-- To avoid conflict of translations keys between libraries, all translations keys names start with the library name.
--
-- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- The central system permits to convert any module as central.
-- The Lua part of the central modules support contains some libraries used by central modules.
-- The Module:CentralSchool is made to easy understand how to build a central module
-- An object has a function object.new() to form several objects
-- A library is unic and come from Scribunto.
CentralSchool.infos = { -- from 20180831
["libname"] = "CentralSchool", typ = "Module",
libdesc = "The CentralSchool module is made to easy understand how to build a central module.",
versfirst = "2018-08-31T19:45:00", verslast = "2018-08-31T19:45:00",
versionName = "CentralSchool", versionNumber = "180831T19:45", versionDate = "2018-08-31T19:45:00", -- UTC
versions = {
{ ["libname"] = "CentralSchool", verstime = "2018-08-31T19:45:00", versid = "1.0.31T19:45", phabtask = "T135845", subtask = "S180106arg", change = "to understand central module", },
{ ["libname"] = "CentralSchool", verstime = "2018-08-31T19:45:00", versid = "1.0.31T19:45", phabtask = "T135845", subtask = "S170901mMW", change = "MWversions_report()", },
{ ["libname"] = "CentralSchool", verstime = "2013-03-12T12:00:00", versid = "130312.1200", phabtask = "T135845", subtask = "S000000new", change = "new: manage translations, arguments for central modules", },
}, -- infos.version
} -- infos
-- cut_libraries
p.i18n = {} -- translations tables known in the module
p.i18n.en = { -- Translations in English
-- All arguments have a keyword identical to the registration name, except synonyms.
-- Tous les arguments ont un keyword identique au nom d'enregistrement, sauf les synonymes.
args_known_country_en = "England",
args_known_flag_en = "Flag of England.svg",
args_known_monument_en = "St Paul's Cathedral",
args_known_town_en = "London",
-- Arguments to import, do not translate.
p_template_drop_box_name = "Drop-down box", -- Template: Drop-down box for drop_box.form
c = "c",
mode = "mode",
options = "options",
itemid = "itemid",
QITEM = "QITEM",
uri = "uri",
--
-- Translate all the following arguments:
-- Arguments linked to the main module
lastname = "name",
lastname_descr = "Family name. Please specify to correct the sort key.",
firstname = "firstname",
firstname_descr = "First name. Please specify to correct the sort key.",
firstname2 = "firstname",
firstname2_descr = "First name. Please specify to correct the sort key.",
initial = "initial",
initial_descr = "Initial to correct the category of authors.",
title = "title",
title_descr = "Page title, automatic.",
country = "country",
flag_of_country = "Flag of England.svg",
flag_of_country_descr = "Flag of the country",
occupation_cat = "%1",
year_number_cat = "Year %1",
-- birth and death
birthday = "birthday", -- birthday P569
birthday_descr = "Day of birth.",
birthyear = "birthyear",
birthyear_descr = "Year of birth.",
p_authors_birthyear_cat = "%1 births",
deathday = "deathday", -- deathyear P570
deathday_descr = "Day of death.",
deathyear = "deathyear",
deathyear_descr = "Year of death.",
p_authors_deathyear_cat = "%1 births",
description = "description",
description_descr = "Description of the author, to clarify if the automatic description does not fit.",
description = "description",
description_descr = "Author's description, to clarify whether the automatic description does not fit.",
-- Arguments limited to multiple values
region = "region", -- argument with verified multiple values
region_descr = "Region to determine the ancient periods.",
region_values = "other;china;india;century", -- wiki_selectors
rights = "rights",
rights_descr = "Necessary copyrights type: 70,50,mpf,ONU,non.",
rights_values = "70;50;mpf;ONU;none",
sex = "sex",
sex_descr = "Genre of the author",
sex_values = "male;female",
} -- p.i18n.en
p.i18n.es = { -- Translations in espagnol
-- Importar estos argumentos. No traducir.
args_known_country_es = "España",
args_known_flag_es = "Flag_of_Spain.svg",
args_known_monument_es = "Madrid_-_Plaza_Mayor_-_121212_140648.jpg",
args_known_town_es = "Madrid",
p_template_drop_box_name = "Cuadro desplegable", -- Modelo: cuadro desplegable :Boîte déroulante for drop_box.form
c = "c",
mode = "mode",
options = "options",
itemid = "itemid",
QITEM = "QITEM",
uri = "uri",
--
-- Traducir todos los los argumentos siguientes:
-- Argumentos relacionados con el módulo principal
occupation_cat = "%1",
p_authors_deathyear_cat = "Autores-%1",
year_number_cat = "Año %1",
-- Nombres y descripciones de los argumentos
lastname = "nombre",
lastname_descr = "Nombre. Por favor, especifique para corregir la clave de ordenación.",
firstname = "apellido",
firstname_descr = "Primero. Proponer para corregir la autómata.",
firstname2 = "primero",
firstname2_descr = "Primero. Proponer para corregir la autómata.",
initial = "inicial",
initial_descr = "Inicial para corregir la categoría de los autores.",
title = "titulo",
title_descr = "Título de la página, automático.",
country = "país",
flag_of_country = "Flag_of_Spain.svg",
flag_of_country_descr = 'Bandera del país',
-- nacimiento y muerte
birthday = 'nacimientodía', -- nacimiento P569
birthday_descr = "Día de nacimiento.",
birthyear = 'nacimientoaño',
birthday_descr = "Año de nacimiento.",
p_authors_birthyear_cat = "N%1", -- es.wikisource N1802 - F1885
deathday = 'muertedía', -- muerte P570
deathday_descr = "Día de muerte",
deathyear = 'muerteaño',
deathyear_descr = "Año de muerte",
p_authors_deathyear_cat = "F%1", -- es.wikisource N1802 - F1885
description = 'descripcion',
description_descr = "Descripción del autor, para aclarar si la descripción automática no encaja.",
-- Argumentos limitados a múltiples valores
region = 'región',
region_descr = 'Región para determinar los tiempos antiguos.',
region_values = "otro;china;india;siglo",
rights = 'derechos',
rights_descr = "Tipo de derechos de autor necesario: 70,50,mpf,ONU,non.",
rights_values = '70;50;mpf;ONU;no',
sex = 'sex',
sex_descr = 'Género del autor',
sex_values = 'hombre;mujer',
} -- p.i18n.es
p.i18n.fr = { -- Translations in français
-- Arguments à importer. Ne pas traduire.
args_known_country_es = 'France',
args_known_flag_es = 'Flag_of_France.svg',
args_known_monument_es = 'Tour Eiffel',
args_known_town_es = 'Paris',
p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form
c = 'c',
mode = 'mode',
options = 'options',
itemid = 'itemid',
QITEM = 'QITEM',
uri = 'uri',
--
-- Traduire tous les arguments suivants :
-- Arguments liés au module principal
occupation_cat = '%1',
p_authors_deathyear_cat = "Auteurs-%1",
year_number_cat = "Année %1",
-- Noms et descriptions des arguments
lastname = 'nom',
lastname_descr = "Nom. A préciser pour corriger la clé de tri.",
firstname = 'prénom',
firstname_descr = "Prénom. A préciser pour corriger la clé de tri.",
firstname2 = 'prenom',
firstname2_descr = "Prénom. A préciser pour corriger la clé de tri.",
initial = 'initiale',
initial_descr = "Initiale pour corriger les catégories d'ateurs.",
title = 'titre',
title_descr = "Titre de la page, automatique.",
country = 'pays',
flag_of_country = 'Flag_of_France.svg',
flag_of_country_descr = 'Drapeau du pays',
-- naissance et deces
birthday = 'jourNaissance', -- nacimiento P569
birthday_descr = "Jour de naissance.",
birthyear = 'anneeNaissance',
birthyear_descr = "Année de naissance",
p_authors_birthyear_cat = "Naissance en %1", -- fr.wikisource Naissance en 1802 Décès en 1885
deathday = 'jourDeces', -- muerte P570
deathday_descr = "Jour de décès",
deathyear = 'anneeDeces',
deathyear_descr = "Année de décès",
p_authors_deathyear_cat = "Décès en %1", -- fr.wikisource Naissance en 1802 Décès en 1885
description = 'description',
description_descr = "Description de l'auteur, à préciser si la description automatique ne convient pas",
--
-- Arguments limités à des valeurs multiples
region = 'région',
region_descr = 'Région pour déterminer les époques anciennes.',
region_values = "autre;chine;inde;siècle", -- wiki_selectors
rights = 'droits',
rights_descr = "Type de droits d'auteur nécessaire parmi : 70,50,mpf,ONU,non.",
rights_values = '70;50;mpf;ONU;non',
sex = 'sexe',
sex_descr = "Sexe de l'auteur",
sex_values = 'homme;femme',
} -- p.i18n.fr
-- - - - ------------------ - - - - ---------------------------------
-- p.i18n tables end
-- - - - ------------------ - - - - ---------------------------------
-- - - - ------------------ - - - - ---------------------------------
-- Arguments table, to change in calling modules
-- - - - ------------------ - - - - ---------------------------------
p.args_known = { -- Table of the definitions of all known arguments at module level. -- ric (p.box1 box_read box_edit)
-- Arguments in order without names, with their keyword for use as other arguments.
-- Special arguments to modify the fonctions and outputs of this module.
-- Arguments speciaux pour modifier le fonctionnement et les sorties de ce module.
["category"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "category"},
["docfunc"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "docfunc"},
["docitem"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "docitem"},
["dockey"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "dockey"},
["itemid"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "itemid"}, -- Property:P2959 points to a double of the item.
["mode"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "mode"},
["options"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "options"},
["contentlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "contentlang"},
["pagelang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "pagelang"},
["userlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "userlang"},
["country"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "country", ["prop"] = "P27", },
-- ["countryRANK"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "country", ["prop"] = "P27", ["RANK"] = "RANK_NORMAL", },
["birthyear"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", },
["deathyear"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "deathyear", ["prop"] = "P570", ["format"] = "year", },
["lastname"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "lastname", ["prop"] = "P734", },
["lastname2"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "lastname", ["prop"] = "P734", ["syn"] = 2, },
["firstname"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "firstname", ["prop"] = "P735", },
["firstname2"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "firstname", ["prop"] = "P735", ["syn"] = 2, },
["initial"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "initial", ["prop"] = "P735", },
["title"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "label", ["prop"] = "P735", ["syn"] = 2, },
["personlang"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "personlang", ["prop"] = "P1412", },
["description"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "description",["prop"] = "description", },
["label"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "label" , ["prop"] = "label", ["prop_default"] = "Aristote", },
["labelcontent"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labelcontent", ["prop"] = "labelcontent", },
["labelpage"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labelpage", ["prop"] = "labelpage", },
["labeluser"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labeluser", ["prop"] = "labeluser", },
["labelbylang"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labelbylang",["prop"] = "labelbylang", },
["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", ["prop_default"] = "QITEM", },
["sitelink"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "sitelink", ["prop"] = "sitelink", },
["Eiffel"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "Eiffel", ["prop"] = "P18", ["item"] = "Q243", ["prop_default"] = "Tour Eiffel", },
["Eiffel_town"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "Eiffel_town", ["prop"] = "P127", ["item"] = "Q90", ["prop_default"] = "Paris", },
["Paris"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "Paris", ["prop"] = "P127", ["item"] = "Q90", ["prop_default"] = "Paris", },
["Eiffel_country"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "Eiffel_country", ["prop"] = "P17", ["item"] = "Q142", ["prop_default"] = "France", },
["France"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "France", ["prop"] = "P17", ["item"] = "Q142", ["prop_default"] = "France", },
} -- #p.args_known = 34 on 2018-10-08
-- Display the documentation in an infobox, similar to edit-boxs
-- Affichage de documentation dans un cadre (box), semblable aux boites d'edition
function p.box_edit(args_final)
-- read = " box1 ",
-- edit = " box1 docdef docline docsrc docdata catview docview : ",
-- doc = " nobox1 noerr nocatview ",
-- tests = " box1 docdef docline docsrc docdata catview docview : tests ",
local res, props = "", datas.props
if type(args_final) ~= "table" then args_final = modes.args_final end -- optional arguments
langs.init_content_page_user_lang(modes.args_source.contentlang, modes.args_source.pagelang, modes.args_source.userlang)
-- res = res .. "<center><small>" .. viewers.discreet_main_version() .. viewers.ta("contentlang", langs.content_lang) .. viewers.ta("pagelang", langs.page_lang) .. viewers.ta("userlang", langs.user_lang)
res = res .. "(p.box_edit) "
res = res .. "<center>" .. viewers.discreet_main_version() .. viewers.ta("content", langs.content_lang) .. viewers.ta("page", langs.page_lang) .. viewers.ta("user", langs.user_lang)
res = res .. " - [https://fr.wikisource.org/wiki/mediawiki:Scribunto/CentralScool_modules_reference_manual User manual]"
res = res .. " - [[phab:T135845|T135845 Convert]]"
res = res .. " - [[phab:T198107|T198107]] Begin to use" .. "</center>"
res = res .. viewers.styles_color_error("<center><b>" .. viewers.form9user("modes_delete_docbox_wng") .. "</b><br/></center>")
res = res .. drop_box.form(drop_box.new_title(), versions.form_support_desk_report() )
if modes.option("debug") then res = res .. "\n*" .. viewers.ta("modes.cat_view", modes.cat_view) .. viewers.ta("modes.template_options", modes.template_options) .. viewers.ta("modes.mode_options", modes.mode_options) end
local lnk = props.QITEM
if modes.option("docdata") then res = res .. "\n*" .. modes.generDoc(" docdef docline ", datas.args_wikidata, datas_link) end
res = res .. ", " .. viewers.form9user(" (%1 properties)", (datas.propss_count_all or "") ) -- datas_structured_data_txt
if modes.option("docview") then res = res .. "\n*" .. modes.generDoc("", args_final, "Arguments") end
if not modes.option("noerr")then res = res .. "\n*" .. events.errors_lister() end
local t = "" -- Formats events views
-- local wng, err, cat = events.sort_typ() -- Sort events by type in wng, err, cat.
-- if evt.typ == "wng" then evt.res = viewers.styles_color_warning(evt.user_wkt) end
-- if new_evt then table.insert(events.list_all_events, evt) end
for key, evt in pairs(events.list_all_events) do
if evt.typ == "wng" then
evt.res, evt = events.form(evt)
if evt.res then t = t .. "<br>* " .. tostring(evt.res) end
end
end
--
for key, evt in pairs(events.list_all_events) do
if evt.typ == "err" then
evt.res, evt = events.form(evt)
if evt.res then t = t .. "<br>* " .. tostring(evt.res) end
end
end
--
for key, evt in pairs(events.list_all_events) do
if evt.typ == "cat" then
evt.res, evt = events.form(evt)
if evt.res then t = t .. "<br>* " .. tostring(evt.res) end
end
end
t = t .. langs.main_i18n_languages_list() -- List available translations languages
res = res .. t
res = '<div style="margin-right:5px; background-color:#EEEEEE; padding:0.3em; width=90%; overflow-x:hidden; ">' .. res .. '</div>' .. "</b>"
-- local result = "\n------ " -- This code interact with drop_box and debug the bug T20151215 2016-11-13 17:57.
-- result = result .. '<div class="CentralScoolDocBox" style=" width=90%; border: 1px solid #AAAAAA; margin:1em; background-color:#F1F1F1; padding:0.3em; ">' .. res .. '</div>'
-- result = result .. "\n* " .. events.categories_lister(":")
return res
end -- function p.box_edit(args_final)
function p.box_read(prop, title) -- Draw the main box one. -- ric (p.box1 box_read box_edit)
-- Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001), Christophe Colomb (Q7322),
-- Nelson Mandela (Q8023), Rudyard Kipling (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772)
-- datas.default_item = "Q7322"
local QITEM = datas.QITEM or datas.default_item
datas.prop, datas.props = datas.get_item(modes.args_known, QITEM) -- Get datas from mw.wikibase for the page.
--[[
for lang, lang_group in pairs(p.i18n) do -- Add datas from p.args_known in modes.args_known
for key, val in pairs(lang_group) do -- function datas.get_item(
if string.find(key, "args_known_") == 1 then
if string.find(key, "args_known_country_") == 1 then datas.prop["country"] = lang_group["args_known_country_en"] end
if string.find(key, "args_known_flag_") == 1 then datas.prop["flag"] = lang_group["args_known_flag_en"] end
if string.find(key, "args_known_monument_") == 1 then datas.prop["monument"] = lang_group["args_known_monument_en"] end
if string.find(key, "args_known_town_") == 1 then datas.prop["town"] = lang_group["args_known_town_en"] end
end
end
end
p.i18n.en = { -- Translations in English
-- All arguments have a keyword identical to the registration name, except synonyms.
-- Tous les arguments ont un keyword identique au nom d'enregistrement, sauf les synonymes.
args_known_country_en = "England",
args_known_flag_en = "Flag of England.svg",
args_known_monument_en = "St Paul's Cathedral",
args_known_town_en = "London",
--]]
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
local prop = datas.prop
local res = "(p.box_read) "
local flag = viewers.form_image(viewers.form9user("flag_of_country"), 50)
local image = viewers.form_image(prop.image, 50)
local birthyear_deathyear = " ( " .. (prop.birthyear or "birthyear") .. " - " .. (prop.deathyear or "deathyear") .. " ) " -- ["birthyear"] ["deathyear"]
local phabtask = " - [[d:" .. QITEM .. "|Datas]] "
res = res .. "<b>sitelink: " .. prop.sitelink .. phabtask .. "</b></center>" .. " - [[d:" .. QITEM .. "|Datas]] "
res = res .. "<br/><center>Labels in langs: <b>" .. prop.labelbylang .. "</b>, user: <b>" .. prop.labeluser .. "</b>, content: <b>"
res = res .. prop.labelcontent .. "</b>, page: <b>" .. prop.labelpage .. "</b>"
res = res .. "<br/><center><b>description: " .. prop.description .. birthyear_deathyear .. "</b></center>"
res = res .. "<br/><center>" .. flag .. " * used languages: user:<b>" .. langs.user_lang .. "</b>, content:<b>" .. langs.content_lang .. "</b>, page:<b>" .. langs.page_lang
res = res .. "</b> * " .. image .. "</center>"
-- res = res .. "<br/><center>languages:<b>" .. langs.main_i18n_languages_list() -- List available translations languages
res = '<div style="margin-right:5px; box-shadow:0.2em 0.3em 0.2em #B7B7B7; background-color:#F1F1DE; padding:0.3em; width=90%; overflow-x:hidden; ">' .. res .. '</div>' .. "</b>"
return res
end -- function p.box_read(args_final, title)
function p.form_tests_init(res, args_source)
-- Special init for the test mode
if type(res) ~= "string" then res = "\n* Mode test : " end
if type(args_source) ~= "table" then args_source = modes.args_source or {} end
if p.i18n and p.i18n.en then p.i18n.en.error_i18n_wanted_to_test_missing_translation = 'English error i18n wanted for tests missing translation' end
if p.i18n and p.i18n.es then p.i18n.es.error_i18n_deseada_para_probar_traduccion_faltan = 'Espagnol error i18n deseada para probar traducción faltan' end
if p.i18n and p.i18n.fr then p.i18n.fr.error_i18n_voulue_pour_test_de_traduction_manquante = 'Français erreur i18n voulue pour tests de traduction manquante' end
-- if not args_source.userlang then args_source.userlang = "en" end
-- if not args_source.contentlang then args_source.contentlang = "es" end
if not args_source.modeinvoke then args_source.modeinvoke = "catview" end
if not args_source.mode_invoke then args_source.mode_invoke = "catview" end
if not args_source.template_options then args_source.template_options = "catview" end
if not args_source.name then args_source.name = "Jack Smith" end
if not args_source.nom then args_source.nom = "Victor Hugo" end
if not args_source.region then args_source.region = "india" end
if not args_source["région"] then args_source["région"] = "chine" end
if not args_source.description then args_source.description = "Victor Hugo est très connu." end
if not args_source.langue then args_source.langue = "français,japonais" end
if not args_source.occupation then args_source.occupation = "Académiciens,Personnalités politiques" end
modes.args_source = args_source
return res
end -- function p.form_tests_init(res, args_source)
function p.interact_args_final(args_import, args_known)
local t = ""
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { -- }
if type(args_import) ~= "table" then args_import = modes.args_import or {} end
local args_final = mw.clone(args_import) -- do not disturb original args_import
local a = args_import
local i = {} -- interact
local tit = nil
if not a.title then -- If title is undefined, enforce it.
if a.lastname and a.firstname then
tit = a.firstname .. " " .. a.lastname
end
i.title = a.label or modes.main_title or a.QITEM or a.itemid or a.title or tit
end
--
if a.docfunc then a.docfunc = mw.text.trim(a.docfunc) end -- dockey docitem args_known = { i18n.vi
if a.docitem then a.docitem = mw.text.trim(a.docitem) end -- dockey docitem args_known = { i18n.vi
if a.dockey then a.dockey = mw.text.trim(a.dockey) end -- dockey docitem args_known = { i18n.vi
if not a.QITEM then -- The Title can come from several arguments to insure it.
-- i.QITEM = a.label or modes.main_title or a.QITEM or a.itemid or a.title
-- i.QITEM = mw.text.trim(i.QITEM or "Q7322") -- Christophe Colomb
-- Galilée (Q307), Victor Hugo (Q535), Aristote (Q868), Albert Einstein (Q937), Mohandas Karamchand Gandhi (Q1001), Christophe Colomb (Q7322),
-- Nelson Mandela (Q8023), Rudyard Kipling or "Q (Q34743), Martin Fleischmann (Q899264), Emmanuel Macron (Q3052772)
else
a.QITEM = a.QITEM or datas.default_item
a.QITEM = mw.text.trim(a.QITEM)
end
--
-- if absent, synonym of basic arguments, syn = 2
if not a.firstname then i.firstname = (i.firstname2 or a.firstname2) end
if not a.lastname then i.lastname = (i.lastname2 or a.lastname2) end
if not a.firstname2 then i.firstname2 = (i.firstname or a.firstname) end
if not a.lastname2 then i.lastname2 = (i.lastname or a.lastname) end
--
if not a.initial then -- If initial is undefined, enforce it.
if a.lastname then
i.initial = string.sub( a.lastname, 1, 1 ) -- selector the first letter
i.initial = string.upper( i.initial or "*" )
end
end
--
local label = a.label or a.labeluser or a.labelpage or a.labelcontent or a.labelbylang
if label then i.label = label
else
events.add_err( viewers.form9user("versions_with_internal_error") )
events.add_cat( viewers.form9user("versions_with_internal_error_cat") )
end
--
if a.birth and not a.birthyear then
local tt, err = viewers.date_to_part(a.birth, viewers.form9user("modes_date_to_part_format"), "yyyy")
if tt then i.birthyear = tt else
events.add_err(err, viewers.form9user("birthyear"), "yyyy")
events.add_cat("modes_date_to_part_call_cat")
end
end
-- memorize interactions in modes.args_final and show errors or warnings
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
local n = 0
for key, val in pairs(i) do
local argskwn = args_known[key]
if type(argskwn) == "table" then
args_final[key] = val -- = i[key]
args_final.src = "inter"
n = n + 1
if (args_final.need == 2) and not a[key] then --
-- need = 2 necessary from argument or module interaction
events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result
end
else
events.add_err("modes_unknown_auto_arg_err", langs.content_translations[key], val)
end
end
modes.args_final = args_final
return args_final, t
end -- args_final = p.interact_args_final(args_import)
-- - - - ------------------ - - - - ---------------------------------
-- - - - ------------------ - - - - ---------------------------------
-- Interfaces, alias and functions to templates
-- Interfaces, alias y funciones para modelos
-- Interfaces, alias et fonctions pour les modèles
-- - - - ------------------ - - - - ---------------------------------
-- - - - ------------------ - - - - ---------------------------------
function CentralSchool.init(frame, CentralScool_version, mode_name, args_known, options_for_modes)
-- p.version.versionNumber = CentralScoolI18N.version.versionNumber
local res = ""
-- tracker.init_trakers() -- Initialize some trakers. To run in CentralSchool.init()
modes.time1 = os.clock()
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
CentralScool_version = CentralScool_version or langs.CentralScool_version or CentralSchool.CentralScool_version
options_for_modes = options_for_modes or modes.options_for_modes or p.options_for_modes
res = res .. versions.init(frame, CentralScool_version)
versions.memo_i18n = mw.clone(versions.main_i18n or langs.main_i18n)
langs.main_i18n = versions.memo_i18n ; versions.main_i18n = versions.memo_i18n
local datas = mw.clone(datas)
res = res .. modes.init_modes_translate_events(frame, CentralScool_version, mode_name, modes.args_known, options_for_modes, QITEM or itemid)
-- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", default_item = "Q34743", },
for key, one_arg in pairs(args_known) do
local argskwn = args_known[key]
if type(one_arg) == "table" then
if type(one_arg.default_item == "string") then datas.default_item = one_arg.default_item end -- "Q34743" -- Rudyard Kipling **
end
end
local QITEM = datas.QITEM or datas.default_item -- ** --
datas.props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
modes.init_args_mode_options(mix, mode_name, modes.args_template) -- Import and mix args mode and options from template and invoke -- S170710mix
modes.args_import = modes.import_arguments(args_known, args_source, content_translations, args_wikidata) -- function modes.import_arguments()
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
modes.get_args(args_known) -- Interactions between arguments
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
res = res .. (datas.props_trk or "")
-- p.version.versionNumber = CentralScoolI18N.version.versionNumber
return res
end -- function CentralSchool.init(frame, CentralScool_version, mode_name, args_known, options_for_modes)
function CentralSchool.read(frame) -- The read mode generates the normal result for read only users.
-- Helpers or admins can add options to include edit or tests or user language...
local res = ""
local t = CentralSchool.init(frame, CentralSchool.CentralScool_version, "read", p.args_known, p.options_for_modes)
-- res = res .. t
modes.args_final = p.interact_args_final(modes.args_import) -- Interactions between arguments
res = res .. p.form_result(modes.args_final)
res = res .. "\n* " .. datas.track_val
return res
end -- function CentralSchool.read(frame)
function CentralSchool.begin(frame)
local res = ""
res = res .. "\n* Some examples of author headers, infosbox, ... from 10 first begin modules in langs"
return res
end -- function CentralSchool.begin(frame)
function viewers.doc_group(selector, mask_sections) -- Formats all or any documentations of tests and reports. -- snaks tst
local res = ""
res = res .. viewers.doc_section(selector, "Tests of this page", "h2", mask_sections)
res = res .. drop_box.new(selector, "modes_args_known_report_title", modes.args_known_report)
res = res .. drop_box.new(selector, "activity_report_subtasks_title", activity.central_subtasks_report)
res = res .. drop_box.new(selector, "datas.get_item() Report datas from mw.wikibase **", datas.get_item_report)
res = res .. viewers.doc_page(selector, mask_sections)
res = res .. viewers.doc_module(selector, mask_sections)
res = res .. viewers.doc_internal(selector, mask_sections)
return res
end -- function viewers.doc_group(selector, mask_sections) item:
return p
-- local QITEM = datas.QITEM or datas.default_item
--
-- Tests pages on 2018-06-22 :
-- mediawiki:Scribunto/CentralSchool modules reference manual
--
-- Tests pages on 2018-08-31 :
-- mediawiki:CentralSchool/Documentation -- www.mediawiki.Module:CentralSchool in English
-- Module:Auteur2Tpt -- s.fr.wikisource.Module:Auteur2Tpt in French
-- Module:Auteur2Tpt/Documentation -- s.fr.wikisource.Module:Auteur2Tpt/Documentation in French
-- Module:CentralSchool/Documentation -- s.fr.wikisource.Module:CentralSchool/Documentation in French
-- Modèle:CentralSchool -- s.fr.wikisource.Module:CentralSchool/Documentation in French
--