Module:Multilingual
local p = {}▲ avant 2020 ? -- The main central module is mainly an installer of central libraries and a small demonstrator. -- The main central module installs central libraries and bind the main and its sub-modules -- local Central = p -- Save as Mdc.lua Mdc function p.box_read(prop, title) -- GOOD but viewers.form9user(d.content) NO 20200101 2010.lua
|---------------|------------------------------ typical length --------------------------|---------------------------max| DODO
--[[ modes.getTitle() = function() begin return p.mainmodule_name end this is the title of the module invoked
function viewers.drop(selector title content_or_func very good but l 1320 got nil
Erreur Lua : bad argument #1 to 'gsub' (st parcel edit with a good drop box+Box Very good (p.box_read) langs names links OK OK expected, got nil) local t = versions.init_multilingual_module("read", args_known) -- l 10248
function versions.versions_support_test(t) -- Tests various combinations of mod-- frame:getTitle() ---- if frame then local title = frame:getTitle()
-- local main_module = modes.getTitle() -- this is the title of the module invoked
-- if 'main_versions' (a nil value). replace main_versions by from 20171224 infos p.["infos"]["versions"]["libname"]
-- function viewers.form9user(_test(t) -- Tests of viewers.form9user_test(). at 20190830 0809
-- to delete after import of OK OK : tests_groups 647d3c2 box_view t = t or compete at 20190831 1751
--protopyte of tab_view for all tests to standardize unic key : TVTV _test1 to ckeck after " local tab_view = "
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes_args_unknown_report_title",
test_group = modes.args_unknown, -- Use default cases.
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.i, case.where, case.save, }
end,
-- headers = "activity_monitor_central_libraries_headers", -- " Name; Description of the library ",
headers = " Name; Description of the library ",
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details",
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
return t
--]]
-- local title = frame:getTitle() -- this is the title of the module invoked
-- local main_module = versions.get_one_module_or_library(title) -- Get the main module. versions.bind_all_i18n()better
--[[after OK : standard tabview, search all residual anomalies in all tests, clean comments for a normal understanding, /I18N, UMUM
-- then share with the first team of good lua coders, 3*3*3 are OK ,close the begin task. Then split Centralizer in independant libraries.
-- Then Rical, half the time, can begin Teslain with perhaps Jean Louis Naudin, Yves, Lucien, Pascal and the security team.
-- Continue, half the time, to support other lua coders, like all the fist team ...
-- frame:getTitle()
-- function versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n.
local t = t -- t or
if type(t) ~= "string" then t = '\n* langs.translations_counts("activity.i18n") : Counts of contents of some tables' end
-- UMUM : means to report in the CentralManual.
-- MWMW : means add a mw version in the table activity.MediaWiki_Versions = { ... }
-- COCO : is the present change point of Lua codage. hh
-- COCO Story : function activity.phabricator_tasks_report(t, short) -- OK -- arbitrary end added in main Loop pairs(args_known)
-- function versions.init_multilingual_module( MdCentral function viewers.form9content(ref, ...) in debug ERR 201901321.lua
-- %x: (where x is any non-alphanumeric character) represents the character x. This is the standard way to escape the magic characters.
-- x: (where x is not one of the magic characters ^$()%.[]*+-?) represents the character x itself. THEN "%%" give "%"
-- viewers_form9user_abnormal_ref_i_cat = "In the function viewers.form9user(ref, ...) function the reference is abnormal",
else d.header = viewers.form9user("viewers_dropdown_missing_header") end -- "Missing title for this drop_box"
function viewers.drop(selector, title, content_or_func, ...) -- Formats a drop_box for a doc or a group of tests
t = t .. viewers.insert_image(d.image, "22px", d.style, ...) -- example of use
if (type(t) ~= "string") then t = '\n* langs.translations_counts("activity.i18n") Counts of contents of some tables, from their names: ' end
function viewers.form9content(ref, ...) and other functional languages seem ok
function modes.namespaces_page_list(t) -- List namespaces for the actual page.
datas.available_props_report(t) -- Reports availables datas properties **" does not exist
res = res .. "\n*
"
local i18n = langs.main_i18n or versions.main_i18n or versions.memo_i18n from ModuleCentralizer Levenshtein 20181016 ok idem 20190723 1004.lua -- debug t = function activity.central_subtasks_report(t) seams ok 20190729 1702 function modes.namespaces_page_list(t) -- List namespaces for the actual page. seems OK at 20190723 0820 no a nil value function versions.bind_all_sub_modules(sub_modules, iftest) -- Bind all sub-modules of the main module.seems OK at 20190723 0816 local success, result = viewers.AntiCrash(protected_func, selector, mask_sections) -- function viewers.AntiCrash( seems ok : modes.all_categories_list(t) langs.translations_statistics_report(t) activity.phabricator_tasks_report(t, short) return res used in all main viewers, probably good, then residual debug starts on 21/07/2019
--Module:Centralizer à la ligne 10937 -- res = res .. p.form_result(args_known fail ligne 10956 -- The main central module is mainly an installer of central libraries and a small demonstrator. -- The current debugs change only small adjustments in new functions ... -- ********** before 3 3 3 install verify all tests + ;viewers...; + UMUM ********* apres manger . . . function viewers.drop(
-- === Références par module -- -- ===
=== Références par balise ===
res = res .. "\n*
=== Références par module ==="
res = res .. "\n*
"
res = res .. "\n*
=== Références par balise ==="
res = res .. viewers.drop(
-- Running times: start in page = 2421 mS , import + 0 mS , form result + 0 mS , tests + 20 mS , duration = 20 mS ,
|---------------------|------------------------ typical length --------------------------|----------max| DODO
-- We will display, in "err" style, module name + space + line number to link. COCO function viewers.AntiCrash(protected_func, ...) -- Protects the pages of wikipedia against a complete crash, if available. UMUM local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...} modes.args_import = modes.args_import or {} seems OK at 20190530 0747 t = t .. "\n* " .. one_elem["key"] .. " = " .. viewers.form9user(one_elem.trans_key) -- seem ok function modes.all_elements_list(base, list_Kind) -- List all eventual categories or others of this wiki to try modes.arguments = arguments -- arguments values sorted by keyword UMUM -- new to try : function modes.all_categories_list(t) -- List all eventual categories of this wiki -- MdCentral function p.form_result() continue OK 0957.lua function viewers.form9user(ref, ...) seems OK argmt, detailed UMUM --]]
-- only for ModuleCentralizer : restart from : ModuleCentralizer function modes.levenshtein_similar_tests OK.lua DODO -- todo : then use function p.Init_central_module() to replace function versions.init_multilingual_module() -- MUMU : means to report in the CentralManual. -- MWMW : means add a mw version in the table versions.MediaWiki_Versions = { ... } -- COCO : is the present change point of Lua codage. -- MUMU : means to report in the CentralManual. -- TCTC : Development Tactic on 20191227 -- cut_libraries
-- - - - ------------------ - - - - ----------------- - - - - ----------------------------- -- Development Tactic on 20180905 -- 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. -- For this goal a module contains at least one i18n tranlations table. Its /I18N sub-modules contains translations in several languages. -- 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. -- -- Tactic for modules, arguments, options and default values 20180908. -- In all cases the main module protects all original tables, including for itself. -- Permit modules without versions for many existing modules. Modules are also simply tables for data-modules or PageData in Json. -- 3 central functions bind sub-modules, translations and arguments in 3 new tables. -- All arguments can have default values, like "prop_default" for "prop" to use it in case of tests or missing value. -- Do not disturb actual modules, libraries, translations ; only add new structures and most explicit tables of args, i18n, modules, libraries... -- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- The central system permits to convert any module as p. -- The Lua part of the central modules support contains some libraries used by central modules. -- The Module:Centralizer installs central libraries (waiting stable Scribunto central repository). -- An object has a function object.new() to form several objects -- A library is unic and come from Scribunto. -- Unique declarations of libraries and objects: -- To split ModuleCentral-s-fr delete activity. on 2018-01-10T09:35:00 activity = {} -- Library:activity from 20170611 Search story in Central modules.txt -- args = {} -- Object:args from 20180106 form known arguments to import, complete from datas and finalize datas = {} -- Library:datas from ? drop_box = {} -- Object:drop_box from 20170615 rename viewers.drop_box.form() in viewers.drop_box on 20170615 events = {} -- Object:events from ? "events" langs = {} -- Library:langs from i18n tables on 20130118, br-de-en-es-fr-vi from 20170217, lua_table = {} -- Library:lua_table from lua_table.level_list() from 20170808 mathroman = {} -- Library:mathroman from ? modes = {} -- Library:modes from arguments support on 20130125 in Module:Author, 20130312 in Module:ControlArgs central_library = {} -- Object:central_library from versions.central_library on 20171211 in Module:Centralizer tableview = {} -- Object:tableview from 20170208 tab_view = {} -- Object:tab_view from 20170208 tracker = {} -- Object:tracker from 20170628 versions = {} -- Library:versions from versioning on 20170316. From versions support in Module:Author3 on 20150225. viewers = {} -- Library:viewers from 20170209
versions.memo_i18n = versions.memo_i18n or {} versions.memo_i18n["en"] = {} -- local intern_or_use = versions.memo_i18n["en"][key]
p.infos = { -- Basis of the descrition of the main and the subs versions, from 20171224 infos p.["infos"]["versions"]["libname"] ['versionFrom'] = "MdCentral function modes.levenshtein_similar_tests == OK OK.lua", ['versionName'] = "Centralizer", ['versionNumber'] = "1.0.0(2019-08-31T08:20)", ['versionDate'] = "2019-08-31T08:20", -- UTC version structure MWMW 2019-03-02T09:28:00 ['mainDescription'] = "Begin to use", ['functionDescription'] = "first functional support", ['taskDescription'] = "enough advanced to use in CentralSchool Central School OK", -- p_template_drop_box_name = 'Reference', -- Equivalent templates exist in other wikis ['sought'] = "Centralizer;Centralizer/I18N;Mathroman;TestRequire", -- Sought module and submodules versions ['known'] = "Centralizer;Central-s-fr;Central-14 * Centralizer/I18N;Central/i18n * Mathroman22;Mathroman34", -- Known module and submodules versions ['treebranches'] = { -- For each sought. Replace known. Later on 201811207 { "Centralizer", "Central-s-fr", "Central-2017" }, -- upper { "Centralizer/I18N", "Central-s-fr", "Central-2018" }, -- median luatable { "Mathroman22", "Mathroman34" }, -- lower } -- { site = "www.MediaWiki", verstime = "2019-08-28T19:03:19", versid = "1.34.0-wmf.20 (1488aca)", seen_time = "2019-08-30T08:00:00", }, } -- MWMW "1.34.0-wmf.20 (1488aca)"
if frame then local title = frame:getTitle() -- this is the title of the module invoked versions.main_module = require( title ) -- this is the main module invoked versions.module_name = title -- this is the title of the module invoked
versions.module_version = versions.main_module["infos"]["versions"]["libname"] -- Get the main_version. versions.main_module = versions.main_module -- this is the main module invoked versions.module_name = title -- this is the title of the module invoked versions.module_version = versions.main_module["infos"]["versions"]["libname"] -- Get the version of the main module.
modes.module_version = modes.main_module["infos"]["versions"]["libname"] -- Get the main_version. modes.main_module = modes.main_module -- this is the main module invoked modes.module_name = title -- this is the title of the module invoked modes.module_version = modes.main_module["infos"]["versions"]["libname"] -- Get the version of the main module. versions.main_module = p -- this is the main module invoked versions.main_module.module_name = "Centalizer" -- this is the title of the module invoked modes.main_module = p -- this is the main module invoked --[[ example of use to get the main module or is name main_module = versions.main_module module_name = versions.module_name main_module.title = versions.module_name main_module = modes.main_module module_name = modes.module_name main_module.title = modes.module_name --]] end -- local main_module = versions.get_one_module_or_library(title) -- Get the main module. versions.bind_all_i18n()better
-- cut_libraries
-- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - --------------------------------- -- The Library:activity supports Lua-coders sub-tasks and inter-wikis central modules. -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - --------------------------------- -- Last MediaWiki-Wikisource update/upgrade versions: -- Seen and recorded at each preview to test fr.wikisource.org/wiki/Module:Centralizer-s-fr -- French time UTC +1 or +2 -- See ISO 8601 time format like : 1977-04-22T01:00:00-05:00 (5 shift hours) = 1977-04-22T06:00:00Z local time
versions.MediaWiki_Versions = { -- KEEP FIRST VERSIONS { site = "fr.wikisource", verstime = "2016-06-19", versid = "2016-06-19", seen_time = "2016-06-19", }, { site = "fr.wikisource", verstime = "2017-05-11T00:48:00", versid = "1.29.0-wmf.21 (d6c07d1)", seen_time = "2017-05-11T00:48:00-00:00", task = "T165000", title = "The version date of MW 1.29.0-wmf.21 (d6c07d1) is in the future !", report = "Rical: Schedule in https://www.MediaWiki.org/wiki/MediaWiki_1.29/Roadmap", }, -- function versions.detect_MediaWiki_changes() display only 3 last months { site = "fr.wikisource", verstime = "2018-01-02T18:49:06", versid = "1.31.0-wmf.15 (8e46998)", seen_time = "2018-01-04T14:20:00", }, { site = "fr.wikisource", verstime = "2018-01-04T21:47:05", versid = "1.31.0-wmf.15 (601cf9d)", seen_time = "2018-01-07T18:30:00", }, { site = "fr.wikipedia", verstime = "2018-01-07T20:46:36", versid = "1.31.0-wmf.15 (0953700)", seen_time = "2018-01-09T20:57:00", }, { site = "fr.wikisource", verstime = "2018-01-07T20:46:36", versid = "1.31.0-wmf.15 (0953700)", seen_time = "2018-01-12T07:43:00", }, { site = "fr.wikisource", verstime = "2017-12-15T23:35:09", versid = "1.31.0-wmf.16 (a31d45c)", seen_time = "2018-01-12T07:43:00", task = "T155624", title = "In wikisource/Spécial:Version:wmf.15 (0953700) but Central module mw = 1.31.0-wmf.16 (a31d45c) seen by Rical.", }, { site = "fr.wikisource", verstime = "2019-08-04T20:25:27", versid = "1.32.0-wmf.24 (9291e40)", seen_time = "2019-08-04T20:26:00", }, { site = "fr.wikisource", verstime = "2019-08-04T20:30:15", versid = "1.32.0-wmf.24 (35fb3b6)", seen_time = "2019-08-04T20:50:00", }, { site = "fr.wikisource", verstime = "2019-08-02T19:17:19", versid = "1.34.0-wmf.16 (22b2132)", seen_time = "2019-08-05T08:00:00", }, { site = "fr.wikisource", verstime = "2019-08-06T13:16:22", versid = "1.34.0-wmf.16 (6b18b66)", seen_time = "2019-07-30T09:28:00", }, { site = "www.MediaWiki", verstime = "2019-08-06T19:21:52", versid = "1.34.0-wmf.17 (b1c1329)", seen_time = "2019-08-07T08:00:00", }, { site = "fr.wikisource", verstime = "2019-08-07T01:28:02", versid = "1.34.0-wmf.17 (09c0989)", seen_time = "2019-08-08T05:40:00", }, { site = "fr.wikisource", verstime = "2019-08-09T01:41:20", versid = "1.34.0-wmf.17 (6566628)", seen_time = "2019-08-16T09:20:00", }, { site = "fr.wikisource", verstime = "2019-08-20T13:58:22", versid = "1.34.0-wmf.17 (3ab1ed1)", seen_time = "2019-08-16T06:40:00", }, { site = "fr.wikisource", verstime = "2019-08-22T14:22:26", versid = "1.34.0-wmf.19 (efab97f)", seen_time = "2019-08-23T07:50:00", }, { site = "fr.wikisource", verstime = "2019-08-26T13:22:33", versid = "1.34.0-wmf.19 (451f99e)", seen_time = "2019-08-28T10:00:00", }, { site = "www.MediaWiki", verstime = "2019-08-28T19:03:19", versid = "1.34.0-wmf.20 (1488aca)", seen_time = "2019-08-30T08:00:00", }, { site = "fr.wikisource", verstime = "2019-09-04T19:46:10", versid = "1.34.0-wmf.21 (486add2)", seen_time = "2019-09-07T08:00:00", }, { site = "fr.wikisource", verstime = "2019-09-11T03:14:16", versid = "1.34.0-wmf.22 (12d612c)", seen_time = "2019-09-12T10:30:00", }, { site = "fr.wikisource", verstime = "2019-09-18T19:05:17", versid = "1.34.0-wmf.23 (db0e380)", seen_time = "2019-09-19T09:30:00", }, { site = "fr.wikisource", verstime = "2019-09-19T19:44:08", versid = "1.34.0-wmf.23 (b2b9fbf)", seen_time = "2019-09-20T08:00:00", }, { site = "fr.wikisource", verstime = "2019-09-25T19:04:32", versid = "1.34.0-wmf.24 (9d74db9)", seen_time = "2019-09-26T06:20:00", }, { site = "fr.wikisource", verstime = "2019-10-01T01:21:40", versid = "1.34.0-wmf.24 (48381c8)", seen_time = "2019-10-01T21:00:00", }, { site = "fr.wikisource", verstime = "2019-10-03T01:18:05", versid = "1.34.0-wmf.25 (4750f81)", seen_time = "2019-10-04T06:00:00", }, { site = "fr.wikisource", verstime = "2019-10-07T21:06:43", versid = "1.34.0-wmf.25 (54dbe5f)", seen_time = "2019-10-04T06:00:00", }, { site = "www.MediaWiki", verstime = "2019-10-08T20:09:47", versid = "1.35.0-wmf.1 (64f5c4c)", seen_time = "2019-10-09T06:00:00", }, { site = "fr.wikisource", verstime = "2019-10-22T13:14:28", versid = "1.35.0-wmf.2 (21e7707)", seen_time = "2019-10-23T09:00:34", }, { site = "www.MediaWiki", verstime = "2019-10-22T14:57:49", versid = "1.35.0-wmf.3 (1ed75b4)", seen_time = "2019-10-23T09:00:00", }, { site = "fr.wikisource", verstime = "2019-10-24T13:04:24", versid = "1.35.0-wmf.3 (82aecf8)", seen_time = "2019-10-25T09:30:00", }, { site = "fr.wikisource", verstime = "2019-10-24T13:04:24", versid = "1.35.0-wmf.4 (aef2d22)", seen_time = "2019-10-31T06:00:00", }, { site = "fr.wikisource", verstime = "2019-10-31T19:05:47", versid = "1.35.0-wmf.4 (d11f7c9)", seen_time = "2019-11-01T07:00:00", }, { site = "fr.wikisource", verstime = "2019-11-04T16:26:38", versid = "1.35.0-wmf.4 (7af252a)", seen_time = "2019-11-06T08:00:00", }, { site = "fr.wikisource", verstime = "2019-11-07T20:15:48", versid = "1.35.0-wmf.5 (c5c79e5)", seen_time = "2019-11-09T07:00:00", }, { site = "fr.wikisource", verstime = "2019-11-19T00:24:04", versid = "1.35.0-wmf.5 (5cacfed)", seen_time = "2019-11-19T06:00:00", }, { site = "fr.wikisource", verstime = "2019-11-21T01:00:21", versid = "1.35.0-wmf.5 (8a7d1c0)", seen_time = "2019-11-21T07:00:00", }, { site = "fr.wikisource", verstime = "2019-12-12T17:22:01", versid = "1.35.0-wmf.5 (a473ba0)", seen_time = "2019-12-15T08:00:00", }, { site = "fr.wikisource", verstime = "2019-12-19T13:48:57", versid = "1.35.0-wmf.11 (0cc84b1)", seen_time = "2019-12-24T21:00:00", }, } -- MWMW 1.35.0-wmf.11 (0cc84b1) versions.MediaWiki_version_memo = "1.35.0-wmf.11 (0cc84b1)" versions.MediaWiki_Versions_sort = "<" -- First on end, Last on begin versions.MediaWiki_Versions_sort = ">" -- First on begin, Last on end -- function activity.MW_Versions_report(t) -- Reports versions of MediaWiki for 3 months.
-- cut_libraries
-- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - --------------------------------- -- The Library:activity supports Lua-coders sub-tasks and inter-wikis central modules. -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - ---------------------------------
-- events = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
-- The Module:Centralizer/I18N translations for lua_table library update and complete Module:Centralizer translations. events.i18n = {} -- Translations for events library events.i18n.br = { events_test_projects_title = "Tester et afficher les événements tests pour les projets", events_test_projects_headers = "Type: Clé; Nom, test et valeurs, résultat du test", events_test_MediaWiki_title = "Tester et afficher les événements de test pour MediaWiki", events_test_MediaWiki_headers = "Type: Clé; Nom, test et valeurs, résultat du test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "type; key; argument; result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.br events.i18n.de = { events_test_projects_title = "Testen und Anzeigen von Tests für Projekte", events_test_projects_headers = "Type; Key; Name Test und Werte; Ergebnis des Tests", events_test_MediaWiki_title = "Testen und Anzeigen von Ereignissen für MediaWiki", events_test_MediaWiki_headers = "Type; Key; Name Test und Werte; Ergebnis des Tests", events_test_categ_Test_title = "categ_Test tist: Klassen in einigen Sprachen", events_all_kinds_tests_title = "events.all_kinds_test() Test: alle Arten von Ereignissen (err, wng, cat)", events_all_kinds_tests_headers = "Art; Schlüssel; Argument; Ergebnis", events_add_cat_deprecated = "Elavult funkció a főmodulban.", events_close_without_memo_err = "viewers.restore_configs(memo, where) ohne memo im Modul %1.", events_antiCrash_protect_err = "The antiCrash() Funktion schützt diese Seite vor einem kompletten Absturz aufgrund eines internen Fehlers: %1.", } -- events.i18n.de events.i18n.en = { events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Test categ_Test: categories in some languages", events_all_kinds_tests_title = "events.all_kinds_test() Test: all kinds of events (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "FObsolete function in the main module.", events_close_without_memo_err = "viewers.restore_configs(memo, where) without memo in the module %1.", events_antiCrash_protect_err = "The antiCrash() function protects this page against complete collapse due to an internal error: %1.", } -- events.i18n.en events.i18n.es = { events_test_projects_title = "Prueba y muestra pruebas de eventos para proyectos", events_test_projects_headers = "Tipo; clave; prueba de nombre y valores; resultado de la prueba", events_test_MediaWiki_title = "Prueba y muestra pruebas de eventos para MediaWiki", events_test_MediaWiki_headers = "Tipo; clave; prueba de nombre y valores; resultado de la prueba", events_test_categ_Test_title = "Prueba categ_Test: clases en algunos lenguajes", events_all_kinds_tests_title = "events.all_kinds_test() Prueba: todo tipo de eventos (err, wng, cat)", events_all_kinds_tests_headers = "arte; clave; argumento; resultado", events_add_cat_deprecated = "Función obsoleto en módulo principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sin memo en el módulo %1.", events_antiCrash_protect_err = "La función antiCrash() protege esta página contra un colapso completo debido a un error interna: %1.", } -- events.i18n.es events.i18n.fr = { events_test_projects_title = "Tester et afficher les événements tests pour les projets", events_test_projects_headers = "Type: Clé; Nom, test et valeurs, résultat du test", events_test_MediaWiki_title = "Tester et afficher les événements de test pour MediaWiki", events_test_MediaWiki_headers = "Type: Clé; Nom, test et valeurs, résultat du test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "type; key; argument; result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.fr events.i18n.hu = { events_test_projects_title = "A tesztelés és a megjelenítés teszteli a projektek eseményeit", events_test_projects_headers = "Típus; Kulcs; Névvizsgálat és értékek; A vizsgálat eredményei", events_test_MediaWiki_title = "A tesztelés és a megjelenítés teszteli a MediaWiki", events_test_MediaWiki_headers = "Típus; Kulcs; Névvizsgálat és értékek; A vizsgálat eredményei", events_test_categ_Test_title = "Test categories_Test: kategóriák egyes nyelveken", events_all_kinds_tests_title = "events.all_kinds_test() Teszt: mindenféle esemény (err, wng, cat)", events_all_kinds_tests_headers = "Art; kulcs; érv, eredmény", events_add_cat_deprecated = "Elavult funkció a főmodulban.", events_close_without_memo_err = "viewers.restore_configs(memo, where) memo </ b> nélkül a modulban %1.", events_antiCrash_protect_err = "Az antiCrash() függvény megóvja ezt az oldalt a teljes összeomlás ellen a belső hiba miatt: %1.", } -- events.i18n.hu events.i18n.vi = { events_test_projects_title = "Kiểm tra và hiển thị các sự kiện kiểm tra cho các dự án", events_test_projects_headers = "Type; Key; Kiểm tra tên và các giá trị; kết quả để phép thử", events_test_MediaWiki_title = "Kiểm tra và hiển thị các sự kiện kiểm tra cho MediaWiki", events_test_MediaWiki_headers = "Type; Key; Kiểm tra tên và các giá trị; kết quả để phép thử", events_test_categ_Test_title = "Kiểm tra categ_Test: danh mục bằng một số ngôn ngữ", events_all_kinds_tests_title = "events.all_kinds_test() Kiểm tra: tất cả các loại sự kiện (err, wng, cat)", events_all_kinds_tests_headers = "nghệ thuật; chính; đối số, kết quả", events_add_cat_deprecated = "Chức năng lỗi thời trong mô-đun chính.", events_close_without_memo_err = "viewers.restore_configs(memo, where) không có memo trong mô-đun %1.", events_antiCrash_protect_err = "Hàm antiCrash() bảo vệ trang này khỏi sự sụp đổ hoàn toàn do lỗi nội bộ: %1.", } -- events.i18n.vi
-- These Module:Centralizer/I18N translations for viewers library update and complete Module:Centralizer translations. viewers.i18n = {} viewers.i18n.br = { -- Principaux textes, erreurs et catégories des outils viewers_test_no_values = "Test: sans valeurs", viewers_test_the_value_is_table = "Test: la valeur est une table", viewers_test_all_types_values = "Test: valeurs de tous types", viewers_Dropbox_label_Unwrap = "Dérouler/Enrouler", viewers_page_tests_title = "Tests et informations liées à cette page :", viewers_section_title_page = "Tests de cette page", viewers_section_title_module = "Tests de ce module", viewers_section_title_internal = "Tests internes", -- Ne pas traduire ces noms de bibliothèques viewers_section_title_library_activity = "Library:activity", viewers_section_title_library_datas = "Library:datas", viewers_section_title_library_langs = "Library:langs", viewers_section_title_library_lua_table = "Library:lua_table", viewers_section_title_library_mathroman = "Library:mathroman", viewers_section_title_library_modes = "Library:modes", viewers_section_title_library_versions = "Library:versions", viewers_section_title_library_wiewers = "Library:wiewers", viewers_section_title_is_missing = "Cette section manque de titre", viewers_dropdown_missing_title = "Titre manquant pour cette boite déroulante", -- Titres des tests viewers_page_tests_title = "Tests et informations liées à cette page :", viewers_module_tests_title = "Tests et informations liées à ce module :", viewers_internal_tests_title = "Tests internes de non régression :", viewers_tableView_default_headers = "A; B; C; D; E", viewers_tableView_tests_title = "tableview.new() Test: former un tableau avec lignes et colonnes.", viewers_tab_view_form_elem_detail = "détail = %1 | %2 | %3 | %4 | %5.", viewers_tableView_tests_err = "Erreur interne: tableview.new() échec anormal.", viewers_format_time_tests_title = "viewers.formatDate() Tests de codage et conversions de dates", viewers_parts_of_date_tests_title = "viewers.date_to_part() Tests de date vers jour, mois, année ou ère", viewers_simpleList_tests_title = "viewers.simple_list() Test: Trier une liste de mots sans répétition", viewers_save_restore_balance_title = "viewers.save_restore_balance_report() Test: sauver et restaurer, équilibre des configurations", viewers_save_restore_balance_headers = "i; où; enregistre; restaure; erreurs", } -- viewers.i18n.br viewers.i18n.de = { -- Haupttexte, Fehler und Kategorien von Werkzeugen viewers_test_no_values = "Test: ohne Werte", viewers_test_the_value_is_table = "Test: Der Wert ist eine Tabelle", viewers_test_all_types_values = "Test: Werte aller Arten", viewers_Dropbox_label_Unwrap = "Erweitern / Wrap", viewers_page_tests_title = "Tests und Informationen zu dieser Seite:", viewers_section_title_page = "Tests dieser Seite", viewers_section_title_module = "Tests dieses Moduls", viewers_section_title_internal = "Interne Tests", -- Übersetzen Sie diese Bibliotheken nicht viewers_section_title_library_activity = "Library:activity", viewers_section_title_library_datas = "Library:datas", viewers_section_title_library_langs = "Library:langs", viewers_section_title_library_lua_table = "Library:lua_table", viewers_section_title_library_mathroman = "Library:mathroman", viewers_section_title_library_modes = "Library:modes", viewers_section_title_library_versions = "Library:versions", viewers_section_title_library_wiewers = "Library:wiewers", viewers_section_title_is_missing = "Dieser Abschnitt fehlt der Titel", viewers_dropdown_missing_title = "Titel fehlt für diese Dropdown-Box", -- Titel der Tests viewers_page_tests_title = "Tests und Informationen zu dieser Seite:", viewers_module_tests_title = "Tests und Informationen zu diesem Modul:", viewers_internal_tests_title = "Interne Regressionstests:", viewers_tableView_default_headers = "A; B; C; D; E", viewers_tableView_tests_title = "tableview.new() Test: Bilden Sie eine Tabelle mit Zeilen und Spalten.", viewers_tab_view_form_elem_detail = "Detail = %1 | %2 | %3 | %4 | %5.", viewers_tableView_tests_err = "Interner Fehler: tableview.new() abnormaler Fehler.", viewers_format_time_tests_title = "viewers.formatDate() Codierungstests und Datumskonvertierungen", viewers_parts_of_date_tests_title = "viewers.date_to_part() Datum Tests zu Tag, Monat, Jahr oder Zeit", viewers_simpleList_tests_title = "viewers.simple_list() Test: Sortiere eine Liste von Wörtern ohne Wiederholung", viewers_save_restore_balance_title = "viewers.save_restore_balance_report() Test: Speichern und Wiederherstellen, Balance der Konfigurationen", viewers_save_restore_balance_headers = "i; wo; registrieren; wiederherzustellen; Fehler", } -- viewers.i18n.de viewers.i18n.en = { -- Main string, errors and categories of tools viewers_test_no_values = "Test: without values", viewers_test_the_value_is_table = "Test: the value is a table", viewers_test_all_types_values = "Test: values of all types", viewers_Dropbox_label_Unwrap = "Unwrap/Wrap", viewers_page_tests_title = "Testing and information related to this page:", viewers_section_title_page = "Tests of this page", viewers_section_title_module = "Tests of this module", viewers_section_title_internal = "Internal tests", -- Do not ranslate these libraries names viewers_section_title_library_activity = "Library:activity", viewers_section_title_library_datas = "Library:datas", viewers_section_title_library_langs = "Library:langs", viewers_section_title_library_lua_table = "Library:lua_table", viewers_section_title_library_mathroman = "Library:mathroman", viewers_section_title_library_modes = "Library:modes", viewers_section_title_library_versions = "Library:versions", viewers_section_title_library_wiewers = "Library:wiewers", viewers_dropdown_missing_title = "Missing title for this drop_box", -- Titles of tests viewers_module_tests_title = "Testing and information related to this module:", viewers_internal_tests_title = "Internal regression tests:", viewers_tableView_default_headers = "A; B; C; D; E", viewers_tableView_tests_title = "tableview.new() Test: Formats a table with lines and columns.", viewers_tab_view_form_elem_detail = "detail = %1 | %2 | %3 | %4 | %5.", viewers_tableView_tests_err = "Internal error : tableview.new() abnormal fail.", viewers_format_time_tests_title = "viewers.formatDate() Tests of coding and conversion of dates", viewers_parts_of_date_tests_title = "viewers.date_to_part() Tests of date to day, month, year or era", viewers_simpleList_tests_title = "viewers.simple_list() Test: Sort a list of words without repetition", viewers_save_restore_balance_title = "viewers.save_restore_balance_report() Test: save and restore, balance of configurations", viewers_save_restore_balance_headers = "i;where;save;restore;errors", } -- viewers.i18n.en viewers.i18n.es = { -- Textos principales, errores y categorías de instrumentos viewers_test_no_values = "Prueba: sin valores", viewers_test_the_value_is_table = "Prueba: el valor es una tabla", viewers_test_all_types_values = "Prueba: valores de todos los tipos", viewers_Dropbox_label_Unwrap = "Desenvolver/Envolver", viewers_page_tests_title = "Pruebas y información relacionada con esta página:", viewers_section_title_page = "Pruebas de esta página", viewers_section_title_module = "Pruebas de esta módulo", viewers_section_title_internal = "Pruebas internas", -- No traduzca estos nombres de bibliotecas viewers_section_title_library_activity = "Library:activity", viewers_section_title_library_datas = "Library:datas", viewers_section_title_library_langs = "Library:langs", viewers_section_title_library_lua_table = "Library:lua_table", viewers_section_title_library_mathroman = "Library:mathroman", viewers_section_title_library_modes = "Library:modes", viewers_section_title_library_versions = "Library:versions", viewers_section_title_library_wiewers = "Library:wiewers", viewers_section_title_is_missing = "This section misses of title", viewers_dropdown_missing_title = "Falta el título para este drop_box", -- Titres des pruebas viewers_page_tests_title = "Pruebas y información relacionada con esta página:", viewers_module_tests_title = "Pruebas y información relacionada con esto módulo:", viewers_internal_tests_title = "Pruebas de no regresión internas:", viewers_tableView_default_headers = "A; B; C; D; E", viewers_tableView_tests_title = "tableview.new() Prueba: Formar una tabla con líneas y columnas.", viewers_tab_view_form_elem_detail = "detalle = %1 | %2 | %3 | %4 | %5.", viewers_tableView_tests_err = "Error interno: tableview.new() error anormal.", viewers_format_time_tests_title = "viewers.formatDate() Pruebas de codificación y conversión fechas", viewers_parts_of_date_tests_title = "viewers.date_to_part() Pruebas de fecha a día, mes, año o época", viewers_simpleList_tests_title = "viewers.simple_list() Prueba: Ordenar una lista de palabras sin repetición", viewers_save_restore_balance_title = "viewers.save_restore_balance_report() Prueba: guardar y restaurar, equilibrio de configuraciones", viewers_save_restore_balance_headers = "i; dónde; guardar; restaurar; errores", } -- viewers.i18n.es viewers.i18n.fr = { -- Principaux textes, erreurs et catégories des outils viewers_test_no_values = "Test: sans valeurs", viewers_test_the_value_is_table = "Test: la valeur est une table", viewers_test_all_types_values = "Test: valeurs de tous types", viewers_Dropbox_label_Unwrap = "Dérouler/Enrouler", viewers_page_tests_title = "Tests et informations liées à cette page :", viewers_section_title_page = "Tests de cette page", viewers_section_title_module = "Tests de ce module", viewers_section_title_internal = "Tests internes", -- Ne pas traduire ces noms de bibliothèques viewers_section_title_library_activity = "Library:activity", viewers_section_title_library_datas = "Library:datas", viewers_section_title_library_langs = "Library:langs", viewers_section_title_library_lua_table = "Library:lua_table", viewers_section_title_library_mathroman = "Library:mathroman", viewers_section_title_library_modes = "Library:modes", viewers_section_title_library_versions = "Library:versions", viewers_section_title_library_wiewers = "Library:wiewers", viewers_section_title_is_missing = "Cette section manque de titre", viewers_dropdown_missing_title = "Titre manquant pour cette boite déroulante", -- Titres des tests viewers_page_tests_title = "Tests et informations liées à cette page :", viewers_module_tests_title = "Tests et informations liées à ce module :", viewers_internal_tests_title = "Tests internes de non régression :", viewers_tableView_default_headers = "A; B; C; D; E", viewers_tableView_tests_title = "tableview.new() Test: former un tableau avec lignes et colonnes.", viewers_tab_view_form_elem_detail = "détail = %1 | %2 | %3 | %4 | %5.", viewers_tableView_tests_err = "Erreur interne: tableview.new() échec anormal.", viewers_format_time_tests_title = "viewers.formatDate() Tests de codage et conversions de dates", viewers_parts_of_date_tests_title = "viewers.date_to_part() Tests de date vers jour, mois, année ou ère", viewers_simpleList_tests_title = "viewers.simple_list() Test: Trier une liste de mots sans répétition", viewers_save_restore_balance_title = "viewers.save_restore_balance_report() Test: sauver et restaurer, équilibre des configurations", viewers_save_restore_balance_headers = "i; où; enregistre; restaure; erreurs", } -- viewers.i18n.fr
function viewers.is_in(word, text) -- The word is it in the text, even inside another word? local bug = "Erreur Lua dans Module:Centralizer-s-fr à la ligne 7444 : attempt to call field 'find' (a nil value)." local i = string.find(text or "", word or "", 1, true) return (i and true) end
function viewers.is_in_sp(word, text, sep) -- The word is it in the text, beetwen spaces or separators, not inside another word? sep = sep or " " -- default separator is space. But could be * ; , or even any string. if type(word) ~= "string" then word = "" end if type(text) ~= "string" then text = "" end local i = string.find(sep .. text .. sep, sep .. word .. sep, 1, true) if i then i = true else i = false end return i end
function viewers.is_def(x) -- x is defined or no. x est défini ou non return (type(x) == "string") and (x ~= "") and (x ~= " ") and (x ~= "nil") end
function viewers.value(value, form) -- Formats a string to discribe a value like: true, 123.456, "abcd", func(), table{}. local typ, view = type(value), "-" -- options: ' nonil noquote ' if typ == "boolean" then if value == true then view = "true" else view = "false" end elseif typ == "function" then view = "func()" elseif typ == "number" then view = tostring(value) elseif typ == "string" then if viewers.is_in('noquote', form) then view = value else view = '"' .. value .. '"' end elseif typ == "table" then view = "table{}" elseif typ == "nil" then view = "nil" if viewers.is_in('nonil', form) then view = "" end end return view end -- function viewers.value(value, form)
function viewers.phab_task(task, comment) -- Forms a link to a Phabricator task. local t = "" -- example: "T135845 Convert" if ( type(comment) ~= "string" ) then comment = "" end -- The task id is a string with "T" and a number. We check this syntax: if ( type(task) == "string" ) and ( string.find("T", "%s", 1, true) == 1 ) and tonumber( string.sub( s, 2, -1 ) ) then task = task else task = "T000" end t = "" .. task .. " " .. comment .. "" return t -- replace anywhere : "[[phab:" by "viewers.phab_task(task, comment)" then update all end -- t = t .. ;viewers.phab_task(task, comment) -- Forms a link to a Phabricator task.
function viewers.ta(txt, val, sep) -- Formats an argument and its value in a documentation. The text is "nil" if the value is nil. if val == nil then val = "nil" end if sep == nil then sep = "=" end return tostring(txt) .. " " .. tostring(sep) .. " " .. tostring(val) .. " " .. ", " end
function viewers.tam(txt, val, sep) -- Formats an argument and its value, or mask it if nil. if not val then return "" end return viewers.ta(txt, val, sep) end
-- Fonctional styles in central modules. viewers.usual_colors = { -- Available usual fonctional styles for central modules and those using them. ["add"] = "blue", -- Usual fonctional style for add in blue; blue/yellow are more accessible, see T156048. ["delete"] = "#C0C000", -- Usual fonctional style for delete in yellow; blue/yellow are more accessible, see T156048. ["discreet"]= "#B0B0B0", -- Usual fonctional style for discreet in light grey. ["error"] = "#AA6688", -- Usual fonctional style for error in modified red. ["invoke"] = "#804020", -- Usual fonctional style for invoke args in brown. ["mask"] = "white", -- Usual fonctional style for mask standard in white. ["normal"] = "black", -- Usual fonctional style for other standard in black. ["warning"] = "#804020", -- Usual fonctional style for warnings in brown. ["wikidata"]= "green", -- Usual fonctional style for wikidata in green. } viewers.usual_colors_memo = "add delete discreet error invoke mask normal warning wikidata"
function viewers.usual_color(t, usual) -- Fonctional style for available usual cases. if type(usual) ~= "string" then usual = "normal" end local t = tostring(t) -- template style: ' usual ' -- template style local usual_in_style = '' .. t .. '' -- default style if viewers.usual_colors[usual] then -- Adapt the style of usual, if it exists. usual_in_style = '' .. t .. '' -- actual style end -- Style for add in blue; blue/yellow are more accessible, see T156048. return usual_in_style end -- function viewers.usual_color(t, usual)
viewers.styles_colors = "add delete discreet error invoke normal warning wikidata" viewers.styles_formats = "big bold small up" function viewers.styles(t, styles) -- Fonctional styles for usual cases. local t = tostring(t) local styles_split = mw.text.split(styles, "%s") for i, style in ipairs(styles_split) do if viewers.is_in_sp(style, viewers.styles_colors) then t = viewers.usual_color(t, style) end if viewers.is_in_sp(style, viewers.styles_formats) then if style == "big" then t = "" .. t .. "" end if style == "bold" then t = "" .. t .. "" end if style == "small" then t = "" .. t .. "" end if style == "up" then t = "<up>" .. t .. "</up>" end end end return t end -- function viewers.styles(t, opt)
-- These corresponding functions change the colors of a displayed text for available functional styles: function viewers.styles_color_add(t) return viewers.usual_color(t, "add") end
function viewers.styles_color_delete(t) return viewers.usual_color(t, "delete") end
function viewers.styles_color_discreet(t) return viewers.usual_color(t, "discreet") end --For attentive readers only. function viewers.styles_color_error(t) return viewers.usual_color(t, "error") end
function viewers.styles_color_colargs(t) return viewers.usual_color(t, "colargs") end
function viewers.styles_color_mask(t) return viewers.usual_color(t, "mask") end
function viewers.styles_color_normal(t) return viewers.usual_color(t, "normal") end
function viewers.styles_color_warning(t) return viewers.usual_color(t, "warning") end
function viewers.styles_color_wikidata(t) return viewers.usual_color(t, "wikidata") end -- Formats also functional styles for boxes
function viewers.styles_small_caps(t) -- Display a text in small-caps style. return '' .. t .. '' end
-- Extract a part of date following a pre-defined format which starts with separator function viewers.date_split(date, format) -- local dd, mmmm, yyyy, era = viewers.date_split(a.birthdate, " dd mmmm yyyy") local dd, mmmm, yyyy, era local format_split = mw.text.split(format, "%s") local split = mw.text.split(date, "%s") for i, date_part in ipairs(split) do if format_split[i] == "dd" then dd = tonumber(date_part) end if format_split[i] == "mmmm" then mmmm = date_part end if format_split[i] == "yyyy" then yyyy = tonumber(date_part) end if format_split[i] == "era" then era = date_part end end return dd, mmmm, yyyy, era end -- function viewers.date_split(date, format)
function viewers.date_to_part(date, part) -- Extracts a part of date following a pre-defined format which starts with separator -- local t, err = viewers.date_to_part(a.birthyear, " dd mmmm yyyy", "yyyy") part = part or "yyyy" local dd, mmmm, yyyy, era local found = false -- local err = "modes_date_to_part_not_found_err" if not found then dd, mmmm, yyyy, era = viewers.date_split(date, "dd mmmm yyyy") if dd and mmmm and yyyy and not era then found = true end end if not found then dd, mmmm, yyyy, era = viewers.date_split(date, "mmmm dd yyyy") if dd and mmmm and yyyy and not era then found = true end end if not found then dd, mmmm, yyyy, era = viewers.date_split(date, "yyyy era") if not dd and not mmmm and yyyy then if era == "BCE" then yyyy = - yyyy end found = true end end if not found then dd, mmmm, yyyy, era = viewers.date_split(date, "mmmm yyyy") if not dd and mmmm and yyyy and not era then -- modes_date_months_names = "January, February, March, April, May, June, July, August, September, October, November, December", -- modes_date_months_names = "Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre", -- modes_date_months_names = "Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre", found = true end end if not found then dd, mmmm, yyyy, era = viewers.date_split(date, "yyyy") if not dd and not mmmm and yyyy and not era then found = true end end -- + cccc = roman number ? if found then if part == "yyyy" then return yyyy or "" end if part == "mmmm" then return mmmm or "" end if part == "dd" then return dd or "" end if part == "era" then return era or "" end end return "" -- tostring(dd)..tostring(mmmm)..tostring(yyyy)..tostring(era) -- A faire : Titus Livius (Q2039), format de dates : P569 = date of birth = 59 BCE, P570 = date of death = 17 -- Socrate (470-399 av. J.-C.). end -- function viewers.date_to_part(date, part)
function mw.text.sortCommaList(list, sep1, sep2, sep3) -- Sort without repeat a list with separators like "Central01;versions 2.4;tools;two words" versions.deprecated_function("mw.text.sortCommaList", "viewers.simple_list") return viewers.simple_list(list, sep1, sep2, sep3, sep4) end
function viewers.simple_list(list, sep1, sep2, sep3, sep4) -- Removes repeats in a string list with separators and can also sort them. -- sep1 is used in final list. sep1 to sep4 can be "sort" or "trim". local t = t -- t or if (type(t) ~= "string") then t = '\n* viewers.simple_list(list, sep1, sep2, sep3, sep4) : Removes repeats in a string list with separators and can also sort them' end local sort, trim = false, false if sep1 == "sort" then sep1 = "" ; sort = true end if sep2 == "sort" then sep2 = "" ; sort = true end if sep3 == "sort" then sep3 = "" ; sort = true end if sep4 == "sort" then sep4 = "" ; sort = true end if sep1 == "trim" then sep1 = "" ; trim = true end if sep2 == "trim" then sep2 = "" ; trim = true end if sep3 == "trim" then sep3 = "" ; trim = true end if sep4 == "trim" then sep4 = "" ; trim = true end if type(list) ~= "string" then list = "" end if type(sep1) ~= "string" then sep1 = "" end -- Default separators value if type(sep2) ~= "string" then sep2 = "" end if type(sep3) ~= "string" then sep3 = "" end if type(sep4) ~= "string" then sep4 = "" end -- Patterns: Dot (.) always matches all characters, including newlines. -- Patterns: Quantifiers (*, +, ?, and -) may only be applied to individual characters. if viewers.is_in(sep1, ".*+?-/") then sep1 = "%" .. sep1 end if viewers.is_in(sep2, ".*+?-/") then sep2 = "%" .. sep2 end if viewers.is_in(sep3, ".*+?-/") then sep3 = "%" .. sep3 end if viewers.is_in(sep4, ".*+?-/") then sep4 = "%" .. sep4 end local listtab = mw.text.split(list or "", sep1, true) -- names between commas local listtabOut = {} local listtabSingle = {} local list2 = "" for i, name in ipairs(listtab) do -- list all names, only one each, in alphabetic order if trim then name = mw.text.trim(name) end -- do not keep spaces inside each name if not listtabSingle[name] then listtabSingle[name] = name list2 = list2 .. name .. sep1 t = t .. viewers.ta("name", name) .. viewers.ta("list2", list2) end end if sort then table.sort(listtabSingle, function (a, b) return (a < b) end ) -- sort in alphabetic order end t = t .. " * list2 = " .. list2 .. " * " t = t .. string.sub( list2, 1, (-string.len(sep1)-1) ) -- without last sep1 or ; return t end -- function viewers.simple_list(list, sep1, sep2, sep3)
function viewers.simple_list_test(t) -- Tests repetitions in a list of strings with separators and can also sort them local memo = viewers.save_configs("viewers.simple_list_test") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* viewers.simple_list_test(t) : Tests repetitions in a list of strings with separators and can also sort them' end t = t .. "\n* Test viewers.simple_list(list, sep1, sep2, sep3): " t = t .. '\n* Remove repeats in a string list with separators. Can also sort.' local function simpleList_test1(t, input, sep1, sep2, sep3, sep4) local output = tostring( viewers.simple_list(input, sep1, sep2, sep3, sep4) ) t = t .. viewers.table_row() .. viewers.table_dat(viewers.value(input)) .. viewers.table_dat(viewers.value(sep1)) .. viewers.table_dat(viewers.value(sep2)) t = t .. viewers.table_dat(viewers.value(sep3)) .. viewers.table_dat(viewers.value(sep4)) .. viewers.table_dat(viewers.value(output)) return t end t = t .. viewers.table_head() .. viewers.table_col("input") .. viewers.table_col("sep1") .. viewers.table_col("sep2") .. viewers.table_col("sep3") .. viewers.table_col("sep4") .. viewers.table_col("output") t = simpleList_test1(t, "abc;def;abc", ";", "-", "|") t = simpleList_test1(t, "xyz;def;abc", ";", "sort") t = simpleList_test1(t, "abc-def=abc", "-", "=") t = simpleList_test1(t, "abc - def = abc", "-", "=", "sort") t = simpleList_test1(t, "abc - def = abc", "-", "=", "sort", "trim") t = simpleList_test1(t, ";;", ";", ";", ",") t = simpleList_test1(t, "abc/def;abc", ";", "/") t = simpleList_test1(t, "abc;def/abc/def;abc;def;abc", ";", "/", "-") t = simpleList_test1(t, "abc;def;abc", ";", ";", "") t = t .. viewers.table_end() viewers.restore_configs(memo, "viewers.simple_list_test") -- Restore global configurations after eventual changes. return t end -- viewers.simple_list_test(t) -- for _test1 search also _test1 simpleList_test1 date_to_part_test1
function viewers.form_one_case(case) -- Convert a case from test_group to rowGroup. case.res1 = case.result[1] or "res1" -- DEBUG : mathroman.int2roman() can fail without blocking page. case.err2 = case.result[case.errorsKey] or "err2" -- DEBUG : mathroman.int2roman() can fail without blocking page. case.errors = case.errors or status.OK case.errors = viewers.ta("case.res1", case.res1) .. viewers.ta("case.err2", case.err2) .. viewers.ta("case.errors", case.errors) -- headers = "case.name; args{}; expect{}; result{}; errors in result{} from expect{}", -- OK or error/s return { case.name, lua_table.rough_view(case.args), lua_table.rough_view(case.expect), lua_table.rough_view(case.result), case.errors } end -- errors in result
function viewers.day_to_stamp(jj, mm, aaaa) local t = "@" .. tostring( jj*86400 + mm*30*86400 + (aaaa-1970)*31556926 ) return t end
function viewers.day_to_UTC(jj, mm, aaaa) jj = tonumber(jj) if not jj then jj = "2" else jj = string.sub("0000" .. tostring(jj), -2, -1 ) end mm = tonumber(mm) if not mm then mm = "2" else mm = string.sub("0000" .. tostring(mm), -2, -1 ) end aaaa = tonumber(aaaa) if not aaaa then aaaa = "2000" else aaaa = string.sub("0000" .. tostring(aaaa), -4, -1 ) end return aaaa .. "-" .. mm .. "-" .. jj end
function viewers.parts_of_date_tests(t) local memo = viewers.save_configs("viewers.parts_of_date_tests") -- Save global configuration before eventual changes. local function date_to_part_test1(t, nom, date, part) local t = t .. viewers.table_row() .. viewers.table_dat(nom) .. viewers.table_dat(date) .. viewers.table_dat(part) .. viewers.table_dat(tostring(viewers.date_to_part(date, part))) return t end local t = t -- t or if (type(t) ~= "string") then t = '\n* viewers.simple_list_test(t) : Tests repetitions in a list of strings with separators and can also sort them' end t = t .. "\n* date_to_part :" t = t .. "\n* Verify each value of part of date:" t = t .. viewers.table_head() .. viewers.table_col("Example") .. viewers.table_col("date") .. viewers.table_col("part") .. viewers.table_col("value") t = date_to_part_test1(t, "Socrate birth", "470 BCE", "era") t = date_to_part_test1(t, "Tite-Live birth", "59 BCE", "yyyy") t = date_to_part_test1(t, "Tite-Live death", "17", "yyyy") t = date_to_part_test1(t, "empty", "", "yyyy") t = date_to_part_test1(t, "Revolution", "14 July 1789", "mmmm") t = date_to_part_test1(t, "Walk on Moon", "20 July 1969", " ") t = date_to_part_test1(t, "English date", "July 20 1969", "yyyy") t = date_to_part_test1(t, "English date", "July 20 1969", "mmmm") t = date_to_part_test1(t, "Nelson Mandela birth", "July 1918", "yyyy") t = date_to_part_test1(t, "Nelson Mandela death", "5 Decembre 2013", "dd") t = t .. viewers.table_end() -- see https://fr.wikipedia.org/wiki/Discussion:ISO_8601#Av._J.C._:_contradiction_avec_l.27article_anglais -- see https://fr.wikipedia.org/w/index.php?title=ISO_8601&diff=next&oldid=12449725 -- see ISO 8601 time format like : 1977-04-22T01:00:00-05:00 (5 heures de décalage) = 1977-04-22T06:00:00Z local time -- os.date( format, time ) get datetime viewers.restore_configs(memo, "viewers.parts_of_date_tests") -- Restore global configurations after eventual changes. return t end -- function viewers.parts_of_date_tests(t)
function viewers.form_image(file, size, options) -- Formats an image from its file name, to the size in pixels if type(file) ~= "string" then file = "Victor Hugo.jpg" end if not ( (type(size) == "string") or (type(size) == "number") ) then size = "15" end if type(options) ~= "string" then options = "" end return '' .. options .. '' -- options must begin with "|" end -- local image = viewers.form_image(file, size)
function viewers.trans9vars(translations, ref, ...) -- Replace %1 to %9 by tostring( argN ) from arguments, without any ambiguity in any string. local t, S9, repl, val, charN = "", "", "", "", "" if type(ref) ~= "string" then ref = "a;b;c;d;e;f;g" end if type(translations) ~= "table" then t = viewers.form9tests( tostring(ref), ...) return t end if type(translations[ref]) == "string" then ref = translations[ref] end args = {...} t = ref if lua_table.level_count(args) > 0 then local n = 1 for n = 9, 1, -1 do S9 = tostring(n) charN = string.find(t, "%".. S9, 1, true) if charN then -- If reference has %0 to %9 repl = tostring( args[n] or "" ) t = string.sub(t, 1, charN - 1) .. repl .. string.sub(t, charN + string.len( "%".. S9 ) ) end end end t = t .. viewers.ta("main version", tostring(version) ) -- COCO return t end -- function viewers.trans9vars(translations, key, ...) -- main_module = main_module or versions.main_module =
function viewers.form9tests(ref, ...) -- Formats reference_key;v1;v2;v3;... for tests. local t = tostring(ref) for i, var in pairs( { ... } ) do if var then t = t .. ";" .. viewers.value(var) end -- tostring() or viewers.value() ? end return t end
function viewers.form9en(ref, ...) -- Replace %1 to %9 by arguments. Always in english if not langs.main_i18n_complete then return "" end -- Avoid to fail in init phase. local t, n = "", 0 if type(ref) ~= "string" then t = viewers.form9tests("form9en", ...) elseif type(versions.memo_i18n.en[ref] == "string") then t = viewers.trans9vars(versions.memo_i18n.en, ref, ...) else t = viewers.form9tests(ref, ...) end -- Default text to help to locate a bug return t end -- function viewers.form9en(ref, ...)
function viewers.form9content(ref, ...) -- replace %1 to %9 by v1 to v9 in the content translation of ref, else in ref if not langs.main_i18n_complete then return "" end -- Mask or Unmask all views to avoid failures. local form, n = "", 0 if type(ref) ~= "string" then form = viewers.form9tests("form9content", ...) end if (type(langs.content_translations) == "table") then -- Only after versions.bind_reverse_i18n_translations() if langs.content_translations[ref] then -- Normal case form = form .. viewers.trans9vars(langs.content_translations, ref, ...) elseif versions.memo_i18n.en[ref] then -- try english translation in case another lang mises of translation form = form .. viewers.trans9vars(versions.memo_i18n.en, ref, ...) else form = form .. viewers.form9tests(ref, ...) end else form = form .. viewers.form9tests(ref, ...) end return form end -- function viewers.form9content(ref, ...)
function viewers.form9page(ref, ...) -- Replace %1 to %9 by tostring( argN ) from arguments, without any ambiguity in any string. if not langs.main_i18n_complete then return "" end -- Mask or Unmask all views to avoid failures. local form, n = "", 0 if type(ref) ~= "string" then form = viewers.form9tests("form9page", ...) end local form, n = "", 0 if not langs.main_i18n_complete then return "" end -- Mask or Unmask all views to avoid failures. if (type(langs.page_translations) == "table") then -- Only after versions.bind_reverse_i18n_translations() if langs.page_translations[ref] then -- Normal case form = form .. viewers.trans9vars(langs.page_translations, ref, ...) elseif versions.memo_i18n.en[ref] then -- try english translation in case another lang mises of translation form = form .. viewers.trans9vars(versions.memo_i18n.en, ref, ...) else form = form .. viewers.form9tests(ref, ...) end else form = form .. viewers.form9tests(ref, ...) end return form end -- function viewers.form9page(ref, ...)
function viewers.form9user(ref, ...) -- Replace %1 to %9 by arguments, without any ambiguity in any string. if not langs.main_i18n_complete then return "" end -- Avoid to fail in init phase. -- langs.main_i18n = langs.main_i18n or versions.main_i18n or {} -- versions.main_i18n = langs.main_i18n -- local i18n = i18n or langs.main_i18n or versions.main_i18n or versions.memo_i18n local ref = ref local t, trans, n = "", "", 0 if type(ref) ~= "string" then ref = viewers.form9tests(ref, ...) end if (type(langs.user_translations) == "table") then -- Normal translation if langs.user_translations[ref] then trans = langs.user_translations[ref] end -- Normal ref to translate t = viewers.trans9vars(langs.user_translations, ref, ...) else t = viewers.form9tests(ref, ...) end -- Default text to help to locate a bug return t end -- function viewers.form9user(ref, ...)
function viewers.form9user_test(t) -- Tests of viewers.form9user_test().
local memo = viewers.save_configs("viewers.form9user_test") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* viewers.simple_list_test(t) : Tests repetitions in a list of strings with separators and can also sort them' end
t = t .. "\n* viewers.form9user_test(t, ref, ...):"
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "viewers.form9user_test(t) -- Tests of viewers.form9user_test()",
test_group = {
{ "translate_form9user_no_translation", },
{ "viewers_test_no_values", },
{ "translate_form9user_a_value_is_table", {}, },
{ "langs_form9user_all_types_values", "abc", 4, nil, function(x) end, { 55, "xyz" }, },
{ "replace: abc%1efg%2ijk", "D", "H", },
{ "repeat: a=%1 b=%2 c=%1 d=%2", "1", "2", },
{ "altern: 1%13%25", "2", "4", },
{ "list: %0<%1<%2<%3<%4<%5<%6<%7<%8<%9", "00", "11", "22", "33", "44", "55", "66", "77", "88", "99", },
{ "mix: %1, %5, %2, %4, %3, ", "A", "B", "C", "D", "E", },
{ "missing args: yes=%1 no=%5 no=%9 yes=%2", "args[1]", "args[2]", },
{ "MATRIX 4 * 5
"
.. "{ %1%5, %1%6, %1%7, %1%8, %1%9 }
"
.. "{ %2%5, %2%6, %2%7, %2%8, %2%9 }
"
.. "{ %3%5, %3%6, %3%7, %3%8, %3%9 }
"
.. "{ %4%5, %4%6, %4%7, %4%8, %4%9 }
", "a", "b", "c", "d", "1", "2", "3", "4", "5", },
},
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup.
local ref = case[1]
local form9user, t9 = viewers.form9user( lua_table.to_list(case) )
return { ref, form9user, }
end
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "viewers.form9user_test") -- Restore global configurations after eventual changes.
return t
end -- function viewers.form9user_test(t)
function viewers.form_main_version(main_versions) if (type(main_versions) ~= "table") then main_versions = versions.main_versions end if (type(main_versions) ~= "table") then main_versions = { versionName = "versionName", versionNumber = "0.0", } end local t = "" if type(main_versions) == "table" then t = main_versions.versionName .. " " .. main_versions.versionNumber .. ", " end return t end
function viewers.discreet_main_version(main_versions) return viewers.styles_color_discreet( viewers.form_main_version(main_versions) ) end
function viewers.doc_section(selector, section, style, mask_sections) -- Begin of section in viewers.doc_page(), viewers.doc_module()... local t = "" local selector, section, style = selector, section, style section = viewers.form9user(section) -- like viewers_section_title_page or viewers_section_title_internal function viewers.form9user( if mask_sections then return t end if selector == "never" then return t end local select = (selector == true) or (selector == title) or viewers.is_in_sp(selector, "allwaysview alltestsview enforcerun failinref nocontent") if type(style) ~= "string" then style = "h3" end local n = tonumber( string.sub(style, 2, 2) ) style = "" ; for i = 1, n do style = style .. "=" end t = t .. "\n" .. style .. section .. " " .. style .. "\n" -- style OK -- t = t .. "\n* ModuleCentralizer only tests sections doc_section" return t end -- res = res .. viewers.doc_section(selector, "viewers_section_title_page", "h2", mask_sections) -- example
function drop_box.dh( opt ) if (type(opt) == "string") and (type(drop_box.css_options[opt]) == "string") then val = drop_box.css_options[opt] end -- val can be nil for cssview, we admit it. return val end dh = drop_box.dh
function drop_box.html(title, content_or_func) -- Builds the drop box at the html level. local memo = viewers.save_configs("drop_box.html") -- Save global configuration before eventual changes. local t = "\n* drop_box.html() -- Builds the drop box at the html level." local drop_box_html = drop_box_html_start .. drop_box_html_medium .. drop_box_html_end .. drop_box_look_like t = t .. drop_box_html_start .. drop_box_html_content viewers.restore_configs(memo, "drop_box.html") -- Restore global configurations after eventual changes. return drop_box_html_start end -- t = t .. drop_box.html(title, content) -- Builds the drop box at the html level.
function viewers.drop_title() -- Support desk title of the docDropbox of the edit box. local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts("langs.main_i18n", "langs_main_i18n_languages_count", "user") local report_main_discreet = viewers.styles_color_discreet( viewers.form_main_version(main_versions) ) local title = viewers.form9user("versions_support_desk_title", report_main_discreet, strs_on_tabs, tables_c) -- "Support desk for %1 : %2 translations in %3 languages" return title end -- function viewers.drop_title()
drop_box.css_options = { -- Conventional CSS parameters : See -- https://en.wikisource.org/wiki/Template:drop_box#Parameters ["cssview"] = false, -- cssview : display values of options ["bg1"] = "#FFFFFF", -- bg1 : the background-color for the header ["fs1"] = "100%", -- font-size: 100%; ["fw1"] = "left", -- fw1 : the font-weight for the heading ["ta1"] = "left", -- ta1 : the text-align for the heading ["tc1"] = "black", -- tc1 : the text-color for the heading -- ["bg2"] = "#FFFFFF", -- bg2 : the background-color for the content ["fs2"] = "100%", -- font-size: 100%; ["fw2"] = "left", -- fw2 : the font-weight for the body ["ta2"] = "left", -- ta2 : the text-align for the body ["tc2"] = "black", -- tc2 : the text-color for the body }
-- t = drop_box.form(dropit.title, dropit.content, dropit) function drop_box.form(title, content, dropit) -- Easy drop_box style from a list of named options. local memo = viewers.save_configs("drop_box.form") -- Save global configuration before eventual changes. local dropit = mw.clone(dropit) -- Save global configuration before eventual changes. local t = "\n* drop_box.form:" -- if type(content) == "function" then content = ( content(title, content, dropit) ) end -- and use it as content form function t = t .. viewers.ta("title", tostring(title) ) t = t .. viewers.ta("content", tostring(content) ) t = t .. viewers.ta("dropit", tostring(dropit) ) if type(title) == "function" then title = title() -- function viewers.drop_title() elseif type(title) ~= "string" then title = "viewers_dropdown_missing_title" end title = viewers.form9user(title) local dropit = dropit or {} t = t .. viewers.ta("\n* title", tostring(title) ) t = t .. viewers.ta("#dropit", lua_table.level_count(dropit) ) local opt = mw.clone(drop_box.css_options) -- Save global configuration before eventual changes. dropit = { -- Conventional css parameters : from -- https://en.wikisource.org/wiki/Template:drop_box#Parameters image = nil, cssview = dropit.cssview, -- cssview : display values of options fw1 = dropit.fw1 or opt.fw1, -- "left", -- fw1 : the font-weight for the heading fw2 = dropit.fw2 or opt.fw2, -- "left", -- fw2 : the font-weight for the body fs1 = dropit.fs1 or opt.fs1, -- "100%", -- font-size: 100%; fs2 = dropit.fs2 or opt.fs2, -- "100%", -- font-size: 100%; bg1 = dropit.bg1 or opt.bg1, -- "#FFFFFF", -- bg1 : the background-color for the heading bg2 = dropit.bg2 or opt.bg2, -- "#FFFFFF", -- bg2 : the back.clicground-color for the body ta1 = dropit.ta1 or opt.ta1, -- "left", -- ta1 : the text-align for the heading ta2 = dropit.ta2 or opt.ta2, -- "left", -- ta2 : the text-align for the body float = dropit.float or opt.float, -- "none", -- float : should the box be floated? (left, right, or none) width = dropit.width or opt.width, -- "99%", -- width : the width of the box, e.g. 33% border_radius = dropit.border_radius or opt.border_radius, -- "0px 0px 0px 0px", -- border-radius: "15px 50px 30px 5px" : add rounded corners to an element. style = dropit.style or opt.style, -- "0px 0px 0px 0px", -- style : HTML/CSS affectionados only: any other css style arguments for the whole box
--
hidden = dropit.hidden or opt.hidden, -- "true", -- hidden : set this to any string (e.g. hidden=true) to have the box hidden by default
headType = dropit.headType or opt.fw1, -- "h4", -- headType : allows you to set the box header to (say) "h4", which means it will be included in the table of contents. This is provided as an explicit parameter because if you just surround the title with header tags, e.g.Box 1.1
tc1 = dropit.tc1 or opt.tc1, -- "black", -- tc1 : the text-color for the heading tc2 = dropit.tc2 or opt.tc2, -- "black", -- tc2 : the text-color for the body border_color = dropit.border_color or opt.border_color, -- "#AAAAAA", -- border-color : the text-color for the heading and the body -- display = dropit.display or opt.display, -- "block", -- display: block : results without line break. display = dropit.display or opt.display, -- "inline", -- display: inline : results with free line break. margin_all = dropit.margin_all or opt.margin_all, -- "0px", -- margin margin_bottom = dropit.margin_bottom or opt.margin_bottom, -- "1em", -- margin-bottom -- height = dropit.height or opt.height, -- "1.6em", -- height label = dropit.label or opt.label, -- "▼ /▶ ", -- = "Unwrap/Wrap", -- ▼ = ▼ -- ▶ = ▶ https://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode/U25A0 -- label = label or viewers.form9user("viewers_drop_box_label_Unwrap"), -- = "Unwrap/Wrap" translations } dropit.title = dropit.title or title dropit.content = dropit.content or content or "\n* Inside the viewer drop_box.form(), a function in test or in report has a nil result." -- if type(dropit.content) == "function" then dropit.content = ( dropit.content() ) end -- and use it as content form function if type(dropit.content) == "function" then dropit.content = ( dropit.content() ) end -- and use it as content form function if type(dropit.image) == "string" then dropit.image =
.. 'else dropit.image = end local d = dropit -- res = res .. "" local t = "" if dropit.cssview then t = t .. '\n* List values of CSS if cssview: ' for key, elem in pairs(dropit) do if (key ~= "content") and (key ~= "title") then t = t .. viewers.ta(key, elem) end end end d.content = viewers.form9user(d.content) -- drop_box from https://fr.wikisource.org/wiki/Modèle:Boîte déroulante = drop_box from template on 20180505 OK. -- p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form local dropbox_title = 'Boîte déroulante' --[ [ -- local dropbox_title = viewers.form9content("p_template_drop_box_name") t = t .. mw.getCurrentFrame():expandTemplate{ title = dropbox_title, args = { ["label"] = d.label, ["titre"] = d.title, ["contenu"] = d.content, ["margeHaut"] = d.margin_all, ["margeBas"] = d.margin_bottom, ["hauteur"] = d.height, -- ["width"] = d.width, -- not in html V5 ["couleurFond"] = d.bg1, ["couleurBordure"] = d.tc1, ["alignT"] = d.ta1, ["align"] = d.ta2, ["arrondi"] = d.border_radius, ["couleurBordure"] = d.border_color, -- Keep default values for : br, image, alignB, hauteur, margeHaut, margeBas } } --] ] drop_box.Dropbox_t = t viewers.restore_configs(memo, "drop_box.form") -- Restore global configurations after eventual changes. return t end -- function drop_box.form(title, content, dropit)
function viewers.drop(selector, title, content_or_func, ...) -- Formats a drop_box for a doc or a group of tests. Take apart dropit options. -- selector = "allwaysview" -- To allways display one view. -- selector = "enforcerun" -- To debug one box with INTERNAL ERROR. local memo = viewers.save_configs("viewers.drop") -- Save global configuration before eventual changes. local t = "" local dropit = {} local d = dropit dropit.title = title dropit.selector, dropit.title, dropit.content_or_func, dropit.args = selector, title, content_or_func, { ... } -- optional arguments for the content_or_func function dropit.content_or_func_error = viewers.form9user("\n* Error : Abnormal content for drop_box.new(%1, %2).\n*", dropit.selector, dropit.title, dropit.content_or_func) -- , %3 if selector == "never" then return "" end if not ( (selector == true) or (selector == title) or viewers.is_in_sp(selector, "allwaysview alltestsview enforcerun failinref nocontent") ) then return "" end -- Style options in dropit{}: ta1, image, ta2, margin_bottom, width, border_radius, border_color, bg1) for i, args_tab in ipairs(dropit.args) do -- Get the dropit options for the drop_box. modes.recursiveLoop = (modes.recursiveLoop or 0) + 1 if modes.recursiveLoop > 33 then return "" end -- The last argument can be a dropit to change the look of the drop_box if (i == lua_table.level_count(dropit.args) ) and (type(dropit.args_tab) == "table") and (dropit.args_tab["dropit"] == "dropit") then dropit.dropit = mw.clone( dropit.args_tab ) end end if (type(dropit.title) ~= "string") then dropit.title = "Default_title" end -- Style options in dropit{}: ta1, image, ta2, margin_bottom, width, border_radius, border_color, bg1) for i, args_tab in ipairs(dropit.args) do -- Get the dropit options for the drop_box. modes.recursiveLoop = (modes.recursiveLoop or 0) + 1 if modes.recursiveLoop > 33 then return "" end -- The last argument can be a dropit to change the look of the drop_box if (i == lua_table.level_count(dropit.args) ) and (type(args_tab) == "table") and (args_tab["dropit"] == "dropit") then dropit = mw.clone( args_tab ) end end if type(dropit.title) ~= "string" then dropit.title = "viewers_dropdown_missing_title" elseif type(dropit.content_or_func) == "string" then dropit.content = dropit.content_or_func elseif type(dropit.func_from_name) == "function" then -- In case of named function: dropit.content = dropit.func_from_name( dropit.args) -- and use it as content form function elseif type(dropit.content_or_func) == "string" then dropit.content = lua_table.from_subnames_object(dropit.content_or_func) end -- Get the last sub-table from its sub-names. dropit.content_error = "" dropit.title = dropit.title .. ( dropit.title_errors or "" ) dropit.resultKind = "ref" local res = drop_box.form(dropit.title, dropit.content, dropit) if not dropit.success then dropit.content_ref = "content_error[1]" dropit.content = dropit.content_ref end -- drop_box from https://fr.wikisource.org/wiki/Modèle:Boîte déroulante = drop_box from template on 20180505 OK. -- p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form local dropbox_title = 'Boîte déroulante' -- d.title = viewers.form9user(dropit.title) d.title = viewers.form9page(dropit.title) -- local dropbox_title = viewers.form9content("p_template_drop_box_name") t = t .. mw.getCurrentFrame():expandTemplate{ title = dropbox_title, args = { ["label"] = d.label, ["titre"] = d.title, ["contenu"] = d.content, ["margeHaut"] = d.margin_all, ["margeBas"] = d.margin_bottom, ["hauteur"] = d.height, -- ["width"] = d.width, -- not in html V5 ["couleurFond"] = d.bg1, ["couleurBordure"] = d.tc1, ["alignT"] = d.ta1, ["align"] = d.ta2, ["arrondi"] = d.border_radius, ["couleurBordure"] = d.border_color, -- Keep default values for : br, image, alignB, hauteur, margeHaut, margeBas } } viewers.restore_configs(memo, "viewers.drop") -- Restore global configurations after eventual changes. return t end -- function viewers.drop(selector, title, content, ...)
-- Build a table, with headers for columns. Example:f -- ! style="text-align:left;"| Item -- {| class="wikitable" style="text-align: center; color: green;" -- {| border="1" style="border-crash:crash" -- {| class="wikitable sortable" border="1" mw-collapsible mw-crashd" -- |} end of table function viewers.table_head(t) return '\n{| class="' .. tostring( t or 'wikitable alternative center' ) .. '" | ' end -- Table columns headers -- or " " -- A triable table start with : {| class="wikitable sortable" -- A column become fix and not triable with : ||class="unsortable"| -- A row become fix and not triable with : |- class="sortbottom" function viewers.table_col(t) return '\n! scope="col" | ' .. tostring( t or " " ) end -- Table repeated or different columns headers function viewers.table_row(t) return "\n|- " .. tostring( t or " " ) end -- Table -- row function viewers.table_dat(t) return "\n| " .. tostring( t or " ") end -- Table data -- or " " function viewers.table_end(t) return "\n|}" end -- Table end
viewers.default_test_group = { { "abc", 123, "A1, B2, C3" }, { "equation", "y =", (11 * 7 + 3 * 12 + 1) }, { "Matrix:", { "2.1.0", "v4-6, ISO_8601, FC14 h6" } }, { "pi = ", "circle / diameter", 3.14, }, { "quadrature", function() end, "convert a square to a circle" }, }
function tableview.form_one_case(case, tab_view) -- Default: Convert a case from test_group to rowGroup. local tocase = case -- {} return case end -- function tableview.form_one_case(case)
function tableview.add_Row(case, tab_view) -- Adds a row to a rowGroup. local t = t -- t or if (type(t) ~= "string") then t = '\n* tableview.add_Row(case, tab_view) : Adds a row to a rowGroup' end if (type(case) == "table") and (type(tab_view) == "table") and (type(tab_view.rowGroup) == "table") then -- tab_view must be a table t = t .. viewers.ta("add_Row-#rowGroup: ", lua_table.level_count(tab_view.rowGroup) ) -- track to debug t = t .. viewers.ta("add_Row-#case: ", lua_table.level_count(case) ) -- track to debug table.insert( tab_view.rowGroup, case) elseif (type(case) == "table") and (type(tab_view) == "table") then -- tab_view.rowGroup = {} table.insert( tab_view.rowGroup, case) t = t .. viewers.ta("add_Row-#rowGroup: ", lua_table.level_count(tab_view.rowGroup) ) -- track to debug t = t .. viewers.ta("add_Row-#case: ", lua_table.level_count(case) ) -- track to debug end return t end -- function tableview.add_Row(tab_view)
function tableview.form_all_cases(tab_view) -- Forms all cases in a table view local memo = viewers.save_configs("tableview.form_all_cases") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* tableview.add_Row(case, tab_view) : Forms all cases in a table view' end local tab_view = tab_view if (type(tab_view) ~= "table") then tab_view = {} end -- tab_view must be a table if type(tab_view.test_group) ~= "table" then -- tab_view.test_group must be a table tab_view.test_group = {} end tab_view.rowGroup = tab_view.rowGroup or {} tab_view.track = tab_view.track or {} -- Begin tracking of errors and caracteristics of a tab_view case. local trk = tab_view.track if (type(tab_view) ~= "table") then trk.tab_view = tab_view end -- err tab_view is table ? trk.min_in = 999999 ; trk.max_in = 0 trk.min_out = 999999 ; trk.max_out = 0 trk.Start_test = tab_view.test_group -- err tab_view.test_group is table ? trk.Start_test_N = lua_table.level_count(tab_view.test_group) -- size tab_view.test_group trk.Start_row = tab_view.rowGroup -- err tab_view.test_group is table ? trk.Start_row_N = lua_table.level_count(tab_view.rowGroup) -- size tab_view.test_group tab_view.t = tab_view.t .. viewers.ta("start#test_group", lua_table.level_count(tab_view.test_group) ) -- track to debug if type(tab_view.rowGroup) ~= "table" then tab_view.rowGroup = {} end tab_view.t = tab_view.t .. viewers.ta("start#rowGroup", lua_table.level_count(tab_view.rowGroup) ) -- track to debug for i, case in ipairs(tab_view.test_group) do -- tab_view.t = tab_view.t .. viewers.ta("i", i) if case.STOP == "STOP" then break end trk.i = i trk.case_in = case -- for table error ? if type(case) ~= "table" then case = { case } end -- Cases must be tables of values. trk.min_in = 99 ; trk.max_in = 0 trk.min_out = 99 ; trk.max_out = 0 if lua_table.level_count(case) < trk.min_in then trk.min_in = lua_table.level_count(case) end if lua_table.level_count(case) > trk.max_in then trk.max_in = lua_table.level_count(case) end if type(tableview.form_one_case) == "function" then -- Convert all tests cases from test_group to rowGroup. case = tab_view.form_one_case(case, tab_view) -- Formats one case else case = case -- if tableView_form_one_case() is not defined, do not Formats the case end -- Keep all cells: Insert a masked text in all table cells, to not lost following cells. if (type(case) == "table") and (type(tab_view.rowGroup) == "table") then -- Do not fail if case is nil or {}. local headers_split = mw.text.split(tab_view.headers, ';', true) -- fr wikisource org for i, header in ipairs(headers_split) do header = mw.text.trim(header) case[i] = case[i] or viewers.usual_color("-", "mask") -- "mask", "discreet", "error" end end if type(case) ~= "table" then -- check case_out case = { case } end if lua_table.level_count(case) < trk.min_out then trk.min_out = lua_table.level_count(case) end if lua_table.level_count(case) > trk.max_out then trk.min_out = lua_table.level_count(case) end tab_view.add_Row(case, tab_view) -- Default: Add a row to rowGroup. trk.End_test = tab_view.test_group -- err tab_view.test_group is table ? trk.End_test_N = lua_table.level_count(tab_view.test_group) -- err tab_view.test_group is table ? trk.End_row = tab_view.rowGroup -- err tab_view.test_group is table ? trk.End_row_N = lua_table.level_count(tab_view.rowGroup) -- err tab_view.test_group is table ? tab_view.t = tab_view.t .. "\n* Start: " tab_view.t = tab_view.t .. viewers.form9user("tb=%1, tbN=%2, min=%3, max=%4. ", tostring(trk.Start_test), trk.Start_test_N, trk.min_in, trk.max_in) -- track to debug tab_view.t = tab_view.t .. viewers.form9user("i=%1, case_in=%2, case_out=%3, ", tostring(trk.i), type(trk.case_in), type(trk.case_out) ) trk.Start_test = tab_view.test_group -- err tab_view.test_group is table ? trk.Start_test_N = lua_table.level_count(tab_view.test_group) -- size tab_view.test_group trk.Start_row = tab_view.rowGroup -- err tab_view.test_group is table ? trk.Start_row_N = lua_table.level_count(tab_view.rowGroup) -- err tab_view.test_group is table ? tab_view.t = tab_view.t .. " ** End: " tab_view.t = tab_view.t .. viewers.form9user("tb=%1, tbN=%2, min=%3, max=%4. ", tostring(trk.End_test), trk.End_test_N, trk.min_out, trk.max_out) -- track to debug tab_view.track = trk end viewers.restore_configs(memo, "tableview.form_all_cases") -- Restore global configurations after eventual changes. end -- function tableview.form_all_cases(tab_view)
function tableview.adapt_options(tab_view) -- Adapts all options to the view of a table for all uses. local memo = viewers.save_configs("tableview.adapt_options") -- Save global configuration before eventual changes. if type(tab_view) ~= "table" then tab_view = {} end -- tab_view must be a table local t = t -- t or if (type(t) ~= "string") then t = '\n* tableview.adapt_options(tab_view) : Adapts all options to the view of a table for all uses' end tab_view.t = t tab_view.headers = tab_view.headers or "viewers_tableView_default_headers" tab_view.headers = viewers.form9user(tab_view.headers) tab_view.form_elem_detail = tab_view.form_elem_detail or "viewers_tab_view_form_elem_detail" -- "detail = %1 | %2 | %3 | %4 | %5." tab_view.headers_class = tab_view.headers_class or "wikitable alternative center" -- headers_class = "wikitable alternative center sortable", -- A triable table start with : {| class="wikitable sortable" -- A column become fix and not triable with : ||class="unsortable"| tab_view.tableStyle = tab_view.tableStyle or " " -- Style of the whole table view. tab_view.test_group = tab_view.test_group or viewers.default_test_group tab_view.t = tab_view.t .. viewers.ta("tableView.tab_view.test_group size: ", lua_table.level_count(tab_view.test_group) ) -- track to debug tab_view.form_one_case = tab_view.form_one_case or tableview.form_one_case tab_view.form_all_cases = tab_view.form_all_cases or tableview.form_all_cases tab_view.add_Row = tab_view.add_Row or tableview.add_Row tab_view.ccc = tab_view.ccc or tableview.ccc or {} -- To communicate and compute between cases tab_view.rowGroup = tab_view.rowGroup or {} -- Only tab_view can change rowGroup to avoid effect from a tableview on the next tab_view.track_on = tab_view.track_on or false tab_view.t = tab_view.t .. viewers.ta("#tab_view.rowGroup", lua_table.level_count(tab_view.rowGroup) ) -- track to debug viewers.restore_configs(memo, "tableview.adapt_options") -- Restore global configurations after eventual changes. return tab_view end -- function tableview.adapt_options(tab_view)
function tableview.form_whole_view(tab_view) -- Formats whole the tableview.new() local memo = viewers.save_configs("tableview.form_all_cases") -- Save global configuration before eventual changes. local t, err = "", "" if (lua_table.level_count(tab_view.test_group) == 0) then err = err .. viewers.ta("#tab_view.test_group", lua_table.level_count(tab_view.test_group) ) end local t = viewers.table_head(tab_view.headers_class or "") if (type(tab_view.headers) ~= "string") then tab_view.headers = "tab_view; headers; missing" err = err .. tab_view.headers end local head = mw.text.split( viewers.form9user(tab_view.headers), ";") for i, header in ipairs(head) do -- Formats headers of the table. t = t .. viewers.table_col(header or "") end tableview.form_all_cases(tab_view) -- Default: Convert all tests cases from test_group to rowGroup. if (type(tab_view.rowGroup) ~= "table") then tab_view.rowGroup = {} end if (lua_table.level_count(tab_view.rowGroup == 0) ) then err = err .. "whole:" err = err .. viewers.ta("#tab_view.test_group", lua_table.level_count(tab_view.test_group) ) err = err .. viewers.ta("#tab_view.rowGroup", lua_table.level_count(tab_view.rowGroup) ) end for row_i, columns_i in ipairs(tab_view.rowGroup) do -- Formats the content of each of rows. t = t .. viewers.table_row() for col, val in ipairs(columns_i) do t = t .. viewers.table_dat(val or "") -- each value in columns of row_i end end t = t .. viewers.table_end() if tab_view.track_on then t = t .. "tableView_form_whole_view: " .. tostring(err) end if (err ~= "") and (tab_view.track_on) then t = t .. "tableView_form_whole_view: " .. tostring(err) end viewers.restore_configs(memo, "tableview.form_whole_view") return t end -- function tableview.form_whole_view(tab_view) -- S170610csc
function tableview.new(tab_view) -- Formats a table with lines and columns. S170610tvf local memo = viewers.save_configs("tableview.form_whole_view") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* tableview.new(tab_view) : Formats a table with lines and columns' end if type(tab_view) ~= "table" then tab_view = {} end -- tab_view must be a table t = t .. viewers.ta("tableView: ", "start") local err = nil tab_view = tableview.adapt_options(tab_view) -- Adapt all options for all uses, before all other adaptations. if tab_view.track_on then t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) ) end t = t .. tableview.form_whole_view(tab_view) -- Formats whole the tableview.new() if tab_view.track_on then t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) ) end if tab_view.track_on then t = t .. tab_view.t end -- Counts of selected and sorted sub-tasks: , #test_group = 43 , #rowGroup = 0 viewers.restore_configs(memo, "tableview.form_whole_view") -- Restore global configurations after eventual changes. return t, err, tab_view end -- t, err, tab_view = function tableview.new(tab_view)
function activity.detect_MediaWiki_changes() -- Detects, records and reports all date-time changes of MediaWiki, in each wiki -- Could record MediaWiki_Versions in Special:PageData T163923 local t = t -- t or if type(t) ~= "string" then t = '\n* activity.detect_MediaWiki_changes() : Detects, records and reports all date-time changes of MediaWiki, in each wiki' end versions.site_currentVersion = mw.site.currentVersion versions.MediaWiki_version_memo = vers if mw.site.currentVersion == versions.MediaWiki_version_memo then versions.site_currentVersion_view = viewers.styles_color_discreet(versions.site_currentVersion) else versions.site_currentVersion_view = viewers.styles_color_error(versions.site_currentVersion) end t = t .. "\n* See also the MediaWiki Manual:Substitution." return "" -- t end -- function versions.detect_MediaWiki_changes()
-- cut_libraries
modes.central_libraries = { -- New libraries to record in package.loaded[] { "activity", "The Library:activity supports Lua-coders sub-tasks and inter-wikis central modules.", }, { "datas", "The Library:datas gets datas from the Wikibase.", }, { "events", "The Library:events form events like erros, warnings and categories.", }, { "langs", "The Library:langs supports i18n translations.", }, { "lua_table", "The Library:lua_table enhances the native Lua table library, to avoid ambiguities.", }, { "mathroman", "The Library:mathroman converts roman numbers and detect errors. It is here as an example of very small central library.", }, { "modes", "The Library:modes supports the modes and their options, like p.read(frame).", }, { "tables", "The Library:tables formats rows of tables in html. Sortable tables with buttons are forbiden in MediaWiki.", }, { "versions", "The Library:versions installs all central libraries, modules, their i18n translations and versions.", }, { "viewers", "The Library:viewer translates and formats strings to document texts and table views.", }, -- Objects have a function object.new() to form several objects. { "drop_box", "The Object:drop_box, in the Library:viewers, formats drop-boxes. It needs a local template installed with Centralizer.", }, { "central_library","The Object:central_library, in the Library:versions, formats the basis of libraries and their properties.", }, { "tableview", "The Object:tableview, in the Library:viewers, formats some viewers for tables, in lines and columns.", }, { "tracker", "The Object:tracker, in the Library:activity, formats parametrables tracks to help to debug the code.", }, }
-- cut_libraries
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Object:tracker implements parametrable track objects to debug the Lua code. -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- tracker = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded tracker.obj = { -- Options from: default, init and use steps. To mix in obj.* ["level"] = 1, -- level of detail of each track line ["name"] = "TRACK", -- name of the track ["where"] = "IN TRACK", -- name of the track ["limit"] = 2, -- Limit of track more or less details ["form"] = "\n* %1 in=%2", -- begin or each track line ["more"] = ", arg%1=%2", -- add to the previous text ["t"] = "", -- resulting text with all track lines ["groupname"] = "*.+!;-/", -- to display all grouped events with a same name ["add"] = function() return "" end, -- for tracker.initadd(opt) ["trk"] = function() return "" end, -- for tracker.initrack(opt) }
function tracker.new(opt) -- Initializes a track list. -- The groupid option can select which track select and add in the groupname group. if (type(opt) ~= "table") then opt = {} end opt.level = opt.level or 1 -- level of detail of each track line opt.name = opt.name or "TRACK" -- name of the track opt.limit = opt.limit or 1 -- limit of detailed lines opt.form = opt.form or "\n* %1 in=%2" -- begin or each track line opt.more = opt.more or ", arg%1=%2" -- add to the previous text opt.t = opt.t or "" -- resulting text with all track lines opt.trackon = 1 -- track on or not (= 0) for one track object. opt.groupid = opt.groupid -- to select tracks in a group opt.groupname = opt.groupname -- to display all grouped events with a same name return opt end -- function tracker.new(opt)
function tracker.add(opt, level, IN, ... ) -- Adds, or not, a new track line to the track list.
local t = "" -- function tracker:add(self, ...) -- table.func = function ( self, var-list ) block end
if (type(opt) ~= "table") then return t end
if opt.trackon == 0 then return t end
if viewers.is_in_sp(opt.groupid, IN) then
opt.grouptrack = opt.groupname or opt.groupid
end
if opt.grouptrack then t = t .. "" .. opt.grouptrack .. ": " end
if (type(level) == "number") and (level > opt.limit) then return t end
local vals, vals_t = { ... }, ""
local vals_t = "\n* " .. opt.name .. ": " .. viewers.ta("in", IN)
if (type(vals[1]) == "table") then vals = vals[1] end
for k, var in pairs( vals ) do
if var ~= nil then vals_t = vals_t .. viewers.ta(k, tostring(var) ) end
end
if where == opt.name then -- List the tracker options
opt.values = viewers.ta("name", opt.name) -- .. viewers.ta("level", opt.level)
.. viewers.ta("limit", opt.limit) -- .. viewers.ta("form", opt.form) .. viewers.ta("more", opt.more)
.. viewers.ta("opt_N", lua_table.count_all(opt) ) .. viewers.ta("trackon", opt.trackon) -- .. viewers.ta("t", opt.t)
return opt.t .. vals_t .. opt.values .. "
"
end
opt.t = opt.t .. vals_t -- add this track to the list of track lines
t = t .. "
"
return t -- report local track line
end -- tracker.ARGS.t
function tracker.initadd_old(opt) -- Initialize a track local obj = mw.clone(tracker.obj) if (type(opt) ~= "table") then opt = {} end for key, val in pairs(opt) do if (type(key) == "string") and (val ~= nil) then obj[key] = val end end obj = tracker.new(obj) opt.add = tracker.add _G[obj.name] = obj return obj end -- function tracker.initadd(opt)
function tracker.initadd(opt) -- Initialize a track if (type(opt) ~= "table") then opt = {} end if (type(opt) == "table") and (type(opt.add) == "function") and (opt.name == _G[opt.name]) then -- _G[opt.name] = opt -- Reuse already initialized tracker for its continuity. -- return opt end opt = tracker.new(opt) opt.add = tracker.add _G[opt.name] = opt return opt end -- ARGS = tracker.initadd({ ["name"] = "ARGS", limit = 2, }) -- Initialize a track
-- See: "Function as a method in a table" in Lua_reference_manual#Function_declaration_statements function tracker.initrack(opt) -- Initialize one new tracker and its track lines. if (type(opt) ~= "table") then opt = { ["name"] = "DEFAULTRACK", ["limit"] = 2 } end if (type(opt.name) ~= "string") then opt.name = "DEFAULTRACK" end if (type(opt.limit) ~= "number") then opt.limit = 2 end local optrk = mw.clone(opt) -- New initial tracker object function optrk:trk(self, limit, name, vals) -- see S171015trk return tracker.add(self, limit, name, vals) or "\n* optrk:trk. " end _G[optrk.name] = optrk return optrk end -- ARGS = tracker.initrack({ ["name"] = "ARGS", limit = 2, }) -- Initialize a track
function tracker.init_trakers() -- Initialize some trakers. To run in Central.init() ARGS = tracker.initadd({ ["name"] = "ARGS", ["limit"] = 2 }) -- Initialize a track CNT = tracker.initadd({ ["name"] = "CNT", ["limit"] = 2 }) -- Initialize a track DAT = tracker.initadd({ ["name"] = "DAT", ["limit"] = 2 }) -- Initialize a track return "\n* ARGS.t=" .. tostring(ARGS.t) .. ", CNT.t=" .. tostring(CNT.t) end
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:activity begins to support other tests wikis. It translates tests pages names for these wikis. -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
activity.i18n = {} -- Translations for activity library
activity.i18n.br = { -- br = Breton = Brezhoneg
-- Pour traduire, les langues de référence sont l'anglais et le français.
-- Pour traduire, ne traduisez pas des parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q11758
;
; \n* ; _G.
["docfunc"] = "docfunc",
["docitem"] = "docitem",
["dockey"] = "dockey",
activity_description = "La Library:activity soutient la gestion des tâches de phabricator, des sous-tâches inter Lua-codeurs et des modules centraux interwikis.",
activity_central_library_description = "La Library:activity soutient la gestion des tâches de phabricator, des sous-tâches inter Lua-codeurs et des modules centraux interwikis.",
activity_translate_string_guide = "Pour traduire, ne traduisez pas les parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q11758
;
;
; \n* ; _G.",
activity_Module_Central_central_version = "Module:Centralizer",
activity_Library_translate_I18N = "Module:Library/translate/I18N",
activity_Central_modules_reference_manual = "Scribunto/Central modules reference manual",
activity_report_subtasks_title = 'activity.central_subtasks_report(t) Surveiller les sous-tâches. Voir "NOW".',
activity_MW_Versions_report_title = "activity.MW_Versions_report() Surveiller les versions de MediaWiki, les 3 derniers mois.", -- fr
activity_central_count_admins_active_users = "Ce site, fr.wikisource.org, compte %1 administrateurs pour %2 utilisateurs actifs.",
activity_support_central_modules_title = "activity.begin_central_modules_support() Soutenir les premières utilisations des Central modules.",
activity_support_central_modules_headers = "Project; Language; Admins; Assets; Lien Modèle; Lien Module; Lien Tests; Début; Utilisé depuis; Codeur; OK", -- fr
activity_phabricator_tasks_title = "activity.phabricator_tasks_report() États des tâches connexes dans Phabricator",
activity_phabricator_tasks_headers = "Importance, modifiée le; Tâche; Etat; Titre",
activity_central_functions_report_title = "activity.central_functions_report(t) Lister les fonctions actuelles.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Signaler les déséquilibres des débuts et des fins de gras dans le code.",
activity_space_name_module = "Modulenn", -- br
activity_space_name_template = "Patrom",
activity_space_name_user = "Implijer", -- Implijer:VIGNERON - Wikimammenn
activity_test_page_user = "Documentation", -- br Documentation, Dokumentation, D
} -- activity.i18n.br
activity.i18n.de = { -- de = German = Deutsche
-- Modul:Central-s-de/Doku Erreur de script : le module « Central-s-de » n’existe pas. de = German = Deutsch
["docfunc"] = "docfunc",
["docitem"] = "docitem",
["dockey"] = "dockey",
activity_description = "Das Library:activity Das Ding unterstützt das Management von phaborator-Aufgaben, von inter-Lua-Coder-Unteraufgaben und von interwikis-Zentralmodulen.",
activity_central_library_description = "Das Library:activity Das Ding unterstützt das Management von phaborator-Aufgaben, von inter-Lua-Coder-Unteraufgaben und von interwikis-Zentralmodulen.",
activity_Module_Central_central_version = "Modul:Central",
activity_Library_translate_I18N = "Modul:Library/translate/I18N",
activity_Central_modules_reference_manual = "Scribunto/Central modules reference manual",
activity_support_central_modules_title = "activity.begin_central_modules_support() Unterstützen Sie die ersten Anwendungen von Central-Modulen.",
activity_support_central_modules_headers = "Projekt; Speicher; Admins; Vermögenswerte; Modellverbindung; Modulverbindung; LinkTests; beginnen; Gebraucht seit; Encoder; Ok", -- fr
activity_report_subtasks_title = 'activity.central_subtasks_report(t) Überwachen Sie den aktuellen Stand der subtasks. See "NOW".',
activity_MW_Versions_report_title = "activity.MW_Versions_report() Überwachen von MediaWiki-Versionen, letzten 3 Monate.", -- de
activity_central_count_admins_active_users = "Für diese Seite, br.wikisource.org, Konto %1 Direktoren für %2 aktive Nutzer.",
activity_phabricator_tasks_title = "activity.phabricator_tasks_report() Zuständige Aufgaben in Phabricator",
activity_phabricator_tasks_headers = "Wichtigkeit; modifiziert die; Aufgabe; Status; Titel",
activity_central_functions_report_title = "activity.central_functions_report(t) Listen Sie die aktuellen Funktionen auf.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Melden Sie Ungleichgewichte von Anfang und Ende von Fett im Code.",
activity_space_name_module = "Modul", -- de
activity_space_name_template = "Vorlage",
activity_space_name_user = "Benutzer",
activity_test_page_user = "Dokumentation",
} -- activity.i18n.de
activity.i18n.en = { -- en = English = English
-- To translate, referral languages are English and French.
-- To translate, do not translate parts like these: %1 ; %1 = %2 (%3) ; Q11758
;
; \n* ; _G.
["docfunc"] = "docfunc",
["docitem"] = "docitem",
["dockey"] = "dockey",
activity_description = "The Library:activity supports the management of phabricator tasks, of inter Lua-coders sub-tasks, and of interwikis central modules.",
activity_central_library_description = "The Library:activity supports the management of phabricator tasks, of inter Lua-coders sub-tasks, and of interwikis central modules.",
activity_translate_string_guide = "To translate, do not translate parts like these: %1 ; %1 = %2 (%3) ; Q11758
;
;
; \n* ; _G.",
activity_Module_Central_central_version = "Module:Centralizer",
activity_Library_translate_I18N = "Module:Library/translate/I18N",
activity_Central_modules_reference_manual = "Scribunto/Central modules reference manual",
activity_report_subtasks_title = 'activity.central_subtasks_report(t) Monitor the current subtasks. See "NOW".',
activity_MW_Versions_report_title = "activity.MW_Versions_report() Monitor MediaWiki versions, last 3 months.", -- en
activity_central_count_admins_active_users = "This site, br.wikisource.org, count %1 administrators for %2 active users.",
activity_support_central_modules_title = "activity.begin_central_modules_support() Support the first uses of Central modules.",
activity_support_central_modules_headers = "Project; Save; Admins; assets; Model link; Module link; Link Tests; start; Used since; encoder; OK", -- fr
activity_phabricator_tasks_title = "activity.phabricator_tasks_report() States of related tasks in Phabricator",
activity_phabricator_tasks_headers = "Importance; modified on; Task; Status; Title",
activity_central_functions_report_title = "activity.central_functions_report(t) List actual functions.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Report imbalances of beginnings and ends of bold in code.",
activity_space_name_module = "Module", -- en
activity_space_name_template = "Template",
activity_space_name_user = "User",
activity_test_page_user = "Documentation",
} -- activity.i18n.en
activity.i18n.es = { -- es = Spanish = español
-- To translate, referral languages are English and French.
-- To translate, do not translate parts like these: %1 ; %1 = %2 (%3) ; Q11758
;
; \n* ; _G.
["docfunc"] = "docfunc",
["docitem"] = "docitem",
["dockey"] = "dockey",
activity_description = "La Library:activity soporta la gestión de tareas de phabricator, de sub-tareas inter Lua-coders, y de módulos interwikis centrales.",
activity_central_library_description = "La Library:activity soporta la gestión de tareas de phabricator, de sub-tareas inter Lua-coders, y de módulos interwikis centrales.",
activity_translate_string_guide = "Para traducir, no traducir partes como estas: %1 ; %1 = %2 (%3) ; Q535
;
;
; \n* ; _G.",
activity_Module_Central_central_version = "Módulo:Central",
activity_Library_translate_I18N = "Módulo:Library/translate/I18N",
activity_Central_modules_reference_manual = "Scribunto/Central modules reference manual",
activity_support_central_modules_title = "activity.begin_central_modules_support() Apoye los primeros usos de los módulos centrales.",
activity_support_central_modules_headers = "proyecto; Guarde; Administradores; activos; Enlace modelo; Enlace del módulo; Enlace Tests; Inicio; Usado desde entonces; codificador; bueno", -- fr
activity_report_subtasks_title = 'activity.central_subtasks_report(t) Monitorear las subtareas. See "NOW".',
activity_MW_Versions_report_title = "activity.MW_Versions_report() Monitorear las versiones de MediaWiki, últimos 3 meses.", -- es
activity_central_count_admins_active_users = "Este sitio, br.wikisource.org, cuenta %1 administradores para %2 usuarios activos.",
activity_phabricator_tasks_title = "activity.phabricator_tasks_report() Tareas relacionadas con los estados en Phabricator",
activity_phabricator_tasks_headers = "Importancia; modificado; Tarea; Estado; Título",
activity_central_functions_report_title = "activity.central_functions_report(t) Listar funciones actuales.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Informe los desequilibrios de los comienzos y los extremos de negrita en el código.",
activity_space_name_module = "Módulo", -- es
activity_space_name_template = "Modelo",
activity_space_name_user = "Usuario",
activity_test_page_user = "Documentación", -- br Documentation, Dokumentation,
} -- activity.i18n.es
activity.i18n.fr = { -- fr = French = Français
-- Pour traduire, les langues de référence sont l'anglais et le français.
-- Pour traduire, ne traduisez pas des parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
["docfunc"] = "docfunc",
["docitem"] = "docitem",
["dockey"] = "dockey",
activity_description = "La Library:activity soutient la gestion des tâches de phabricator, des sous-tâches inter Lua-codeurs et des modules centraux interwikis.",
activity_central_library_description = "La Library:activity soutient la gestion des tâches de phabricator, des sous-tâches inter Lua-codeurs et des modules centraux interwikis.",
activity_translate_string_guide = "Pour traduire, ne traduisez pas les parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q535
;
;
; \n* ; _G.",
activity_Module_Central_central_version = "Module:Centralizer",
activity_Library_translate_I18N = "Module:Library/translate/I18N",
activity_Central_modules_reference_manual = "Scribunto/Central modules reference manual",
activity_report_subtasks_title = 'activity.central_subtasks_report(t) Surveiller les sous-tâches. Voir "NOW".',
activity_MW_Versions_report_title = "activity.MW_Versions_report() Surveiller les versions de MediaWiki, les 3 derniers mois.", -- fr
activity_central_count_admins_active_users = "Ce site, fr.wikisource.org, compte %1 administrateurs pour %2 utilisateurs actifs.",
activity_support_central_modules_title = "activity.begin_central_modules_support() Soutenir les premières utilisations des Central modules.",
activity_support_central_modules_headers = "Project; Language; Admins; Assets; Lien Modèle; Lien Module; Lien Tests; Début; Utilisé depuis; Codeur; OK", -- fr
activity_phabricator_tasks_title = "activity.phabricator_tasks_report() États des tâches connexes dans Phabricator",
activity_phabricator_tasks_headers = "Importance, modifiée le; Tâche; Etat; Titre",
activity_central_functions_report_title = "activity.central_functions_report(t) Lister les fonctions actuelles.",
activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Signaler les déséquilibres des débuts et des fins de gras dans le code.",
activity_space_name_module = "Module", -- fr
activity_space_name_template = "Modèle",
activity_space_name_user = "Utilisateur",
activity_test_page_user = "Documentation", -- br Documentation, Dokumentation,
} -- activity.i18n.fr
activity.wikis_names = { -- see mw:Extension:WikimediaIncubator ["b"] = "wikibooks", ["cm"] = "commons", ["meta"] = "meta", ["mw"] = "MediaWiki", ["d"] = "wikidata", ["n"] = "wikinews", ["p"] = "wiki", ["q"] = "wikiquote", ["s"] = "wikisource", ["species"] = "species", ["t"] = "wiktionary", ["test"] = "test", ["test2"] = "test2", ["v"] = "wikiversity", ["w"] = "wikipedia", ["wm"] = "wikimedia", ["y"] = "wikivoyage", } -- activity.wikis_names -- see https://fr.wikisource.org/wiki/Spécial:Interwiki -- see https://www.MediaWiki.org/wiki/Special:Interwiki -- see https://fr.wikisource.org/wiki/Sp%C3%A9cial:Matrice_des_sites activity.kiwis_names = { ["commons"] = "cm", ["MediaWiki"] = "mw", ["meta"] = "meta", ["species"] = "species", ["wikidata"] = "d", ["test"] = "test", ["test2"] = "test2", ["wiki"] = "p", ["wikibooks"] = "b", ["wikimedia"] = "wm", ["wikinews"] = "n", ["wikipedia"] = "w", ["wikiquote"] = "q", ["wikisource"] = "s", ["wikiversity"] = "v", ["wikivoyage"] = "y", ["wiktionary"] = "t", }
activity.proto_version = "Centralizer-s-fr" activity.local_version = "Centralizer-s-fr" -- default Patrom:Central
activity.coder_lang_module = { -- List to report of Module:Centralizer for 'Begin to use' 7 central modules, 7 coders, 7 projets, 7 langs to get. -- br.wikisource.org/wiki/Modulenn:Centralizer-s-br/doc Erreur de script : le module « Centralizer-s-br » n’existe pas. fr = Breton = Breton = Breitz { ["lang"] = "br", ["project"] = "wikisource", ["module_vers"] = "Centralizer", ["coder"] = "VIGNERON", ["ok"] = "ok", ["project_short"] = "s", ["tests_lang"] = "Centralizer/Documentation", ["template"] = "Patrom", ["template_vers"] = "Centralizer", ["module"] = "Modulenn", ["admins"] = "16", ["assets"] = "236", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- -- de.wikisource.org/wiki/Modul:Centralizer/Doku Erreur de script : le module « Centralizer-s-de » n’existe pas. de = German = Deutsch { ["lang"] = "de", ["project"] = "wikisource", ["module_vers"] = "Centralizer", ["coder"] = "DerFussi", ["ok"] = "...", ["project_short"] = "s", ["tests_lang"] = "Centralizer/Dokumentation", ["template"] = "Vorlage", ["template_vers"] = "Centralizer", ["module"] = "Modul", ["admins"] = "16", ["assets"] = "236", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- sur la page de projet je ne vois pas qui d'autre :Hexasoft Tejgad Arkanosis Xfigpower Zebulon84 ;Hlm Z.; Od1n TomT0m Archimëa -- sur la page de projet je ne vois pas qui d'autre : Hexasoft (discuter), Tejgad (discuter), Arkanosis (discuter), Xfigpower (discuter), Zebulon84 (discuter),, Hlm Z. (discuter). -- Je rajoute au hasard Od1n (discuter), TomT0m (discuter) et... -- Archimëa < -- en.wikipedia.org/wiki/Module:Centralizer/Documentation Erreur de script : le module « Centralizer-w-en » n’existe pas. en = English = English { ["lang"] = "en", ["project"] = "wikipedia", ["module_vers"] = "Centralizer", ["coder"] = "Toohool", ["ok"] = "...", ["project_short"] = "w", ["tests_lang"] = "Centralizer/Documentation", ["template"] = "Template", ["template_vers"] = "Centralizer", ["module"] = "Module", ["admins"] = "0", ["assets"] = "0", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- -- es.wikipedia.org/wiki/Módulo:Centralizers/Documentación Erreur de script : le module « Centralizer-w-es » n’existe pas. es = Spanish = español { ["lang"] = "es", ["project"] = "wikipedia", ["module_vers"] = "Centralizer", ["coder"] = "Juan_Mayordomo", ["ok"] = "...", ["project_short"] = "w", ["tests_lang"] = "Centralizer/Documentación", ["template"] = "Plantilla", ["template_vers"] = "Centralizer", ["module"] = "Módulo", ["admins"] = "16", ["assets"] = "236", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- -- es.wikisource.org/wiki/Módulo:Centralizer-s-es/Documentación Erreur de script : le module « Centralizer-s-es » n’existe pas. es = Spanish = española { ["lang"] = "es", ["project"] = "wikisource", ["module_vers"] = "Centralizer", ["coder"] = "Alex brollo", ["ok"] = "...", -- Usuario:Juan_Mayordomo ["project_short"] = "s", ["tests_lang"] = "Centralizer/Documentación", ["template"] = "Plantilla", ["template_vers"] = "Centralizer", ["module"] = "Módulo", ["admins"] = "22", ["assets"] = "234", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- -- Module br Modulenn, de Modul, en Module, es Módulo, fr Module, hu Modul, vi Mô-đun, -- Template br Patrom, de Vorlage, en Template, es Modelo, fr Modèle, hu Modell, vi Mẫu, -- User br Implijer, de Benutzer, en User, es Usuario, fr Utilisateur, hu Használó, vi người sử dụng, -- Docum br Documentation, de Dokumentation, en Documentation, es Documentación, fr Documentation, hu Dokumentáció, vi tài liệu, -- fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation Erreur de script : le module « Centralizer-s-fr » n’existe pas. fr = French = Français { ["lang"] = "fr", ["project"] = "wikisource", ["module_vers"] = "Centralizer", ["coder"] = "Rical", ["ok"] = "ok", ["project_short"] = "s", ["tests_lang"] = "Centralizer/Documentation", ["template"] = "Modèle", ["template_vers"] = "Centralizer", ["module"] = "Module", ["admins"] = "16", ["assets"] = "204", ["beginon"] = "20180719", ["usedfrom"] = "20180719 ?", }, -- -- fr.wikisource.org/wiki/Module:Auteur2Tpt/Tests Erreur de script : le module « Auteur2Tpt » n’existe pas. fr = French = Français { ["lang"] = "fr", ["project"] = "wikisource", ["module_vers"] = "Auteur2Tpt", ["coder"] = "Rical", ["ok"] = "ok", ["project_short"] = "s", ["tests_lang"] = "Auteur2Tpt/Documentation", ["template"] = "Modèle", ["template_vers"] = "Auteur2Tpt", ["module"] = "Module", ["admins"] = "16", ["assets"] = "204", ["beginon"] = "20180719", ["usedfrom"] = "20180719 ?", }, -- -- hu.wikipedia.org/wiki/Modul:Centralizer-w-hu/doc Erreur de script : le module « Centralizer-w-hu » n’existe pas. hu = Hungarian = Magyar { ["lang"] = "hu", ["project"] = "wikipedia", ["module_vers"] = "Centralizer", ["coder"] = "Tacsipacsi", ["ok"] = "...", ["project_short"] = "w", ["tests_lang"] = "Centralizer/Dokumentáció", ["template"] = "Sablon", ["template_vers"] = "Centralizer", ["module"] = "Modul", ["admins"] = "3", ["assets"] = "77", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- -- vi.wikipedia.org/wiki/Mô đun:Centralizer-w-vi/tài liệu Erreur de script : le module « Centralizer-w-vi » n’existe pas. vi = Vietnamese = Tiếng Việt { ["lang"] = "vi", ["project"] = "wikipedia", ["module_vers"] = "Centralizer", ["coder"] = "mxn", ["ok"] = "...", ["project_short"] = "w", ["tests_lang"] = "Centralizer/vi tài liệu", ["template"] = "Bản mẫu", ["template_vers"] = "Centralizer", ["module"] = "Mô đun", ["admins"] = "3", ["assets"] = "77", ["beginon"] = "20180719 ?", ["usedfrom"] = "20180719 ?", }, -- Projects : MediaWikis wikidata wikipedia wikisource wikiquote meta test2 -- NOWNOW -- User = 2, Module = 828, Template = 10, -- In all central wikis, install Dropbox template in Template:CentralDropbox and sortable Table in template in Template:CentralTable -- { "20170805", "20170807", "todo", "Rical", "S170702ALC", "Ask Lua-coders: Oliv0, Tpt, Od1n, Ayack, Kertraon, Julien1978, Thibaut120094", }, -- { "20170805", "20170807", "todo", "Rical", "S170702ALC", "Ask Lua-coders: Zolo, Zebulon84, Hlm Z., Cantons-de-l'Est, Daehan", }, }
function activity.begin_central_modules_support(t) -- Supports the first uses of Central modules. local memo = viewers.save_configs("activity.begin_central_modules_support") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* activity.begin_central_modules_support(t) : Supports the first uses of Central modules' end -- p.ModuleNS = mw.site.namespaces.Module.name .. ":" -- translate Module: in other languages ONLY FOR local site t = t .. "\n* Local NameSpaces: " .. viewers.ta("Module=828", mw.site.namespaces.Module.name ) t = t .. viewers.ta("Template=10", mw.site.namespaces.Template.name ) t = t .. viewers.ta("User=2", mw.site.namespaces.User.name ) local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "activity.begin_central_modules_support", test_group = activity.coder_lang_module, -- CLM form_one_case = function(case) -- Convert a case from test_group to rowGroup. local mwuri = mw.uri.new() local hostPort = mwuri.hostPort local selector = mwuri.hostPort case = activity.central_module_descriptor(case) -- Begin to adapt the main central module version to a case. case.lang = tostring(case.lang) case.project = tostring(case.project) case.admins = tostring(case.admins) case.assets = tostring(case.assets) case.template = tostring(case.template) case.template_vers = tostring(case.template_vers) case.module = tostring(case.module) case.module_vers = tostring(case.module_vers) case.version = tostring(case.version) case.page_template = case.template .. ":" .. case.template_vers case.link_template = "" .. case.page_template .. "" case.page_module = case.module .. ":" .. case.module_vers case.link_module = "" .. case.page_module .. "" -- case.page_doc = case.tests_lang -- case.page_doc = case.module .. ":" .. case.tests_lang -- case.link_doc = "" .. case.tests_lang .. "" case.link_Tests = "" .. case.tests_lang .. "" return { case.project, case.lang, case.admins, case.assets, case.link_template, case.link_module, case.link_Tests, case.beginon, case.usedfrom, case.coder, case.ok } end, headers = "activity_monitor_central_libraries_headers", -- "Project; Language; Admins; Assets; Module version; Link to Tests; Start; Used since" headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. local langs, coders, projects, versions = {}, {}, {}, {} for i, case in pairs(activity.coder_lang_module) do if (type(case.lang) == "string") then table.insert(langs, case.lang) end if (type(case.coder) == "string") then table.insert(coders, case.coder) end if (type(case.project) == "string") then table.insert(projects, case.project) end if (type(case.module_vers) == "string") then table.insert(versions, case.module_vers) end end local counter = lua_table.count_values(coders, "lang") t = t .. "\n* Count begin coders: " .. viewers.ta("n", lua_table.level_count(counter) ) .. lua_table.rough_view(counter) local counter = lua_table.count_values(langs, "lang") t = t .. "\n* Count begin langs: " .. viewers.ta("n", lua_table.level_count(counter) ) .. lua_table.rough_view(counter) local counter = lua_table.count_values(projects, "lang") t = t .. "\n* Count begin projects: " .. viewers.ta("n", lua_table.level_count(counter) ) .. lua_table.rough_view(counter) local counter = lua_table.count_values(versions, "lang") t = t .. "\n* Count begin versions: " .. viewers.ta("n", lua_table.level_count(counter) ) .. lua_table.rough_view(counter) viewers.restore_configs(memo, "activity.begin_central_modules_support") -- Restore global configurations after eventual changes. return t end -- t = t .. activity.begin_central_modules_support(t) -- Survey the current state of sub tasks to debug. len
function activity.central_module_descriptor(wiki, selector) -- Begin to adapt the main central module version to a wiki. local mwuri = mw.uri.new() local hostPort = mwuri.hostPort local actual_wiki = false if type(selector ~= "string") then selector = hostPort end -- Adapt to actual wiki as default -- wiki.doc_full = wiki.version_full .. "/" .. wiki.doc -- fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation if not CMD then CMD = tracker.initadd({ ["name"] = "CMD", ["limit"] = 2 }) end -- Initialize a track wiki.actual_wiki = actual_wiki -- Is this wiki selected? if (type(wiki.doc_full) == "string") then -- fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation local points = string.gsub(wiki.doc_full, "/", ".") -- fr.wikisource.org.wiki.Module:Centralizer-s-fr.Documentation local points = string.gsub(points, ":", ".") -- fr.wikisource.org.wiki.Module.Central-s-fr.Documentation local s = mw.text.split(points, '.', true)-- { "fr", "wikisource", "org", "wiki", "Module", "Central-s-fr", "Documentation" } wiki.url_ref = "https://fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation" wiki.protocol = "https://" -- https:// wiki.lang_project_org = s[1] .. "." .. s[2] .. "." .. s[3] if (type(wiki.enforce_main_version) == "string") then wiki.lang_project_org = wiki.enforce_main_version end wiki.doc_full = string.gsub(wiki.doc_full, wiki.lang_project_org, wiki.enforce_main_version) -- fr.wikisource.org.wiki.Module.Central-s-fr.Documentation local points = string.gsub(wiki.doc_full, "/", ".") -- fr.wikisource.org.wiki.Module:Centralizer-s-fr.Documentation local points = string.gsub(points, ":", ".") -- fr.wikisource.org.wiki.Module.Central-s-fr.Documentation local s = mw.text.split(points, '.', true)-- s= { "fr", "wikisource", "org", "wiki", "Module", "Central-s-fr", "Documentation" } wiki.lang = s[1] -- fr wiki.project = s[2] -- wikisource if wiki.project =="MediaWiki" then wiki.lang = "en" end wiki.proj = activity.kiwis_names[wiki.project] or "proj" -- s in brief for wikisource wiki.org = s[3] -- org wiki.lang_project_org = wiki.lang .. "." .. wiki.project .. "." .. wiki.org -- fr.wikisource.org if wiki.lang_project_org == hostPort then actual_wiki = true ; wiki.actual_wiki = actual_wiki end if wiki.actual_wiki then wiki.admins = tostring(mw.site.stats.usersInGroup("sysop")) wiki.assets = tostring(mw.site.stats.activeUsers) wiki.found = true -- This wiki is selected CMD.add(CMD, 1, "descriptor admins assets hostPort", { ["admins"] = wiki.admins, ["assets"] = wiki.assets, ["actual_wiki"] = wiki.actual_wiki, ["lang_project_org"] = wiki.lang_project_org, } ) else wiki.admins = wiki.admins wiki.assets = wiki.assets wiki.actual_wiki = wiki.actual_wiki -- This wiki is selected CMD.add(CMD, 1, "descriptor admins assets else", { ["admins"] = wiki.admins, ["assets"] = wiki.assets, ["actual_wiki"] = wiki.actual_wiki, ["lang_project_org"] = wiki.lang_project_org, } ) end CMD.add(CMD, 1, "descriptor wikis_to_begin", { ["i"] = i, ["s"] = s, ["wiki.lang"] = wiki.lang, ["wiki.lang_project_org"] = wiki.lang_project_org, } ) wiki.wiki = s[4] -- wiki wiki.transmodule = s[5] -- Module wiki.version = "Central-" .. wiki.proj .. "-" .. wiki.lang -- Central-s-fr wiki.modulename = wiki.version -- s[6] -- Module wiki.version_full = wiki.lang_project_org .. "/" .. wiki.wiki .. "/" .. wiki.transmodule .. ":" .. wiki.version wiki.version_url = wiki.protocol .. wiki.lang_project_org .. "/" .. wiki.wiki .. "/" .. wiki.transmodule .. ":" .. wiki.version wiki.version_link = "[" .. wiki.version_url .. " " .. wiki.version .. "]" -- To link to the central version wiki.doc = s[7] -- Documentation wiki.doc_full = wiki.version_full .. "/" .. wiki.doc -- fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation wiki.doc_url = wiki.protocol .. wiki.doc_full -- https://fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation wiki.doc_link = "[" .. wiki.doc_url .. " " .. wiki.doc .. "]" -- To link to the documentation of the central version CMD.add(CMD, 1, "activity.descriptor links", { ["wiki.lang_project_org"] = wiki.lang_project_org, ["wiki.version"] = wiki.version, ["version_link"] = wiki.version_link, ["doc_link"] = wiki.doc_link, } ) end -- CMD.t = "\n* :activity.central_module_descriptor() END." return wiki end -- function activity.central_module_descriptor(wiki, selector)
function lua_table.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed. local t = viewers.ta("\n* Begin tab", tab ) .. viewers.ta("sortfield", sortfield) .. viewers.ta("sortorder", sortorder) local tab = tab or {} if (type(tab) == "string") then tab = mw.text.split(tostring(tab), ';') -- table to sort end t = t .. versions.sorted_libraries_list t = t .. viewers.ta("\n* Count of central libraries", lua_table.level_count(versions.sorted_libraries) ) if (type(tab) ~= "table") then tab = {} end if not ( (type(sortfield) == "number") or (type(sortfield) == "string") ) then sortfield = 1 end if (type(sortorder) ~= "string") then sortorder = "<" end local sorted, i = {}, 0 for key, elem in pairs(tab) do i = i + 1 table.insert(sorted, elem) end if (type(sortfield) == "string") then table.sort(sorted, function (a, b) return ( ( a[sortfield or "a"] ) < ( b[sortfield or "b"] ) ) end ) -- Sort libraries end if (type(sortfield) == "number") then -- table.sort(sorted, function (a, b) return ( ( a[sortfield or 1] ) < ( b[sortfield or 1] ) ) end ) -- Sort libraries end t = t .. viewers.ta("\n* End tab", tab ) .. viewers.ta("sortfield", sortfield) .. viewers.ta("sortorder", sortorder) return t end -- local sorted = lua_table.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed.
local ftd = ";" ftd = ftd .. "activity.phabricator_tasks_report;activity.rough_date_days;" ftd = ftd .. "activity.central_subtasks_report;activity.init_selected_wiki;activity.begin_central_modules_support;" ftd = ftd .. "activity.begin_central_modules_support;activity.central_functions_report;activity.central_subtasks_report;" ftd = ftd .. "activity.MW_Versions_report;activity.phabricator_tasks_report;" ftd = ftd .. "central_library.binded_in;central_library.new;" ftd = ftd .. "datas.get_image;datas.get_item;datas.get_item_report;datas.property;viewers.drop;" ftd = ftd .. "events.add_cat;events.add_cat_group;events.add_err;events.add_wng;events.all_kinds_test;" ftd = ftd .. "events.categories_lister;events.errors_lister;events.gener_categories;" ftd = ftd .. "langs.dummy_languages;langs.init_content_page_user_lang;langs.list_MediaWiki_languages;langs.main_i18n_languages_list;" ftd = ftd .. "langs.missing_translations;langs.translations_counts;" ftd = ftd .. "lua_table.count_all;lua_table.count_tests;lua_table.count_types;lua_table.count_values;" ftd = ftd .. "lua_table.from_subnames_object;lua_table.from_subnames_table;lua_table.level_count;lua_table.level_get;" ftd = ftd .. "lua_table.level_list;lua_table.named_sub_counts;lua_table.obj_from_subnames;lua_table.sort_onkey;" ftd = ftd .. "lua_table.sort_types;lua_table.structure;lua_table.structure_recursive_report;lua_table.tab_from_subnames;" ftd = ftd .. "lua_table.to_list;lua_table.to_list_tests;lua_table.to_table;lua_table.to_table_test;" ftd = ftd .. "mathroman.int2roman;mathroman.int2roman_test;mathroman.roman2int;mathroman.roman2int_tests;" ftd = ftd .. "modes.all_categories_list;modes.all_errors_list;modes.get_args;modes.get_default_args;modes.levenshtein;" ftd = ftd .. "modes.multiple_selection_tests;modes.options_from_args_tests;modes.recursive_normal;modes.recursive_normal_tests;modes.similar_args_list;" ftd = ftd .. "tableview.form_one_case;tableview.new;" ftd = ftd .. "version descriptor;versions.all_G_and_loaded_list;versions.get_one_module_or_library;versions.setup_central_libraries;" ftd = ftd .. "viewers.day_to_stamp;viewers.day_to_UTC;viewers.discreet_main_version;viewers.doc_group;viewers.doc_internal;" ftd = ftd .. "viewers.doc_module;viewers.doc_page;viewers.doc_section;viewers.form99content;viewers.form99page;viewers.phab_task;" ftd = ftd .. "viewers.form99user;viewers.form9content;viewers.form9en;viewers.form9page;viewers.form9user;viewers.form9user_test;" ftd = ftd .. "viewers.form_image;viewers.is_in;viewers.is_in_sp;viewers.main_view;viewers.restore_configs;lua_table.rough_view;" ftd = ftd .. "lua_table.rough_view_test;viewers.save_configs;viewers.save_restore_balance_report;viewers.simple_list;" ftd = ftd .. "viewers.simple_list_test;viewers.styles_small_caps;viewers.ta;viewers.tam;viewers.table_col;viewers.table_dat;" ftd = ftd .. "viewers.table_end;viewers.table_head;viewers.table_row;viewers.styles_color_add;viewers.styles_color_colargs;" ftd = ftd .. "viewers.styles_color_delete;viewers.styles_color_discreet;viewers.styles_color_error;viewers.styles_color_mask;" ftd = ftd .. "viewers.styles_color_normal;viewers.styles_color_warning;viewers.styles_color_wikidata;viewers.usual_color;"
activity.functions_to_doc = ftd
function activity.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed. local t = viewers.ta("\n* Begin tab", tab ) .. viewers.ta("sortfield", sortfield) .. viewers.ta("sortorder", sortorder) local tab = tab or {} if (type(tab) == "string") then tab = mw.text.split(tostring(tab), ';') -- table to sort end t = t .. viewers.ta("\n* Count of central libraries", lua_table.level_count(libname_libraries) ) if (type(tab) ~= "table") then tab = {} end if not ( (type(sortfield) == "number") or (type(sortfield) == "string") ) then sortfield = 1 end if (type(sortorder) ~= "string") then sortorder = "<" end local sorted, i = {}, 0 for key, elem in pairs(tab) do i = i + 1 table.insert(sorted, elem) end if (type(sortfield) == "string") then table.sort(sorted, function (a, b) return ( ( a[sortfield or "a"] ) < ( b[sortfield or "b"] ) ) end ) -- Sort libraries end if (type(sortfield) == "number") then -- table.sort(sorted, function (a, b) return ( ( a[sortfield or 1] ) < ( b[sortfield or 1] ) ) end ) -- Sort libraries end t = t .. viewers.ta("\n* End tab", tab ) .. viewers.ta("sortfield", sortfield) .. viewers.ta("sortorder", sortorder) return t end -- local sorted = activity.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed.
function activity.sort_central_libraries_functions(sorted_central_libraries) -- Select and sort central libraries and functions local sorted_central_libraries = sorted_central_libraries or {} -- To sort any table and convert in sequence if needed. local sorted_functions, libname, libname_funcname = {} for libname, lib in pairs(package.loaded) do -- search directly in package.loaded if(type(lib) == "table") and (type(lib.i18n) == "table") and (type(libname) == "string") -- Select central i18n objects and (not string.find(libname, ":") ) then -- Avoid central modules lib.libname = libname table.insert(sorted_central_libraries, lib) for funcname, func in pairs(lib) do -- search directly in package.loaded Rical 20180321 if (type(func) == "function") then -- select central libraries libname_funcname = libname .. "." .. funcname table.insert(sorted_functions, { ["libname"] = libname, ["funcname"] = funcname, ["libname_funcname"] = libname_funcname } ) end end end end table.sort(sorted_central_libraries, function (a, b) return ( a.libname < b.libname ) end ) -- Sort libraries table.sort(sorted_functions, function (a, b) return ( (a.libname_funcname < b.libname_funcname ) ) end ) -- Sort libraries activity.sorted_central_libraries = sorted_central_libraries activity.sorted_functions = sorted_functions return sorted_central_libraries, sorted_functions end -- local sorted_central_libraries, sorted_functions = activity.sort_central_libraries_functions() -- Select and sort central libraries and functions
function activity.central_functions_report(t) -- Lists actual functions for documentations. local t = t -- t or if (type(t) ~= "string") then t = '\n* activity.central_functions_report(t) : Lists actual functions for documentations' end t = t .. '\n* Selected functions come from: activity.functions_to_doc = ";activity.central_functions_report;events.add_cat;"' t = t .. "\n* The fonctions to document are in bold like activity.central_functions_report" local sorted_central_libraries, sorted_functions = activity.sort_central_libraries_functions() -- Select and sort central libraries and functions local libname, funcname, libname_funcname, asterisk = "", "", "", "" t = t .. viewers.ta("\n* Count of central libraries", lua_table.level_count(sorted_central_libraries) ) local nlibfunc, nallfunc, nlibdoc, nalldoc = 0, 0, 0, 0 local sorted_to_autodoc = {} local UPPER = "" for i, lib in pairs(sorted_central_libraries) do nlibfunc = 0 nlibdoc = 0 lib.libname = (lib.libname or lib.name or "libname") t = t .. "\n* Library " .. libname .. ": " for i, func_record in pairs(sorted_functions) do -- search all functions if func_record.libname == lib.libname then nallfunc = nallfunc + 1 nlibfunc = nlibfunc + 1 libname_funcname = tostring(func_record.libname_funcname) asterisk = "" if string.find(activity.functions_to_doc, libname_funcname, 1, true) then --OK nlibdoc = nlibdoc + 1 nalldoc = nalldoc + 1 if string.lower(libname_funcname) ~= libname_funcname then UPPER = UPPER .. libname_funcname .. ", " end -- funcname with uppercase t = t .. " " .. libname_funcname .. ", " table.insert(sorted_to_autodoc, { ["name"] = name, ["funcname"] = funcname, ["libname_funcname"] = libname_funcname } ) else t = t .. libname_funcname .. ", " end end end table.insert(sorted_functions, { ["name"] = name, ["funcname"] = funcname, ["libname_funcname"] = libname_funcname } ) t = t .. viewers.ta("* Count of functions in this library", nlibfunc) .. viewers.ta("to document", nlibdoc) end table.sort(sorted_functions, function (a, b) return ( (a.libname_funcname < b.libname_funcname ) ) end ) -- Sort libraries t = t .. viewers.ta("\n* Count of functions in all libraries", nallfunc) t = t .. viewers.ta("functions to doc", lua_table.level_count(sorted_to_autodoc) ) t = t .. viewers.ta("functions with doc", nalldoc) t = t .. viewers.ta("\n* Count of sorted functions: ", lua_table.level_count(sorted_functions) ) t = t .. viewers.ta("\n* List of functions with uppercase in funcname: ", UPPER ) activity.sorted_functions = sorted_functions activity.sorted_to_autodoc = sorted_to_autodoc return t end -- function activity.central_functions_report(t)
function activity.central_libraries_autodoc(t, sorted_functions) -- Formats a basic documentation for sorted functions.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* activity.central_libraries_autodoc(t, sorted_functions) : Formats a basic documentation for sorted functions' end
t = t .. "\n*"
local sorted_functions = sorted_functions or activity.sorted_functions
local one_autodoc = "
= = = %1 = = =
"
for i, lib_func in pairs(activity.sorted_to_autodoc) do -- form one_autodoc
t = t .. viewers.form9user(one_autodoc, lib_func.libname_funcname)
end
t = string.gsub(tostring(t), "= = =", "===")
t = string.gsub(tostring(t), "= =", "==")
return t
end -- function activity.central_libraries_autodoc(t, sorted_functions)
activity.report_subtasks_list = { -- List of subtasks to report. See "NOW", -- Begin later below --loadData -- DUPLICATE NOWNOW, in change. toDoc { "---", "---", "---", "---", "---", "DUPLICATE NOW, in change", }, { "20181101", "20181101", "NOW", "Rical", "S181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", }, { "20181101", "20181101", "NOW", "Rical", "S181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", }, { "20181023", "20181030", "NOW", "Rical", "S181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", }, { "20181023", "20181030", "NOW", "Rical", "S181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", }, { "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", }, { "20181018", "20181020", "NOW", "Rical", "S181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", }, { "20181016", "20181017", "NOW", "Rical", "S181016vap", "restore versions.anti_crash(frame) if not pcall() recursive in versions.tree_branch='v1;v2;v3' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_arg has a arg_default in p.known_args and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_data has a data_default in datas.known_datas and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_mode has a mode_default in modes.known_modes and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", }, -- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua { "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", }, { "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", }, { "20181014", "20181014", "NOW", "Rical", "S181014upt", "update activity.phabricator_tasks_report", }, { "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", }, -- -- Automatic shift of below "todo" subtasks. { "---", "---", "---", "---", "---", "Automatic shift of below todo subtasks", }, { "20180108", "20180109", "todo", "Rical", "S180108wtd", "Restore old function datas.wikidata_time_details()", }, { "20180108", "20180109", "todo", "Rical", "S180108blg", "For each wikidata search the better lang in userlang, userlang2, pagelang, contentlang", }, { "20180106", "20180108", "todo", "Rical", "S180106arg", "new Object:args form known arguments to import, complete from datas and finalize", }, { "20171019", "20171022", "todo", "Rical", "S171019ime", "include Lua modules in extensions like Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.lua, see phabtask T41610.", }, { "20171015", "20171018", "todo", "Rical", "S171015trk", "add a method tracker:trk(self, ...) from tracker.add(opt, ...). see Lua_reference_manual#Function_declaration_statements", }, -- { "20171001", "20171002", "todo", "Rical", "S170801cvG", "put MW versions and Central versions in _G and CentralData", }, { "20171001", "20171002", "todo", "Rical", "S170801cCD", "Create Special:PageData/CentralData (change from MW only)", }, { "20171001", "20171002", "todo", "Rical", "S170801cCD", "Create MediaWiki:Scribunto/CentralData (change from admin only)", }, { "20171001", "20171002", "todo", "Rical", "S170801cCD", "Create Central/PageData/CentralData (change from any user)", }, { "20170910", "20170914", "todo", "Rical", "S170910wpw", "Use: wikidata = { property = 'P84',... syntax like Modèle:Wikidata for wikidata", }, -- see 4.2 Paramètre "wikidata" https://fr.wikipedia.org/wiki/Aide:Infobox_en_Lua#Param.C3.A8tre_.22wikidata.22 { "20170910", "20170914", "todo", "Rical", "S170910bob", "Create a button object for boxes, like drop_box with: n, states, shapes, keywords, colors", }, { "20170828", "20170905", "todo", "Rical", "S170828dut", "delete unused tracker in _G : ARGS, IAMO, MAMO, ", }, { "20170828", "20170905", "todo", "Rical", "S170820vtg", "try graphics in viewers.try_graph() -- see Macron", }, { "20170816", "20170823", "todo", "Rical", "S170901adl", "automatize langs.dummy_languages() using isSupportedLanguage(xx)", }, { "20170816", "20170823", "todo", "Rical", "S170901sas", "debug modes.similar_args_search() Test des mots proches similaires", }, { "20170816", "20170823", "todo", "Rical", "S170901mMW", "use Special:PageData CentralData T163923+T168726 in activity.MW_Versions_report()", }, { "20170816", "20170823", "todo", "Rical", "S170729eli", "easy https://en.wikisource.org/wiki/Template:Lorem_ipsum", }, { "20170816", "20170823", "todo", "Rical", "S170728acr", "debug versions.anti_crash() + tests", }, { "20170816", "20170823", "todo", "Rical", "S170801uPD", "automatize PageData change in datas.update_PageData(t) for activity.MW_Versions_report()", }, { "20170811", "20170815", "todo", "Rical", "S170716tac", "langs.abnormal_char_in_text() fails", }, { "20170811", "20170815", "todo", "Rical", "S170615css", "use Conventional css parameters cssview in edit, content, drop_box, infobox, tableview ... ", }, { "20170811", "20170815", "todo", "Rical", "S170720diw", "Enhance datas.get_item() from 20170403 ModuleCentral 6a clean display.lua", }, { "20170811", "20170815", "todo", "Rical", "S170718FLI", "Propose Firstname, Lastname and Initial in wikidata", }, { "20170811", "20170815", "todo", "Rical", "S170718FLI", "lua_table.4_diffs(A, B) Detect 4 first diffs of tables A/B and B/A, in-deep/in-next with limits", }, { "20170811", "20170815", "todo", "Rical", "S170811uMD", "After 'Begin' fully use Module:drop_box from es.wikipedia.org/wiki/Módulo:Lista_plegable", }, -- S170718FLI : in https://www.wikidata.org/wiki/Wikidata:Property_proposal/Person#Noms().", }, -- S170718FLI : T53657 is Close : Firstname and Lastname properties -- S170718FLI : T53657 to re Open : Firstname and Lastname properties. Follow Aklapper comment on Jul 19 2013, 12:51 { "20170810", "20170811", "todo", "Rical", "S180311a2c", "if _i_cat or _u_cat add 2 categories: detailed and ( internal or usage )", }, -- if viewers.is_in("_i_cat", key) then key = "versions_with_internal_error" -- = "Module with internal error", -- elseif viewers.is_in("_u_cat", key) then key = "versions_with_usage_error" -- = "Module with usage error", { "20170810", "20170811", "todo", "Rical", "S180810lts", "continue function lua_table.to_sort(tab, ...) To convert any table in sequence, and sort it.", }, { "20180410", "20180414", "todo", "Rical", "S180410ilp", "After 'Begin' T20180621 Enough inform Central modules for jumps to lang.project URI.", }, { "20180410", "20180414", "todo", "Rical", "S180410alp", "After 'Begin' T20180621 Automatic adapt Central modules for lang.project URI.", }, { "20180407", "20180410", "todo", "Rical", "S180407rlv", "After 'Begin' Fully report modules and libraries versions.", }, { "20180407", "20180409", "todo", "Rical", "S180407ruc", "After 'Begin' report all viewers.usual_color(t)", }, { "20170810", "20170811", "todo", "Rical", "S180306vdf", "debug function versions.deprecated_function() nil table : mask it on 20180306", }, { "20170810", "20170811", "todo", "Rical", "S170617rpd", "debug modes.recursive_normal() test", }, { "20170810", "20170811", "todo", "Rical", "S170614tva", "Use tableview.new() for all tables, search .table_end()", }, -- { "20170810", "20170811", "todo", "Rical", "S170813lll", "debug lua_table.level_list(mw) for all uses", }, -- { "20170808", "20170810", "todo", "Rical", "S170707icc", "Begin: begin to integrate changes from other coders", }, { "20170808", "20170810", "todo", "Rical", "S170707icc", "Begin: update important Phabricator tasks to activate their availability", }, -- Inform after 'Create Begin' { "20170805", "20170807", "todo", "Rical", "S170702cJP", "Begin: Lua-coders Utilisateur:JackPotte JackPotte fr de es en", }, { "20170805", "20170807", "todo", "Rical", "S170702wvm", "Begin: announce Meet coders throught Wikis video meeting France SWEL-fr https://meet.jit.si/swel-fr", }, { "20170805", "20170807", "todo", "Rical", "S170702atr", "Begin: Ask translations in meta Translation_requests", }, { "20170805", "20170807", "todo", "Rical", "S170604iTN", "Begin: inform Tech News about central modules begin phase", }, -- S170604iTN : Tech/News#contribute : central, begin to use, efficiency, ask lua coders ? -- Debug to support Create Begin's group -- Automatic shift of behind "todo" subtasks. -- Begin later behind -- -- NOWNOW DP, NOW, in change { "---", "---", "---", "---", "---", "NOW, in change", }, { "20181101", "20181101", "NOW", "Rical", "S181101tgl", "Begin: translate by groups of languages : like for viet, laos, cambodgia, allways with en, es, fr 1 days", }, { "20181101", "20181101", "NOW", "Rical", "S181101aip", "Begin: when 10 used cases, announce that in the phabtask, then when 20, then for xmas 1 days", }, { "20181023", "20181030", "NOW", "Rical", "S181023s7P", "Begin: search 7 Projects : MediaWikis wikidata wikipedia wikisource wikiquote ? 3 days", }, { "20181023", "20181030", "NOW", "Rical", "S181023iLC", "Begin: Rical invite 7 Lua-coders : Tpt, Zolo, Od1n, Julien1978, Daehan, VIGNERON ? 3 days", }, { "20181020", "20181022", "NOW", "Rical", "S181020umf", "update MediaWiki:Scribunto/Central manual for ;activity.phabricator_tasks_report;activity.rough_date_days;...", }, { "20181018", "20181020", "NOW", "Rical", "S181018CrC", "Module:CentralSchool: finish reciprocal adaptation with Module:Centralizer", }, { "20181016", "20181017", "NOW", "Rical", "S181016vap", "restore versions.anti_crash(frame) if not pcall() recursive in versions.tree_branch='v1;v2;v3' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_arg has a arg_default in p.known_args and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_data has a data_default in datas.known_datas and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_mode has a mode_default in modes.known_modes and a .delete = 'delete' ", }, { "20181015", "20181016", "NOW", "Rical", "S181015odd", "one_version has a version_default in versions.version_args and a .delete = 'delete' ", }, -- function versioning.antiCrash(options, content_or_func, ...) -- Form the display of a running error. in ModuleCentral 20170902.ModuleCentral 2e no antiCrash ok.lua { "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from multiple_selection_test1(...", }, { "20181014", "20181014", "NOW", "Rical", "S181014uft", "update function tab_view.form_one_case + translate from recursive_normal_test1(...", }, { "20181014", "20181014", "NOW", "Rical", "S181014upt", "update activity.phabricator_tasks_report", }, { "20181014", "20181014", "NOW", "Rical", "S181014ust", "Module:Centralizer update subtasks list", }, -- Already done { "---", "~sort~", "---", "---", "---", "Already done", }, { "20180824", "20180825", "done", "Rical", "S180824iCD", "in activity.begin_central_modules_support() header namespace and local links.", }, { "20180730", "20180730", "done", "Rical", "S180730ust", "Module:Centralizer update subtasks list", }, { "20180722", "20180726", "done", "Rical", "S180722sLc", "Update activity.begin_central_modules_support() to begin to search 7 Lua-coders.", }, { "20180715", "20180722", "done", "Rical", "S180715srb", "Update viewers.save_restore_balance_report(t) OK.", }, { "20180708", "20180715", "done", "Rical", "S180708Ric", "Begin: Rical start with Auteur2Tpt ... until 7 Lua-coders, in 7 projects, in 7 Languages.", }, { "20180708", "20180708", "done", "Rical", "S180708ust", "Module:Centralizer update subtasks list", }, { "20180701", "20180714", "done", "Rical", "S180718Ric", "Begin: Rical continue with Auteur2Tpt to enhance translations.", }, { "20180625", "20180625", "done", "Rical", "S180625ALC", "Begin: Ask Lua-coders: Zolo, Zebulon84, Hlm Z., Cantons-de-l'Est, Thibaut120094, Daehan", }, { "20180625", "20180625", "done", "Rical", "S180621new", "For 'Begin' complete translations in Module:Centralizer/I18N.lua.", }, { "20180625", "20180625", "done", "Rical", "S180625btu", "Begin: Create phab task T198107 Begin to use central modules", }, { "20180624", "20180625", "done", "Rical", "S180624cMA", "Begin: for Rical : convert Module:Auteur2 to central, from Tpt", }, { "20170824", "20170825", "done", "Rical", "S170620dcm", "Begin: announce and description in Discussion MediaWiki:Scribunto/Central manual", }, { "20180621", "20180625", "done", "Rical", "S180621new", "For 'Begin' document Module:Centralizer/I18N.lua. Do not really help.", }, { "20180619", "20180619", "done", "Rical", "S180619icm", "For 'Begin' Install the Central-s-fr last version in s-br s-de w-es s-es s-fr s-es w-hu w-vi", }, { "20180619", "20180619", "done", "Rical", "S180619tMI", "For 'Begin' group all translations in Module:Centralizer/I18N.lua", }, { "20170727", "20170612", "done", "Rical", "S171210arg", "Avoid upercase in near all fucntions names", }, { "20170724", "20170610", "done", "Rical", "S180128lit", "Show details link to internal error cat ending _i_cat, _u_cat in events.add_record()", }, { "20180607", "20180608", "done", "Rical", "S180607uts", "After 'Begin' Update all important tasks to support central modules", }, { "20180601", "20180606", "done", "Rical", "S180617upt", "For 'Begin' Update all phabtask in activity.phabricator_tasks_Group{}", }, { "20180601", "20180604", "done", "Rical", "S180617ufc", "For 'Begin' update Central-s-fr functions comments from Central manual.", }, { "20180604", "20180604", "done", "Rical", "S180604crm", "For 'Begin' T20180604 Update Central modules reference manual. DONE", }, { "20180518", "20180518", "done", "Rical", "S180518ust", "Module:Centralizer update subtasks list", }, { "20180421", "20180421", "done", "Rical", "S180421CGL", "For 'Begin' renew CentralGuideline from CentralModules and CentralManual", }, { "20180419", "20180420", "done", "Rical", "S180419aCv", "add Central version in running_times", }, { "20180414", "20180414", "done", "Rical", "S180414ust", "Module:Centralizer update subtasks list", }, { "20180413", "20180416", "done", "Rical", "S180413uia", "Update modes.get_args()=args_known +source +template +import +... with priorities", }, { "---", "---", "---", "---", "---", "STOP the display of this table", }, { "20170729", "20170729", "done", "STOP", STOP = "STOP", }, -- STOP the display of this table { "20180329", "20180407", "done", "Rical", "S180329uma", "For 'Begin' Update ModuleAuthor3.lua.", }, { "20180322", "20180323", "done", "Rical", "S180322crm", "For 'Begin' Update Stability in Central modules reference manual", }, { "20180307", "20180326", "done", "Rical", "S180307clr", "For 'Begin' debug function activity.central_functions_report look OK", }, } -- return activity.report_subtasks_list --end -- activity.report_subtasks_list = { -- List of subtasks to monitor.
-- See tasks in activity.phabricator_tasks_report() and sub-tasks in activity.central_subtasks_report(t) function activity.central_subtasks_report(t) -- Reports the current state of subtasks defined by Lua-coders. See "NOW", local memo = viewers.save_configs("activity.central_subtasks_report") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* activity.central_subtasks_report(t) : Reports the current state of subtasks defined by Lua-coders' end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = activity.report_subtasks_list, -- List of subtasks to monitor. title_memo = "activity_report_subtasks_title", -- "activity.central_subtasks_report(t) Report the current state of subtasks, See "NOW".", headers = " start; end; state; user; sub id; bug description; duration ", form_one_case = function(bug, tab_view) -- Convert a case from test_group to rowGroup. bug.start = bug.start or bug[1] or 0 if type(bug.start) ~= "number" then bug.start = 0 end -- Display one row whole in bold. bug.stop = bug.stop or bug[2] or 0 if type(bug.stop) ~= "number" then bug.stop = 0 end -- Display one row whole in bold. bug.duration = bug.stop - bug.start bug.plan = bug.plan or bug[3] or "---" if type(bug.start) ~= "number" then bug.start = 0 end -- Display one row whole in bold. if bug.plan == "NOW" then -- Display one row whole in bold. bug.start = "" .. tonumber(bug.start) .. "" bug.stop = "" .. tonumber(bug.stop) .. "" bug.duration = "" .. tonumber(bug.duration) .. "" bug.plan = "" .. tostring(bug.plan) .. "" bug[4] = "" .. tostring(bug[4]) .. "" bug[5] = "" .. tostring(bug[5]) .. "" bug[6] = "" .. tostring(bug[6]) .. "" end return { bug.start, bug.stop, bug.duration, bug.plan, bug[4], bug[5], bug[6], } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "activity.central_subtasks_report") -- Restore global configurations after eventual changes. return t end -- t = function activity.central_subtasks_report(t) -- Report the current state of subtasks, See "NOW".
activity.phabricator_tasks_Group = { -- toDoc --[[ comments and new Pabtask 09/08/2019 T231521: Test page and result : https://fr.wikisource.org/wiki/Mod%C3%A8le:MdTests/documentation t = t .. "\n* How to well report a task like in viewers.phab_task('T149532#2878699', 'that task') :" t = t .. "\n* 1) What happens in brief 2) Type of activity 3) What is the problem" t = t .. "\n* 4) Dedicated test case without ambiguity. " t = t .. "\n* 5) Expected outcome 6) Proposed solution" t = t .. "\n* 7) Where and when to use the proposed solution" t = t .. "\n* 8) Who would benefit + your name. 9) Current status of the discussion" t = t .. "\n* 10) Links 11) Your name linked to your MediaWiki URL, or profile elsewhere on the internet" --]] -- Importance: Important { 102, "Important", "20190829", "T231521", 0, "Triage", "The global word -frame- is very probably not global and stops the development of the Module:Centralizer", }, -- T231521 : title : The global word "frame" is very probably not global and stops the development of the Module:Centralizer -- T231521 : The background is that the Module:Centralizer, which I develop, supports any tree of versatile sub-modules and that it must in all cases simply access the main module and its name. -- T231521 : * On the basis of a dedicated test of 10 lines, it seems certain that the global name "frame" ... is not global. -- T231521 : The problem is that then the Module:Centralizer can not access the main module and its name. -- T231521 : * You can watch the test and its result [here] https://en.wikisource.org/wiki/Model:MdTests/documentation -- T231521 : Of course, to continue my development normally, I need an effective "framework". -- T231521 : * To debug, I suggest looking in the mediawiki changes. -- T231521 : According to the dates of my debugs, the most likely ones seem to be: -- T231521 : versid = "1.34.0-wmf.19 (efab97f)", seen_time = "2019-08-23T07 -- T231521 : * I hope that the return to normal operation will allow me to continue my development soon. -- T231521 : * When the Module:Centralizer will be effective, I will share it with many advanced Lua coders and I will help them convert and improve more and more modules. -- T231521 : This benefits technically to them and me (Rical). But mainly to all Wikipedia readers in all languages. This only requires the translation of a hundred short sentences in each language. { 102, "Important", "20180412", "T185557", 0, "Open", "Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')", }, { 106, "Important", "20170703", "T20170703", 0, "ToCreate", "Standardize content, page and user langages availability", }, -- T20170703 : Rename T68051 : "Central modules need the user language to display errors and category names" -- T20170703 : Standardize content, page and user langages availability -- T20170703 : Content, page and user langages are not available nor defined in the same ways for scribunto modules. -- T20170703 : That complicate modules which use them. Similar ways could enhance efficiency and reduce the development tasks. { 110, "Important", "20170325", "T20170325", 0, "ToCreate", "Centralize and share central datas about central modules", }, -- T20170325 : Centralize datas as MediaWiki versions installations in each lang-project, uses of central modules (helpers, projects, languages ...). { 114, "Important", "20180626", "T135845", 0, "Assigned", "Convert any module as central or centralisable", }, -- T135845 : Central modules must be really multi wikis. -- T135845 : For this goal they need to join a standard template with the central module. -- T135845 : But the MediaWiki security prohibit them in Lua modules. Then the deployment must do these. { 116, "Important", "20160822", "T53660", 0, "Open", "Detect the edit state for modules which help users and helpers", }, { 118, "Important", "20180806", "T4085", 0, "Open", "Add a fr/Modèle:USERLANG magic word", }, { 118, "Important", "20181005", "T173207", 0, "Open", "Implement Lua alternative to ⧼Lang⧽ / wgUserLanguage", }, { 119, "Important", "20180710", "T107119", 0, "Open", "Provide a Lua method mw.loadTemplateData()", }, -- See PageData { 120, "Important", "20170713", "T163923", 0, "Resolved", "Create Special:PageData as a canonical entry point for machine readable page data.", }, -- T163923: Permit at modules to change PageData (for stat, modules versions, mw versions...). { 122, "Important", "20170727", "T149532", 0, "Resolved", "Why Multi-Content-Revisions? Use cases and requirements.", }, { 124, "Important", "20180817", "T168726", 0, "Open", "Create syntax documentation page for Special:PageData.", }, { 126, "Important", "20170907", "T68051", 1, "Open", "Central modules need the user language to display errors and category names", }, { 132, "Important", "20180603", "T85461", 0, "Resolved", "Lua error: too many language codes requested", }, -- T85461 https://meta.wikimedia.org/wiki/Module:Assemble_multilingual_message -- T85461 https://meta.wikimedia.org/w/index.php?title=Module:Assemble_multilingual_message&action=edit#mw-ce-l46 { 134, "Important", "20170309", "T159322", 0, "Open", "Central categories and alerts for central modules", }, -- T159322 : Does the community agree to implement central categories and alerts for central modules? -- T159322 : This enhances the efficiency of the detection and the correction of errors, in some ways: { 136, "Important", "20160522", "T85419", 0, "Open", "User groups should be exposed to Scribunto", }, -- T85419: to adapt errors and warning for administrators or modules coders { 138, "Important", "20180413", "T142093", 0, "Open", "Decide how to do usage tracking for strings_c used to lookup entities (page titles, external ids, …)", }, { 140, "Important", "20170211", "T20170211", 1, "ToCreate", "In mw.language.fetchLanguageNames( 'fr' ) some languages names are not in French", }, -- T20161220 : ToDo: test: local getContentLanguage = mw.language.getContentLanguage().code -- default content_lang { 146, "Important", "20170921", "T176362", 0, "Declined", "Implement ClassNameTests in Scribunto to enhance central modules stability", }, -- T176362 : phabtask : Implement getTestProvider in Scribunto to enhance central modules stability -- T176362 : phabtask : proposed functions in MediaWiki: -- T176362 : phabtask : mw.getTestProvider(mw_tests, nmaxi) -- To initialise, to limit all tests in time and to limit cases to nmaxi. -- T176362 : phabtask : mw.ClassNameCase(case, n), used inside mw.getTestProvider() to run each test case of number 1 to nmaxi. -- T176362 : phabtask : The case object contains fields: count, OK="OK"..., n, name, type, args{}, expect{}, NameTest{}, func(), provide(), run() { 148, "Important", "20170121", "T122752", 1, "Open", "#invoke do not record the main module in package.loaded", }, -- T122752: 20161202 18:25 See example https://fr.wikisource.org/wiki/Module:Phab.TestpackG : detect "in " "_G" or package.loaded -- T122752: 20160102 22:46 See example https://fr.wikisource.org/wiki/Module:TestRequire -- T122752: To locate and to debug the bug T122752 in time, Rical lists here the versions of fr.wikisource.org/wiki/Module:ControlArgs1 -- T122752: Oldest research of "Replace the missing of record of the module by" : ModuleControlArgs 6 tools...lua 2016-01-16 -- T122752: (actu | diff) 2015-11-25T11:43:11 Rical (discussion | contributions | bloquer) . . (261 314 octets) (-3 519) . . (The versions management seems OK) (annuler) -- T122752: (actu | diff) 2015-11-28T09:55:37 Rical (discussion | contributions | bloquer) . . (267 472 octets) (+5 809) . . (find_main_module) -- T122752: (actu | diff) 2015-12-01T14:18:22 Rical (discussion | contributions | bloquer) . . (268 956 octets) (+1 614) . . (find_main_module OK ?) -- T122752: (actu | diff) 2016-01-18T02:09:45 Rical (discussion | contributions | bloquer) . . (319 599 octets) (+10 183) . . (translate library.i18n first) -- T122752: 2016-01-02 phabricator: T122752 Rical created this task. Sat, Jan 2, 2016-01-02 23:08 { 156, "Important", "20180508", "T63958", 0, "Assigned", "Use existing $dateFormats to format dates on Wikidata", }, { 160, "Important", "20170521", "T67687", 0, "Resolved", "mw.load_data can be used to pass data between #invoke's by reading frame arguments", }, -- -- Importance: Central { 202, "Central", "20180701", "T198107", 0, "Open", "Begin to use central modules in 7 wikis S180625btu", }, { 206, "Central", "20171106", "T20171106", 0, "ToCreate", "Lua-coders could better report bugs with recent MediaWiki versions for each wiki", }, { 210, "Central", "20181002", "T121470", 0, "Open", "Central Global Repository for Templates, Lua modules, and Gadgets", }, { 214, "Central", "20180718", "T52329", 0, "Stalled", "We need a common repository for Scribunto modules and templates", }, { 218, "Central", "20180312", "T41610", 0, "Open", "Scribunto should support global module invocations", }, -- T41610: subscriber: kaldari 2017-05-20, 16:03 -- T41610: You can include Lua modules in extensions and then register them with Scribunto as global modules. -- T41610: Wikibase, for example, includes 2 Lua modules: -- T41610: Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.entity.lua -- T41610: Wikibase/client/includes/DataAccess/Scribunto/mw.wikibase.lua { 224, "Central", "20170301", "T20170301", 0, "ToCreate", "Phabricator tasks states for easier versions management of modules", }, -- datas to get for each query: Task number, title, state, priority, Authored By and date, Last event date, number of subscribers, Assigned. { 228, "Central", "20170225", "T20170225", 0, "ToCreate", "? Report MediaWiki changes for the versions management, and use {{subst:}}", }, -- T20170225: The gerrit team needs the date of a bug and the dates of mw install in each wiki to debug mw. -- T20170225: We could detect, record and report all date-time changes of MediaWiki, for some weeks. -- T20170225: We could use {{subst:}} in 2 ways. See https://www.MediaWiki.org/wiki/Manual:Substitution -- T20170225: duplicate of T121470: Central Global Repository for Templates, Lua modules, and Gadgets. { 230, "Central", "20170314", "T1238", 0, "Close", "Central Code Repository for code used on wikis (Templates, Lua modules, Gadgets)", }, -- -- Importance: Other { 302, "Other", "20180320", "T147618", 0, "Open", "Localize one or more major WMF software products related to new editor retention to hu.wikipedia", }, { 304, "Other", "20180320", "T132308", 0, "Open", "Internationalise citoid dates", }, { 306, "Other", "20180320", "T142906", 1, "Close", "Data access in user language doesn't obey the uselang get parameter", }, { 308, "Other", "20180106", "T104109", 0, "Close", "No syntax highlight for large JavaScript/CSS/Lua/API pages", }, { 310, "Other", "20170427", "T162877", 0, "Close", "CodeEditor default changed if you have never used the toggle", }, { 312, "Other", "20170427", "T161875", 0, "Close", "CodeEditor is always enabled when starting an edit on a page containing code", }, -- T161875: Actual: It is enabled, though mw.user.options.get('usecodeeditor') correctly gives 0. { 314, "Other", "20180412", "T85412", 0, "Open", "The formatPropertyValues needs an option to format data from date-time, angle or geographic coordinates", }, { 316, "Other", "20170912", "T156048", 0, "Open", "Add syntax highlighting to wiki diff of source code pages (like Gerrit)", }, { 318, "Other", "20180710", "T107119", 0, "Open", "Provide a Lua method mw.loadTemplateData()", }, { 320, "Other", "20170524", "T166202", 0, "Open", "Strings defined as long comments give a Lua modules syntax error", }, -- -- Other, ToCreate or not { 321, "Other", "20170213", "T20170213", 0, "ToCreate", "Some languages have not French names in French language", }, { 322, "Other", "20151215", "T20151215", 0, "ToCreate", "In some cases the box of the drop_box is not displayed", }, -- T20151215: .. "\n------ " -- This code interact with drop_box and debug the task T20151215 2016-11-13 17:57.
-- T20151215: if there is "\n------ " before editDocBox and then the editDocBox{ 326, "Other", "20160616", "T20160616", 0, "ToCreate", "? Add module and library types in scribunto ?", }, -- T20160616: get.is_library = ( true ) -- true if the object is a library { 328, "Other", "20171007", "T155624", 0, "Open", "Special:Version not showing SHA info for MediaWiki version on fr.wikisource", }, -- UTC-20170407-20:21 : reported in T155624 Special:Version not showing SHA info for MediaWiki version on fr.wikisource -- -- Importance: Obsolete: Do not create, these functions come from mw... libraries. { 428, "Obsolete", "20161022", "T20161022", 0, "ToCreate", "? Scribunto functions are out of package.loaded", }, -- T20161022: -- Found in Lua_reference_manual but not in Module:Centralizer-s-fr : -- T20161022: -- 2016-10-22 15:45 : versions.all_G_and_loaded_list() : Variables in _G global space without libraries and modules in packageloaded. , -- xpcall = function , tostring = function , _VERSION = Lua 5.1 , unpack = function , require = function , pairs = function , next = function , -- assert = function , ipairs = function , rawequal = function , getmetatable = function , rawset = function , pcall = function , type = function , -- selector = function , rawget = function , tonumber = function , error = function , setmetatable = function { 430, "Obsolete", "20170324", "T133498", 1, "Declined", "Detect and extend known title <-> entity links in a semi-automatic way", }, { 432, "Obsolete", "20161128", "T151715", 0, "Invalid", 'string.gsub( s, "%%1", repl) fails as "invalid capture index"', }, { 434, "Obsolete", "20170110", "T154769", 0, "Invalid", 'When "Erreur Lua : attempt to call a string value", where?', }, -- T154769: Rical 2017-01-08 My main mistake was to write xpcall() where pcall() is right. -- T154769: Tests are there https://fr.wikisource.org/wiki/Module:Phab.T154769.Test -- T154769: versions.anti_crash() preserve pages against residual errors which can crash pages. { 436, "Obsolete", "20170202", "T155898", 0, "Invalid", "Preview change from external local editors", }, -- T155898: OK, I will continue to search in JEdit plugins. Perhaps I will ask them an adapted solution. { 438, "Obsolete", "20160424", "T67507", 0, "Resolved", "It should be possible to get entity id from page title", }, { 440, "Obsolete", "20160524", "T119978", 0, "Invalid", "Get name and record-time of all modules to better manage their versions", }, { 442, "Obsolete", "20160813", "T75460", 0, "Resolved", "[Story] Make Lua functions default to the user's language on multilingual wikis", }, } -- activity.phabricator_tasks_Group = {...}
function activity.phabricator_tasks_report(t, short) -- Reports the Phabricator tasks linked with central modules.
local memo = viewers.save_configs("activity.phabricator_tasks_report") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* activity.phabricator_tasks_report(t, short) : Reports the Phabricator tasks linked with central modules' end
t = t .. "\n* How to well report a task like in viewers.phab_task('T149532#2878699', 'that task') :"
t = t .. "\n* 1) What happens in brief 2) Type of activity 3) What is the problem"
t = t .. "\n* 4) Dedicated test case without ambiguity. "
t = t .. "\n* 5) Expected outcome 6) Proposed solution"
t = t .. "\n* 7) Where and when to use the proposed solution"
t = t .. "\n* 8) Who would benefit + your name. 9) Current status of the discussion"
t = t .. "\n* 10) Links 11) Your name linked to your MediaWiki URL, or profile elsewhere on the internet"
local mwtitle = mw.title.getCurrentTitle()
local tasks_Group = activity.phabricator_tasks_Group
local sort_importance = "Obsolete;Other;Important;Central"
local split_importance = mw.text.split(sort_importance, ';') -- table of words
local sort_import, split_n, split_import = {}, 1, "Open"
for i, task in pairs(tasks_Group) do
task.iii = tostring(task[1]) ; task.importance = tostring(task[2])
task.lastdate = tostring(task[3]) ; task.phab = tostring(task[4])
task.detect = tostring(task[5]) ; task.status = tostring(task[6])
task.title = tostring(task[7]) ; task.shortext = tostring(task[8])
task.sort = "s"
for split_n, split_import in pairs(split_importance) do
if task.importance == split_import then -- to sort on importance then lastdate
task.sort = task.sort .. split_n .. task.lastdate .. task.phab
end
end
table.insert(sort_import, task)
end
table.sort(sort_import, function (a, b) return ( a.sort > b.sort ) end ) -- to sort on importance then lastdate
table.sort(sort_import, function (a, b) return ( a.lastdate > b.lastdate ) end ) -- to sort on importance then lastdate
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = sort_import, -- = sorted activity.phabricator_tasks_Group,
title_memo = "activity_phabricator_tasks_title", -- "activity.phabricator_tasks_report() Monitor states of known phabricator tasks",
headers = "Importance; modified on; Task; Status; Title",
headers = "activity_phabricator_tasks_headers", -- "Importance; modified on; Task; Status; Title"
form_one_case = function(task) -- Convert a task from test_group to rowGroup.
task.phab = viewers.phab_task(task.phab, task.phab)
local usual = "discreet"
if viewers.is_in(task.status, "ToCreate, Declined, Invalid, Triage") then usual = "discreet"
elseif viewers.is_in(task.status, "Open, Assigned, Gerrit") then usual = "normal"
elseif viewers.is_in(task.status, "Resolved") then usual = "invoke"
else usual = "discreet" end -- All states : ToCreate, Open, Stalled, Assigned, Resolved, Declined, Invalid, Gerrit
task.title = viewers.usual_color(task.title, usual)
if task.detect == 1 then task.title = task.title .. " - ( detected state )" end
-- headers = "Importance; modified on; Task; Status; Title" -- "Importance, modifiée le, Tâche, Etat, Titre"
local importance = task.importance .. viewers.styles_color_discreet(" on " .. task.lastdate)
return { importance , task.phab, task.status, task.title, } -- task.sort, task.shortext }
end, -- function tab_view.form_one_case(task)
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
Used colors: "
.. viewers.ta("ToCreate, Declined, Invalid", viewers.usual_color("task to create or activate", "discreet") )
.. viewers.ta("Open, Assigned, Gerrit", viewers.usual_color("task in way to Resolved", "normal") )
.. viewers.ta("Resolved", viewers.usual_color("task already Resolved", "invoke") )
.. viewers.ta("Other", viewers.usual_color("other tasks or track objects", "discreet") )
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "activity.phabricator_tasks_report") -- Restore global configurations after eventual changes.
return t
end -- function activity.phabricator_tasks_report(t, short)
function activity.rough_delay_timestamps(stamp1, stamp2) -- Rough delay between two time stamps, like 31. local delay, years, months, days = 0, 0, 0, 0 if (type(stamp1) ~= "string") or (type(stamp2) ~= "string") then return delay end local y1 = tonumber(string.sub(stamp1,1,4)) local y2 = tonumber(string.sub(stamp2,1,4)) if y1 and y2 then years = y2 - y1 end local m1 = tonumber(string.sub(stamp1,5,6)) local m2 = tonumber(string.sub(stamp2,5,6)) if m1 and m2 then months = m2 - m1 end local d1 = tonumber(string.sub(stamp1,7,8)) local d2 = tonumber(string.sub(stamp2,7,8)) if d1 and d2 then days = d2 - d1 end delay = years * 365 + months * 30 + days return delay end
function activity.rough_date_days(stamp1) -- Rough date days of a time stamp, like 736447. local date_days, years, months, days = 0, 0, 0, 0 if (type(stamp1) ~= "string") then return delay end local y1 = tonumber(string.sub(stamp1,1,4)) or 2001 local m1 = tonumber(string.sub(stamp1,5,6)) or 1 local d1 = tonumber(string.sub(stamp1,7,8)) or 1 years = y1 * 365 months = m1 * 30 days = d1 date_days = years + months + days return date_days, y1, m1, d1, years, months, days end
function activity.rough_days_timestamp(date_days) -- Rough time stamp from date days, like "20170806". local timestamp = "no timestamp" if (type(date_days) ~= "number") then return timestamp end local year = math.floor(date_days / 365) local day = date_days - (year * 365) local month = math.floor(day / 30) local day = day - (month * 30) local yyyy = string.sub( ("0000" .. tostring(year) ), -4, -1) local mm = string.sub( ("0000" .. tostring(month) ), -2, -1) local dd = string.sub( ("0000" .. tostring(day) ), -2, -1) timestamp = yyyy .. mm .. dd return timestamp end p.infos = { -- Basis of the descrition of the main and the subs versions, from 20171224 infos p.["infos"]["versions"]["libname"] ['versionFrom'] = "MdCentral function modes.levenshtein_similar_tests == OK OK.lua", ['versionName'] = "Centralizer", ['versionNumber'] = "1.0.0(2019-12-30T21:32)", ['versionDate'] = "2019-12-30T21:32", -- UTC version structure MWMW 2019-03-02T09:28:00 }
activity.MediaWiki_Versions = activity.MediaWiki_Versions or {} -- for future use
function activity.MW_Versions_report(t) -- Reports versions of MediaWiki for 3 months. MWMW local memo = viewers.save_configs("activity.MW_Versions_report") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* activity.MW_Versions_report(t) : Reports versions of MediaWiki for 3 months' end -- t = t .. activity.MediaWiki_Versions_code(versions.MediaWiki_Versions, ">") -- First on begin, Last on end -- t = t .. activity.MediaWiki_Versions_code(versions.MediaWiki_Versions, "<") -- First on end, Last on begin table.sort(activity.MediaWiki_Versions, function (a, b) return (a["verstime"] > b["verstime"]) end ) -- -- version.seen_time = p.infos['versionDate']
-- t = t .. activity.MediaWiki_Versions_code(versions.MediaWiki_Versions, ">") -- First on begin, Last on end
-- t = t .. activity.MediaWiki_Versions_code(versions.MediaWiki_Versions, "<") -- First on end, Last on begin
table.sort(activity.MediaWiki_Versions, function (a, b) return (a["verstime"] > b["verstime"]) end ) --
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "activity_MW_Versions_report_title", -- "activity.MW_Versions_report() Monitor MediaWiki versions.",
test_group = versions.MediaWiki_Versions,
headers = " verstime; versid; site; seen_time ",
form_one_case = function(version, all_cases) -- Convert a case from test_group to rowGroup.
local example = { site = "fr.wikisource", verstime = "2017-12-15T23:35:09", versid = "1.31.0-wmf.16 (a31d45c)",
seen_time = "2018-01-12T07:43:00",
task = "T155624", title = "In wikisource/Spécial:Version:wmf.15 (0953700) but Central module mw = 1.31.0-wmf.16 (a31d45c) seen by Rical.",
}
if version.task then version.versid = version.versid .. "
" .. viewers.phab_task(version.task, version.task) end
if version.title then version.seen_time = version.seen_time .. "
" .. version.title end
return { version.site, version.verstime, version.versid, version.seen_time, }
-- function versions.detect_MediaWiki_changes() display only 3 last months
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
-- from MediaWiki 1.30.0-wmf.4 (3248a17) 22:41, 7 June 2017
-- See ISO 8601 time format like : 1977-04-22T01:00:00-05:00 (5 heures de décalage) = 1977-04-22T06:00:00Z local time
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
t = t .. "\n* Counts of MW_Versions_report: "
t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) )
local list, count_done, level, split = lua_table.level_list(tab_view.rowGroup, "string", "MediaWiki", 3)
local list, count_now, level, split = lua_table.level_list(tab_view.rowGroup, "string", "wikisource", 3) -- function lua_table.level_list(
local list, count_later, level, split = lua_table.level_list(tab_view.rowGroup, "string", "2017-08", 1) -- subtasks S170813lll
t = t .. viewers.ta("MW_Versions MediaWiki count_done", count_done) .. viewers.ta("MW_Versions wikisource count_now", count_now) .. viewers.ta("MW_Versions 2017-08 count_later", count_later)
-- Counts of selected and sorted sub-tasks: , #test_group = 52 , #rowGroup = 0
-- { "20170529", "20170530", "done", "Rical", "S170530mwv", "versions.MediaWiki_Versions in Module:MediaWikiVersions for activity.MW_Versions_report()", },
viewers.restore_configs(memo, "activity.MW_Versions_report") -- Restore global configurations after eventual changes.
return t
end -- t = activity.MW_Versions_report(t)
function activity.MediaWiki_Versions_code(MediaWiki_Versions, sort) -- Re_form the Lua code of versions.MediaWiki_Versions{}.
local MediaWiki_Versions = MediaWiki_Versions or versions.MediaWiki_Versions
if (type(MediaWiki_Versions) ~= "table") then MediaWiki_Versions = {} end
local MediaWiki_Versions_example = { -- Example only
{ site = "fr.wikisource", verstime = "2017-05-11T00:48:00", versid = "1.29.0-wmf.21 (d6c07d1)", seen_time = "2017-05-11T00:48:00-00:00",
task = "T165000", title = "The version date of MW 1.29.0-wmf.21 (d6c07d1) is in the future !",
report = "Rical: Schedule in https://www.MediaWiki.org/wiki/MediaWiki_1.29/Roadmap", },
}
-- alphabetic sort vesions on verstime
local sort = sort
if (type(sort) ~= "string") then sort = activity.MediaWiki_Versions_sort end
if sort == ">" then table.sort(MediaWiki_Versions, function (a, b) return (a["verstime"] > b["verstime"]) end ) end -- First on begin, Last on end
if sort == "<" then table.sort(MediaWiki_Versions, function (a, b) return (a["verstime"] < b["verstime"]) end ) end -- First on end, Last on begin
local code = '\n* activity.MediaWiki_Versions_sort = "' .. sort .. '"'
code = code .. "\n* versions.MediaWiki_Versions = {"
for i, version in ipairs(MediaWiki_Versions) do
-- See ISO 8601 time format like : 1977-04-22T01:00:00-05:00 (5 heures de décalage) = 1977-04-22T06:00:00Z local time
code = code .. '
{ site = "' .. version.site
code = code .. '", verstime = "' .. version.verstime
code = code .. '", versid = "' .. version.versid
code = code .. '", seen_time = "' .. version.seen_time
if (type(version.task) == "string") then code = code .. '", task = "' .. version.task end
if (type(version.title) == "string") then code = code .. '", title = "' .. version.title end
if (type(version.report) == "string") then code = code .. '", report = "' .. version.report end
code = code .. '", },' -- end of line
end
code = code .. "
}
"
return code
end -- t = t .. activity.MediaWiki_Versions_code(MediaWiki_Versions, sort)
function activity.extract_MW_Versions() -- Extract MediaWiki versions from the page. local memo = viewers.save_configs("activity.extract_MW_Versions") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* activity.MW_Versions_report(t) : Reports versions of MediaWiki for 3 months' end local actual_title = mw.title.getCurrentTitle() -- Returns the title object for the current page. local actual_content = actual_title:getContent() -- Returns the (unparsed) content of the page, or nil if there is no page. The page will be recorded as a transclusion. local i = string.find(actual_content, "Central Normal mode example") if i then t = t .. "\n* " .. string.sub(actual_content, i, i + 222) end viewers.restore_configs(memo, "activity.extract_MW_Versions") -- Restore global configurations after eventual changes. return t end -- t = activity.extract_MW_Versions() -- Extract MediaWiki versions from the page.
function central_library.binded_in(object, name) -- Detects if the object is binded in _G space or in package.loaded. local binded_in = "xx" if _G[name] == object then binded_in = "_G" end if package.loaded[name] == object then binded_in = "LD" end return binded_in -- 20161202 18:25 See example https://fr.wikisource.org/wiki/Module:Phab.TestpackG : detect "in " "_G" or package.loaded end -- binded_in = central_library.binded_in(object, name)
function central_library.new(name, library, options) -- Installs a library in package.loaded. The new library must be a Lua table. -- Installs only a table as a new library. -- RunOnce : Do not repeat this function to not disturb subsequent processes. -- A Sribunto library can be a table, a string or a function, not a nil. -- Modules can only install libraries in tables. options = options or {} options.err = "" options.name = options.name or name options.library = options.library or library if (type(options.library) == "table") then options.library.libname = options.name elseif (type(options.library) ~= "table") then options.err = "library~=table" return library end if (type(options.name) ~= "string") then return options.library end local object = library local php = nil function object.setupInterface(options) -- Remove setup function if options.library then options.library.setupInterface = nil end -- Copy the PHP callbacks to a local variable, and remove the global php = mw_interface mw_interface = nil -- Do any other setup here -- Install into the mw global mw = mw or {} mw.ext = mw.ext or {} mw.ext[options.name] = options.library -- Indicate that we're loaded package.loaded[options.name] = options.library options.err = "" end object = object.setupInterface(options) central_library.i18n_libraries_list = central_library.i18n_libraries_list or {} -- Build a list of central libraries central_library.i18n_libraries_list[options.name] = object options.binded_in = central_library.binded_in(object, options.name) return package.loaded[options.name], options.err end -- return object, err = function central_library.new(name, library, options)
-- cut_libraries
-- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - --------------------------------- -- The Library:datas imports datas of Wikidata from mw.wikibase -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - ---------------------------------
-- datas = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
datas.i18n = {} -- Translations for datas library
datas.i18n.br = {
-- Pour traduire, les langues de référence sont l'anglais et le français.
-- Pour traduire, ne traduisez pas des parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
-- Wikidata
datas_Wikidata_header = "Données : ",
datas_known_Datas_header = "Données connues : ",
datas_sougth_Datas_header = "Données souhaitées : ",
datas_needed_Datas_header = "Données nécessaires : ",
datas_Wikidata_wikibase_err = "Erreur : Wikibase n'est pas disponible.",
datas_Wikidata_getEntity_err = "Erreur : getEntity Wikidata n'est pas disponible.",
datas_Wikidata_getEntityObject_err = "Erreur : L'élément %1 de Wikidata n'est pas trouvé.",
datas_Wikidata_property_err = "Erreur : La propriété %1 de Wikidata n'est pas trouvée.",
datas_Wikidata_error_err = "Erreur Wikidata : %1 ",
-- datas_Wikidata_cat_err = "modes_no_source_arguments_cat",
datas_Wikidata_cat_err = "Module with internal error", -- modes_no_source_arguments_cat
datas_structured_data_txt = 'Données de Wikidata',
datas_Wikidata_any_page_title = "Wikidata pour une autre page :",
datas_Wikidata_details_test_title = "Tests et données importées de Wikidata",
datas_Wikidata_arbitrary_tests_title = "datas.get_item() Test de Wikidata accès arbitraire",
datas_Wikidata_arbitrary_access_text = "Wikidata pour un titre : ",
datas_Wikidata_time_details_title = "datas.Wikidata_time_details{} Wikidata propriétés de temps pour plus de détails",
datas_update_Special_PageData_title = "datas.update_PageData() Partager des DATA entre modules en Special:PageData",
datas_update_Special_PageData_header = "site; temps de version; identificateur de version; heure de vue",
datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
-- Messages et erreurs divers
datas_no_args_Wikidata_err = "Erreur interne : Module sans table d'arguments Wikidata.",
datas_sources_of_datas = "Informations de : /Wikidata, /modèle ou module, /autres, /warning, /erreur",
} -- datas.i18n.br
datas.i18n.de = {
-- Zum Übersetzen sind die Referenzsprachen Englisch und Französisch.
-- Übersetze keine Teile wie diese: %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
datas_Wikidata_header = "Daten: ",
datas_known_Datas_header = "Bekannte Daten: ",
datas_sougth_Datas_header = "Gewünschte Daten: ",
datas_needed_Datas_header = "Daten benötigt: ",
datas_Wikidata_wikibase_err = "Fehler: Wikibase ist nicht verfügbar.",
datas_Wikidata_getEntity_err = "Fehler: getEntity Wikidata ist nicht verfügbar.",
datas_Wikidata_getEntityObject_err = "Fehler: Der Eintrag %1 von Wikidata wurde nicht gefunden.",
datas_Wikidata_property_err = "Fehler: Die Wikidata %1 Eigenschaft wurde nicht gefunden.",
datas_Wikidata_error_err = "Wikidata-Fehler: %1 ",
-- datas_Wikidata_cat_err = "modes_no_source_arguments_cat",
datas_Wikidata_cat_err = "Modul mit internem Fehler", -- modes_no_source_arguments_cat
datas_structured_data_txt = 'Wikidata daten',
datas_Wikidata_any_page_title = "Wikidata für eine andere Seite:",
datas_Wikidata_details_test_title = "Tests und Daten, die aus Wikidata importiert wurden",
datas_Wikidata_arbitrary_tests_title = "datas.get_item() Wikidata Test beliebiger Zugriff",
datas_Wikidata_arbitrary_access_text = "Wikidata für einen Titel: ",
datas_Wikidata_time_details_title = "datas.Wikidata_time_details{} Wikidata Zeiteigenschaften für weitere Details",
datas_update_Special_PageData_title = "datas.update_PageData() Partager des DATA entre modules en Special:PageData",
datas_update_Special_PageData_header = "Ort; Versionszeit; Versionskennung; Stunde der Sicht",
datas_get_item_report_title = "datas.get_item_report() Gibt mw.wikibase-Daten für die Seite oder einen anderen Artikel aus.",
-- Verschiedene Nachrichten und Fehler
datas_no_args_Wikidata_err = "Interner Fehler: Modul ohne Wikidata-Argumenttabelle.",
datas_sources_of_datas = "Informationen von: / Wikidata, / Modell oder Modul, / andere, / Warnung, / Fehler",
} -- datas.i18n.de
datas.i18n.en = {
-- To translate, referral languages are English and French.
-- To translate, do not translate parts like these: %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
args_known_country = "England", -- English
args_known_flag = "Flag_of_England.svg", -- English
args_known_monument = "St_Pauls_aerial_%28cropped%29.jpg", -- English St Paul's Cathedral
args_known_town = "London", -- English
datas_Wikidata_header = "Datas: ",
datas_known_Datas_header = "Known datas: ",
datas_sougth_Datas_header = "Sougth datas: ",
datas_needed_Datas_header = "Needed datas: ",
datas_Wikidata_wikibase_err = "Error: Wikibase is not available.",
datas_Wikidata_getEntity_err = "Error: getEntity Wikidata is not available.",
datas_Wikidata_getEntityObject_err = "Error: Element Wikidata %1 is not found.",
datas_Wikidata_property_err = "Error: Wikidata property %1 is not found.",
datas_Wikidata_error_err = "Error Wikidata: %1 ",
-- datas_Wikidata_cat_err = "Error Wikidata",
datas_Wikidata_cat_err = "Module with internal error", -- modes_no_source_arguments_cat
datas_structured_data_txt = 'Datas from Wikidata',
datas_Wikidata_any_page_title = "Wikidata for any page:",
datas_Wikidata_details_test_title = "Tests and imported datas from Wikidata",
datas_Wikidata_arbitrary_tests_title = "datas.get_item() Test of Wikidata arbitrary access",
datas_Wikidata_arbitrary_access_text = "Wikidata for Title: ",
datas_Wikidata_time_details_title = "datas.Wikidata_time_details{} Wikidata time properties for more details",
datas_update_Special_PageData_title = "datas.update_PageData() Share DATAS between modules in Special:PageData",
datas_update_Special_PageData_header = "site; version time; version identifier; seen hour",
datas_get_item_report_title = "datas.get_item_report() Reports datas from mw.wikibase for the page or any other item.",
-- Miscellaneous warnings and errors
datas_no_args_Wikidata_err = "Error: Module without Wikidata arguments table.",
datas_sources_of_datas = "Informations from: /Wikidata, /template or module, /other, /warning, /error",
} -- datas.i18n.en
datas.i18n.es = {
-- Para traducir, los idiomas de referencia son inglés y francés.
-- Para traducir, no traduzca partes como estas: %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
-- Wikidata
args_known_country = "España", -- Spanish
args_known_flag = "Flag_of_Spain.svg", -- Flag of Spain
args_known_monument = "MADRID_100206_UDCI_023.jpg", -- Puerta del Sol
args_known_town = "Madrid", -- Capital city
datas_Wikidata_header = "Datos: ",
datas_known_Datas_header = "Datos conocidas: ",
datas_sougth_Datas_header = "Datos deseados: ",
datas_needed_Datas_header = "Datos necesarios: ",
datas_Wikidata_wikibase_err = "Error: Wikibase no está disponible.",
datas_Wikidata_getEntity_err = "Error: getEntity Wikidata no está disponible.",
datas_Wikidata_getEntityObject_err = "Error: Elemento %1 de Wikidata no se encuentra.",
datas_Wikidata_property_err = "Error: La propiedad %1 de Wikidata no se encuentra.",
datas_Wikidata_error_err = "Error Wikidata : %1 ",
datas_Wikidata_cat_err = "Módulo con error interno", -- modes_no_source_arguments_cat
datas_structured_data_txt = 'Datos de Wikidata',
datas_Wikidata_any_page_title = "Wikidata para cualquier página:",
datas_Wikidata_details_test_title = "Pruebas y datos importados de Wikidata",
datas_Wikidata_arbitrary_tests_title = "datas.get_item() Prueba de Wikidata acceso arbitrario",
datas_Wikidata_arbitrary_access_text = "Wikidata por título: ",
datas_Wikidata_time_details_title = "datas.Wikidata_time_details{} Wikidata propiedades de tiempo para más detalles",
datas_update_Special_PageData_title = "datas.update_PageData() Compartir DATOS entre módulos en Special:PageData",
datas_update_Special_PageData_header = "sitio; tiempo de versión; identificador de versión; tiempo visto",
datas_get_item_report_title = "datas.get_item_report() Informes de datos de mw.wikibase para la página o cualquier otro elemento.",
-- Diversos mensajes y errores
datas_no_args_Wikidata_err = "Error: Módulo sin argumentos Wikidata tabla.",
datas_sources_of_datas = "Informaciones de: /Wikidata, /template o module, /other, /warning, /error",
} -- datas.i18n.es
datas.i18n.fr = {
-- Pour traduire, les langues de référence sont l'anglais et le français.
-- Pour traduire, ne traduisez pas des parties comme celles-ci : %1 ; %1 = %2 (%3) ; Q535
;
; \n* ; _G.
-- Wikidata
args_known_country = "France", -- French
args_known_flag = "Flag_of_France.svg.png", -- French
args_known_monument = "Tour Eiffel", -- French
args_known_town = "Paris", -- French
datas_Wikidata_header = "Données : ",
datas_known_Datas_header = "Données connues : ",
datas_sougth_Datas_header = "Données souhaitées : ",
datas_needed_Datas_header = "Données nécessaires : ",
datas_Wikidata_wikibase_err = "Erreur : Wikibase n'est pas disponible.",
datas_Wikidata_getEntity_err = "Erreur : getEntity Wikidata n'est pas disponible.",
datas_Wikidata_getEntityObject_err = "Erreur : L'élément %1 de Wikidata n'est pas trouvé.",
datas_Wikidata_property_err = "Erreur : La propriété %1 de Wikidata n'est pas trouvée.",
datas_Wikidata_error_err = "Erreur Wikidata : %1 ",
-- datas_Wikidata_cat_err = "modes_no_source_arguments_cat",
datas_Wikidata_cat_err = "Module with internal error", -- modes_no_source_arguments_cat
datas_structured_data_txt = 'Données de Wikidata',
datas_Wikidata_any_page_title = "Wikidata pour une autre page :",
datas_Wikidata_details_test_title = "Tests et données importées de Wikidata",
datas_Wikidata_arbitrary_tests_title = "datas.get_item() Test de Wikidata accès arbitraire",
datas_Wikidata_arbitrary_access_text = "Wikidata pour un titre : ",
datas_Wikidata_time_details_title = "datas.Wikidata_time_details{} Wikidata propriétés de temps pour plus de détails",
datas_update_Special_PageData_title = "datas.update_PageData() Partager des DATA entre modules en Special:PageData",
datas_update_Special_PageData_header = "site; temps de version; identificateur de version; heure de vue",
datas_get_item_report_title = "datas.get_item_report() Rapporte les données de mw.wikibase pour la page ou tout autre élément.",
-- Messages et erreurs divers
datas_no_args_Wikidata_err = "Erreur interne : Module sans table d'arguments Wikidata.",
datas_sources_of_datas = "Informations de : /Wikidata, /modèle ou module, /autres, /warning, /erreur",
} -- datas.i18n.fr
function datas.available_props_report(t) -- Reports available datas properties local memo = viewers.save_configs("datas.available_props_report") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* datas.available_props_report(t) : Reports available datas properties' end local i = 0 -- t = t .. "\n* Guideline for this stat : Count lists of translations by languages and libraries, then convert in a 2D table, then format and report them." local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...} for key, argmt in pairs(args_known) do -- For all known parameters if type(argmt.prop) == "string" then i = i + 1 ; t = t .. viewers.ta(argmt.keyword, argmt.prop) end end t = t .. viewers.ta("\n* Count of available datas properties: ", tostring(i) ) viewers.restore_configs(memo, "datas.available_props_report") -- Restore global configurations after eventual changes. return t end -- t = t .. datas.available_props_report(t) -- Reports available datas properties viewers.drop( -- res = res .. viewers.drop(selector, "datas.available_props_report(t) Reports availables datas properties **", datas.available_props_report)
function datas.getDateFromTimeStatement(statement, field) local struct = { year = nil, century = nil, text = nil, precision = 0 } local snak = statement.mainsnak if snak.snaktype == 'novalue' then return struct end if snak.snaktype == 'somevalue' then struct.text = '??' return struct end struct = parseWbTime(snak.datavalue.value) local prefix = if struct.precision == 8 then prefix = 'vers ' end --Extract circa if statement.qualifiers ~= nil and statement.qualifiers.P1480 ~= nil then for _,qualifier in pairs(statement.qualifiers.P1480) do if qualifier.datavalue.value.id == 'Q5727902' then prefix = 'circa ' struct.precision = 8 --TODO: hacky end end end --Use before and after if precision <= century if statement.qualifiers ~= nil and struct.precision <= 7 then if statement.qualifiers.P1319 ~= nil then for _,qualifier in pairs(statement.qualifiers.P1319) do struct = parseWbTime(qualifier.datavalue.value) prefix = 'après ' struct.precision = 8 --TODO: hacky end elseif statement.qualifiers.P1326 ~= nil then for _,qualifier in pairs(statement.qualifiers.P1326) do struct = parseWbTime(qualifier.datavalue.value) prefix = 'avant ' struct.precision = 8 --TODO: hacky end elseif statement.qualifiers.P1317 ~= nil then for _,qualifier in pairs(statement.qualifiers.P1317) do struct = parseWbTime(qualifier.datavalue.value) prefix = 'floruit ' struct.precision = 8 --TODO: hacky end end end --Create text if struct.precision >= 9 then struct.text = prefix .. getTextForYear(struct.year) elseif struct.precision == 8 then struct.text = prefix .. getTextForYear(struct.year) elseif struct.precision == 7 then struct.text = prefix .. getTextForCentury(struct.century, true) else struct.text = errorMessage('La date de ' .. field .. ' a une précision trop faible sur Wikidata') end return struct end
datas.track_val = datas.track_val or "" function datas.tv(line, prop, what, val) -- track a property in datas.get_item datas.track_val = datas.track_val or "" -- birthyear=P569 if prop == "P569" then local line = "L" .. tostring(line) local prop = tostring(prop) local what = tostring(what) local val = tostring(val) datas.track_val = datas.track_val .. viewers.ta(line .. "-" .. prop .. ":" .. what, val) end return datas.track_val end -- datas.track_val = datas.tv(line, prop, what, val)
function datas.get_uri(prop, better, lang) -- Get props.uri for the page. local mwuri, uri = mw.uri.new(), "-" -- Server mw.uri.new for path like = /wiki/Utilisateur:Rical/Nelson_Mandela local sub_parts = mw.text.split(mwuri.path, '/') ; for k, part in pairs(sub_parts) do uri = part end -- last text after / uri = string.gsub(uri, "_", " ") ; return uri end
function datas.get_image(prop, QITEM, lang) -- T185557 Gets the sought image name for the page, or some others for galeries. -- see phabtask T185557 Authored By Rical on 20180123 : Create the easy function mw.wikibase.property('P21', 'Q8023', 'en') if type(prop) ~= "string" then prop = "P18" end if (prop == "image") then prop = "P18" end local image = image or datas.props.image or datas.props.P18 or "Victor Hugo.jpg" or (datas.get_uri() .. ".jpg") return image -- image = image or prop or "Victor Hugo.jpg" -- end
function datas.property(argmt) -- Get datas from mwwikibase for one property of the page. argmt = mw.clone(argmt) -- avoid any interaction with other properties. datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42" local QITEM = datas.QITEM or datas.default_item or "Q34743" -- Rudyard Kipling datas.item = mw.wikibase.getEntity(QITEM) local loc = {} local label = nil local val = nil if argmt.prop then -- Admit any type of keyword and prop. argmt.keyword = argmt.keyword or argmt.key or argmt.prop argmt.prop = argmt.prop -- Get datas from mwwikibase for one property of the page. if argmt.prop == "QITEM" then val = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42" elseif argmt.prop == "label" then val = datas.item:getLabel(QITEM) ; label = label or val -- use props.label Returns a string, like "Berlin" with 'de' elseif argmt.prop == "sitelink" then val = datas.item:getSitelink() -- use props.sitelink like Author:Aristotel elseif argmt.prop == "labelwithlang" then val = mw.wikibase.entity:getLabelWithLang() -- use props.labelwithlang -- Returns a string like "Berlin" and a language like elseif argmt.prop == "description" then val = mw.wikibase.description(QITEM) -- use props.description -- ric : Description of the QITEM page elseif argmt.prop == "labelcontent" then val = mw.wikibase.getLabelByLang(QITEM, langs.content_lang) ; label = label or val -- Returns the content_lang label of the item elseif argmt.prop == "labelpage" then val = mw.wikibase.getLabelByLang(QITEM, langs.page_lang) ; label = label or val -- Returns the page_lang label of the item elseif argmt.prop == "labeluser" then val = mw.wikibase.getLabelByLang(QITEM, langs.user_lang or "en") ; label = label or val -- Returns the user_lang label of the item else -- ric (p.box_read) loc.formatPropertyValues = datas.item:formatPropertyValues( argmt.prop ) -- like "P123" -- Returns a table like: { value = "Formatted claim value", label = "Label of the Property" } if loc.wd_RANK_TRUTH then loc.formatPropertyValues = datas.item:formatPropertyValues( argmt, { loc.wd_RANK_TRUTH } ) end if loc.wd_claimRanks then loc.formatPropertyValues = datas.item:formatPropertyValues( argmt, { loc.wd_claimRanks } ) end val = loc.formatPropertyValues.value end val = tostring(val) if argmt.format == "year" then val = mw.ustring.sub( val, -4, -1 ) end val = tostring(val) argmt.val = val end --function modes.get_args( argmt.label = label or argmt.label or argmt.labeluser or argmt.labelcontent or argmt.labelpage or argmt.labelbylang argmt = mw.clone(argmt) -- avoid any interaction with other properties. return argmt end -- argmt = datas.property(argmt) -- Get datas from mwwikibase for one property of the page.
function datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page. -- from 2016-08-16 ModuleCentral 3a lua_table.to_list.lua local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...} local t = "\n* datas.get_item(args_known, QITEM): Get datas from mw.wikibase for the page." local Title, Label, prop, lang, description, val, label, adr, proplabel local QITEM = QITEM or mw.wikibase.getEntityIdForCurrentPage() or datas.default_item or kipling datas.QITEM = QITEM datas.item = mw.wikibase.getEntity(datas.QITEM or "Q34743") -- Rudyard Kipling local props = {} -- All properties form args_known with argmt.prop. local prop = {} -- to collect properties local loc = {} -- local values for key, argmt in pairs(args_known) do -- For all known parameters if type(argmt) == "table" then argmt.key = key argmt.syn = argmt.syn or 0 argmt = datas.property(argmt) -- Get datas from mwwikibase for one property of the page. function datas.property( if argmt.keyword == "QITEM" then argmt.val = QITEM end if argmt.prop then -- Admit any type of keyword and prop. props[argmt.keyword] = mw.clone(argmt) prop[argmt.keyword] = argmt.val -- ric (p.box_read) end end end prop.countall = tostring( lua_table.level_count(prop) ) props.countall = tostring( lua_table.level_count(props) ) datas.props = props datas.prop = prop return prop, props end -- local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
function datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase for the page ** local memo = viewers.save_configs("datas.get_item_report") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* datas.get_item_report(t) : datas.get_item() Report datas from mw.wikibase for the page' end local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- } local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page. ric local countprops = tostring( lua_table.level_count(props) ) -- do not follow one_prop structure local countallprops = tostring( lua_table.level_count(props) ) -- do not follow one_prop structure t = t .. viewers.ta("\n* countprops", countprops) .. viewers.ta("\n* countallprops", countallprops) local sortprops = {} -- to sort properties in alphabetic order for key, val in pairs(props) do -- from list all fond datas -- t = t .. "\n* get_item: " .. viewers.ta("key", key) .. viewers.ta("val", val) table.insert(sortprops, props[key]) end table.sort(sortprops, function (a, b) return ( tostring(a.keyword or a.prop) < tostring(b.keyword or b.prop)) end ) -- alphabetic sort of properties local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = sortprops, -- Use default cases. title_memo = "datas_get_item_report_title", form_one_case = function(case) -- Convert a case from test_group to rowGroup. return { case.key, case.val, case.typ, case.need, case.keyword, case.syn, case.prop, case.format, } end, headers = "key; val; typ; need; keyword; syn; prop; format", headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) t = t .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) ) t = t .. "\n* datas.get_item_report(t): end" viewers.restore_configs(memo, "datas.get_item_report") -- Restore global configurations after eventual changes. return t end -- local t = datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase for the page **
function datas.prot(prop) -- form a string to show a prop value datas.props = datas.props or {} local prop = prop if type(prop) ~= "string"then prop = "prop" end local t = prop if type(prop) == "string" and not string.find(prop, "%s", 1, true) then t = datas.props[prop] or prop end return t end
function datas.PageData_to_table(datext) -- Convert a PageData in JSON to a table. return "To do later : datas.PageData_to_table(datext) -- Convert a PageData in JSON to a table." end -- local tab = datas.PageData_to_table(datext)
function datas.table_to_PageData(tab) -- Convert a table to JSON for PageData. return datext end -- local datext = datas.table_to_PageData(tab)
function datas.update_PageData(t, datext) -- Try to share INFOS between a group of modules in Module:Main.infos local memo = viewers.save_configs("datas.update_PageData") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* datas.update_PageData(t, datext) : Try to share INFOS between a group of modules in Module:Main.infos' end local tab = datas.PageData_to_table(datext) local datext = datas.table_to_PageData(tab) local Help_Tabular_DataExample = [=[{ "license": "CC0-1.0", "description": { "en": "Some good fruits for you", "es": "Algunas buenas frutas para ti" }, "sources": "http://example.com and Data page", "schema": { "fields": [ { "name": "id", "type": "string", "title": { "en": "Fruit ID", "fr": "ID de fruit" }}, { "name": "count", "type": "number", "title": { "en": "Count" }}, { "name": "liked", "type": "boolean", "title": { "en": "Do I like it?" }}, { "name": "description", "type": "localized", "title": { "en": "Fruit name", "fr": "Nom du fruit" }} ] }, "data": [ [ "peaches", 100, true, { "en": "Magnificent but a bit artificial sweet peaches", "es": "esto puede estar en español", "fr": "this could be in french" } ], ] }]=] local lua_content = mw.text.jsonDecode(Help_Tabular_DataExample) local json_content = mw.text.jsonEncode(lua_content) local table_to_code = activity.wikis_names --[[ see activity.wikis_names ["b"] = "wikibooks", ["cm"] = "commons", ["meta"] = "meta", ["mw"] = "MediaWiki", ["n"] = "wikinews", ["p"] = "wiki", ["q"] = "wikiquote", ["s"] = "wikisource", ["species"] = "species", ["t"] = "wiktionary", ["test"] = "test", ["test2"] = "test2", ["v"] = "wikiversity", ["w"] = "wikipedia", ["wm"] = "wikimedia", ["y"] = "wikivoyage", } -- activity.wikis_names --]] local table_json = mw.text.jsonEncode(table_to_code) local table_lua = mw.text.jsonDecode(table_json) local final_table = {} for key, val in pairs(table_lua) do final_table[key] = val end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = final_table, -- Use default cases. title_memo = "datas_update_Special_PageData_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)", headers = "key;val", form_one_case = function(case) -- Convert a case from test_group to rowGroup. return { case.key, case.val } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. t = t .. viewers.ta("#test_group", lua_table.level_count(tab_view.test_group) ) t = t .. viewers.ta("#rowGroup", lua_table.level_count(tab_view.rowGroup) ) viewers.restore_configs(memo, "datas.update_PageData") -- Restore global configurations after eventual changes. return t end -- function datas.update_PageData(t)
function datas.load_data(t, datext) -- Pass data between #invoke's local T67687 = "phabtask : mw.load_data can be used to pass data between #invoke's by reading frame arguments" if false then -- Create the following as Module:LoadData: function p.main(frame) return mw.load_data('Module:LoadData/data')[1] end end if false then -- Create the following as Module:LoadData/data: return { mw.getCurrentFrame().args[1] } end if false then end end -- function datas.load_data(t, datext) -- Pass data between #invoke's
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:events supports events of types erros, warnings and categories. -- viewers.save_configs("events.save_configs" memo, tab_view, group ) -- Init a new events group -- events.add_err(key, ... ) -- Add an error in the actual table of events. -- events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events. -- events.form(evt) -- Format events types -- events.all_categories_test(t) -- test categories -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - ---------------------------------
-- events = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loadedS
events.i18n = {} -- Translations for Library:events events.i18n.br = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.br events.i18n.en = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "categ_Test test : classes in some languages", events_all_kinds_tests_title = "events.all_kinds_test() Test: all kinds of events (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_close_without_memo_err = "viewers.restore_configs(memo, where) without memo in module %1.", events_antiCrash_protect_err = "The antiCrash() function protects this page against a complete crash due to an internal error: %1.", } -- events.i18n.en events.i18n.es = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Prueba categ_Test: clases en algunos lenguajes", events_all_kinds_tests_title = "events.all_kinds_test() Prueba: todo tipo de eventos (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "Función obsoleto en módulo principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sin memo en el módulo %1.", events_antiCrash_protect_err = "La función antiCrash() protege esta página contra un colapso completo debido a un error interna: %1.", } -- events.i18n.es events.i18n.fr = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.fr events.i18n.hu = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.hu events.i18n.vi = { events_test_tests_title = "List a table, test with limits:", events_test_resTest_title = "List a table, test with limits:", events_test_projects_title = "Test and display tests events for projects", events_test_projects_headers = "Type;Key;Name test and values;result of the test", events_test_MediaWiki_title = "Test and display tests events for MediaWiki", events_test_MediaWiki_headers = "Type;Key;Name test and values;result of the test", events_test_categ_Test_title = "Tester categ_Test : catégories dans quelques langues", events_all_kinds_tests_title = "events.all_kinds_test() Test: toutes les sortes d'événements (err, wng, cat)", events_all_kinds_tests_headers = "typ;key;idargs;result", events_add_cat_deprecated = "Fonction obsolète dans le module principal.", events_close_without_memo_err = "viewers.restore_configs(memo, where) sans memo dans le module %1.", events_antiCrash_protect_err = "La fonction antiCrash() protège cette page contre un effondrement complet dû à une erreur interne : %1.", } -- events.i18n.vi
events.test_group = {} events.rowGroup = {} events.tab_view = {} events.tab_view.test_group = {} events.tab_view.rowGroup = {}
function events.add_cat(key, ... ) -- Add a category in the actual table of events. return events.add_record("cat", key, ...) -- Add a error, warning or category in the lists. S170626rev end
function events.add_err(key, ... ) -- Add an error in the actual table of events. return events.add_record("err", key, ...) -- Add a error, warning or category in the lists. S170626rev end
function events.add_wng(key, ... ) -- Add a warning in the actual table of events. return events.add_record("wng", key, ...) -- Add a error, warning or category in the lists. S170626rev end
function events.form_cat(evt, txt, lnk, c, space) local space = space or (mw.site.namespaces.Category.name .. ":") local c = c or evt.ccc or ":" if evt.typ == "cat" then -- Format a category to display or activate evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) ) evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) ) evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) ) return " " .. (evt.user_wkt or txt) .. " " else return "" end end
events.list_all_events = {} -- Table to collect all events types "err", "wng" and "cat".
function events.new(typ, key, ...) -- Initialize and finalize a new event. local evt = {} -- default event if type(typ) == "table" then evt = typ -- Use a predefined event else -- To finalize an existing event. evt.typ = typ evt.key = key end -- Finalize all events evt.typ = evt.typ or typ -- Type of event: err, wng, cat evt.key = evt.key or key -- Translation key, simple or extended by name if type(typ) ~= "string" then typ = "notyp" end -- To debug abnormal type of event if type(key) ~= "string" then key = "nokey" end -- To debug abnormal translation key evt.name = evt.typ or evt.key or "name" -- Translation key, simple or extended by name evt.vals = evt.vals or { ... } -- table of arguments values evt.catview = evt.catview or ":" -- Default value for eventual use -- Check, yes or no, to form an event, in special cases if (evt.typ == "cat") then evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later elseif (evt.typ == "err") then evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later elseif (evt.typ == "wng") then evt.res, evt = events.form( evt ) -- Formats the resulting wikitext, can be re-form later end return evt end -- function events.new(typ, key, ...)
function events.add_new(evt) -- Add a error, warning or category in the lists. S170626rev -- Select only new events if type(evt) ~= "table" then evt = {} end local new_evt = viewers.form9tests( tostring(evt.key), lua_table.to_list( evt.vals ) ) for i, event in pairs(events.list_all_events) do local old_evt = viewers.form9tests( tostring(event.key), lua_table.to_list( event.vals ) ) if new_evt == old_evt then new_evt = nil ; break end -- Add only new events. Reject already seen events. end -- events.add_wng("modes_auto_val_warning_wng", langs.user_translations[key], val) -- form_result if new_evt then table.insert(events.list_all_events, evt) end return evt end -- function events.add_new(typ, ref, ...)
function events.add_record(typ, key, ... ) -- Add a new error, warning or category in a list. -- Guide line: all events are in a single table, including categories, without duplication. -- Guide line: without duplication: events differ if the type, the key or any value of any argument differs. -- Guide line: We can view or categorize categories local typ, key = typ, key local evt = events.new(typ, key, ...) -- Initialize and finalize a new event. local evt = events.add_new(evt) -- Add an error, warning or category in the lists. S170626rev local res, evt = events.form(evt, c) -- Format an event as an error, warning or category. return res, evt end -- local res, evt = events.add_record(typ, key, ... )
function events.form(evt, c) -- Format an event as an error, warning or category. evt.res = tostring(evt.res) .. "? form " .. viewers.form9tests(".form evt.key=%1, evt.res=%2, ", evt.key, evt.res ) local evt = mw.clone(evt) -- do not disturb input event if type(evt) ~= "table" then evt.res = lua_table.rough_view(evt) return evt.res, evt end if (evt.typ ~= "cat") and (evt.typ ~= "wng") and (evt.typ ~= "err") then evt.res = lua_table.rough_view(evt) return evt.res, evt end evt.tableStyle = evt.tableStyle or "" -- Could change the style of the wikitext. Not available on 20160916 if type(evt.name) ~= "string" then evt.name = "" elseif evt.name ~= "" then evt.name = evt.name .. "_" end evt.idargs = evt.name .. tostring( viewers.form9user( tostring(evt.key), lua_table.to_list( evt.vals ) ) ) -- Each type of event formats its own type of wikitext evt.content_wkt = viewers.form9content(evt.key, lua_table.to_list( evt.vals ) ) evt.page_wkt = viewers.form9page(evt.key, lua_table.to_list( evt.vals ) ) evt.user_wkt = viewers.form9user(evt.key, lua_table.to_list( evt.vals ) ) evt.res = "" -- multilingual if evt.typ == "err" then evt.res = viewers.styles_color_error(evt.user_wkt) end if evt.typ == "wng" then evt.res = viewers.styles_color_warning(evt.user_wkt) end evt.ccc = c or evt.catview or events.catview or ":" evt.content_catspace = mw.site.namespaces.Category.name -- name: Local namespace name. if evt.typ == "cat" then -- Format a category to display or activate evt.res = events.form_cat(evt) if viewers.is_in("_i_cat", key) then -- If needed, add a second "Category:Module with internal error" res = res .. events.add_cat("versions_with_internal_error") end if viewers.is_in("_u_cat", key) then -- If needed, add a second "Category:Module with user error" res = res .. events.add_cat("versions_with_user_error") end end return evt.res, evt end -- function events.form(evt, c)
events.all_kinds_test_test_group = { { "abc", "langs_form9user_all_types_values", { "pi = ", "circle / diameter", 3.14, }, }, { "equation", "langs_form9user_all_types_values", { 11, 7, 3.14, }, }, { "Matrix:", "langs_form9user_all_types_values", { "2.1.0", "v4-6, ISO_8601, FC14 h6", }, }, { "pi = ", "langs_form9user_all_types_values", { "circle / diameter", 3.14, }, }, { "quadrature", "langs_form9user_all_types_values", { function() end, "convert a square to a circle", }, }, } -- langs_form9user_all_types_values = "Test: string=%1 number=%2 nil=%3 function=%4 table=%5.", function events.all_kinds_test(t) -- Test: all kinds of events (err, wng, cat) local memo = viewers.save_configs("events.all_kinds_test") -- Save global configuration before eventual changes. events.all_kinds_trck = "\n* events.all_kinds_trck: " local t = t -- t or if (type(t) ~= "string") then t = '\n* events.all_kinds_test(t) : Test: all kinds of events (err, wng, cat)' end t = t .. events.all_kinds_trck local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "events.all_kinds_test(t)", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)", test_group = events.all_kinds_test_test_group, -- Use default cases. headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result", form_one_case = function(evt) -- Convert a case from test_group to rowGroup. return { evt.typ or "t", evt.key or "k", evt.idargs or "i", evt.res or "r" } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. t = t .. viewers.ta("end #test_group *2", lua_table.level_count(tab_view.test_group) ) -- function tableview.new( nil bug170602 t = t .. viewers.ta("end #rowGroup *2", lua_table.level_count(tab_view.rowGroup) ) -- function tableview.new( nil bug170602 t = t .. events.all_kinds_trck viewers.restore_configs(memo, "events.all_kinds_test") -- Restore global configurations after eventual changes. return t end -- function events.all_kinds_test(t)
function events.add_cat_group(groupCat, groupList) -- Add some categories in the actual table of events. Separated by ";". -- catGroup("Country %1", "France,Italia") -> if type(groupCat) ~= "string" then groupCat = "%1" end if type(groupList) ~= "string" then return "" end local cats = "" for i, str in mw.text.gsplit(groupList, ";", true) do local wkt = viewers.form9user(groupCat, str) cats = cats .. events.add_cat(groupCat, wkt) end local res, evt = events.add("catGroup", groupCat, cats) -- Add an event to a group. evt.trc = evt.trc .. viewers.form9user("\n* add_cat evt.typ=%1, evt.key=%2, ", evt.typ, evt.key) return res, evt end -- function events.add_cat_group(groupCat, groupList)
function events.select_typ(typ) -- Select events by one type local is = {} for i, evt in pairs(events.test_group) do if evt.typ == typ then table.insert( is, evt.idargs ) end end return is end
function events.sort_typ() -- Sort events by type in wng, err, cat. local wng, err, cat = {}, {}, {} for i, evt in pairs(events.test_group) do if evt.typ == "wng" then table.insert( wng, evt ) end if evt.typ == "err" then table.insert( err, evt ) end if evt.typ == "cat" then table.insert( cat, evt ) end end return wng, err, cat end -- function events.sort_typ()
function events.selector( tab_view, evt ) if type(evt) ~= "table" then evt = { -- options for tableview.new() -- Formats a table with lines and columns. headers = "typ;key;selector-name;wkt", style = "", typ = "err", rowGroup = {}, } else evt.headers = evt.headers or "typ;key;else-name;wkt" evt.tableStyle = evt.tableStyle or "" evt.name = evt.name or "_" evt.typ = evt.typ or "nil" end if (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == evt.typ) then table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } ) elseif (type(tab_view) == "table") and (type(tab_view.typ) == "string") and (tab_view.typ == "v") then table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } ) else tab_view = {} table.insert( tab_view.test_group, { evt.typ, evt.key, evt.name, evt.wkt } ) end end -- function events.selector( tab_view, evt )
function events.all_kinds_test_test(t) -- Test: all kinds of events (err, wng, cat) local memo = viewers.save_configs("events.all_categories_test") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* events.all_kinds_test_test(t) : Test: all kinds of events (err, wng, cat)' end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = nil, -- Use default cases. title_memo = "events_all_kinds_tests_title", -- "events.all_kinds_test() Test: all kinds of events (err, wng, cat)" headers = "events_all_kinds_tests_headers", -- "typ;key;idargs;result" form_one_case = function(evt) -- Convert a case from test_group to rowGroup. return { evt.typ, evt.key, evt.idargs, evt.res } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Form a table view with lines and columns. viewers.restore_configs(memo, "events.all_kinds_test_test") -- Restore global configurations after eventual changes. return t --, errors -- langs_missing_translations_title end -- function events.all_kinds_test_test(t)
events.errors_list = {} -- Deprecated: Table to collect errors and warnings events.erron = true -- Activated or not errors. Errores activado o no. Erreurs activées ou non. events.categories_list = {} -- Table to collect all categories to generate in wikitext
function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
local res, msgref = "", ""
local mwtitle = mw.title.getCurrentTitle()
local page = tostring(mwtitle.nsText) .. ":" .. tostring(mwtitle.text)
if type(title) ~= "string" then title = "modes_error_list_header_err" end
res = res .. '\n*' .. viewers.form9user(title, page, v1, v2, v3, v4, v5, v6, v7, v8, v9) -- .. ' - ' .. page
local n = 0
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "wng" then
res = res .. '
⦁ ' .. viewers.styles_color_warning(msgref)
end
end
for k, wng in ipairs(events.errors_list) do
msgref = viewers.form9user(wng.ref, wng.v1, wng.v2, wng.v3, wng.v4, wng.v5, wng.v6, wng.v7, wng.v8, wng.v9) -- texte traduit ou direct
if wng.typ == "err" then
res = res .. '
⦁ ' .. viewers.styles_color_error(msgref)
n = n + 1
end
end
if n > 0 then
events.add_cat("versions_module_with_error_err")
end
return res
end -- function events.errors_lister(title, v1, v2, v3, v4, v5, v6, v7, v8, v9)
function events.gener_categories(args_known) -- Only for this library, form categories without activate them local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- } if type(args_known) ~= "table" then args_known = modes.args_known end if args_known.birthyear then events.add_cat("birthyear_descr", args_known.birthyear) end if args_known.deathyear then events.add_cat("deathyear_descr", args_known.deathyear) end -- description_descr = "Author's description, to clarify whether the automatic description does not fit.", if args_known.description then events.add_cat("description_descr", args_known.description) end return end -- better categories module name main_version name 8399
function events.categories_lister(c) -- Categorize categories, or view categories if c=":". local res = "" modes.options_to_cat_view() -- c can replace cat_view to enforce the documentation or the categorisation c = c or modes.cat_view or "" for k, evt in pairs(events.list_all_events) do if (evt.typ == "cat") then local keyuser = viewers.form9user(evt.key) local keycontent = viewers.form9content(evt.key) res = res .. events.form_cat(evt, keyuser, keycontent, c) end end return res end -- function events.categories_lister(c)
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:langs supports i18n translations. -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- The Module:Centralizer/I18N translations for langs library update and complete Module:Centralizer translations.
langs.i18n = {} -- Translations for Library:langs
langs.i18n.br = {
language = 'langue',
langs_translations_counts_title = "langs.translations_counts() Comptages des traductions en tables",
langs_translations_stats_report_title = "Traductions: nombres par langues et par librairies ou modules.",
langs_translations_stats_report_headers = "En-têtes calculés",
langs_form9user_tests_title = "viewers.form9user() Test: Remplacer %1 à %9 par tostring( argN ) à partir des arguments",
langs_form9user_all_types_values = "Résultats de test: string=%1 number=%2 nil=%3 function=%4 table=%5.",
langs_form99user_tests_title = "viewers.form99user() Test: Remplacer %01 à %99 par tostring( argN ) à partir des arguments",
langs_form99user_all_types_values = "en viewers.form99user() Valeurs de tous types : %1, %2, %3, %4, %5.",
langs_translations_key_missing = "Erreur interne: Clé de traduction manquante ou anormale dans viewers.trans9vars()",
langs_form99user_no_tranlation = "en viewers.form99user() Manque de traduction.",
langs_form99user_a_value_is_table = "en viewers.form99user() Une valeur est une table.",
langs_lang_not_exist_err = "Erreur : La langue %1 n'est pas disponible.",
langs_abnormal_char_in_text_title = "langs.abnormal_char_in_text() Test: Détecter les caractères anormaux dans un texte unilingue.",
langs_abnormal_char_in_alphabet = "abcdefghabklmnopqrstuvwxyz ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 àéèêëiouüœ ÀÉÈÊËIOUÜŒ ,;.:!?",
langs_list_MediaWiki_languages_title = "langs.list_MediaWiki_languages() Liste de toutes les langues de MediaWiki.",
-- Principaux textes, erreurs et catégories des outils
langs_first_tests_languages = "Documentation des premières langues",
langs_content_page_user_lang_msg = "Langues : content: %1, page: %2, user: %3.",
langs_without_translation_err = "Argument connu, mais non traduit : %1.",
langs_without_translation_N_err = "Il y a %1 arguments non traduits.",
langs_main_i18n_languages_count = "Ce module peut traduire %1 phrases en %2 langues : ",
langs_table_can_translate_counts = "La table %1 peut traduire %2 phrases en %3 langues.",
langs_mw_language_fetchLanguageName = "%1(%2=%3), ",
langs_counts_translations_headers = "*; Nom de la table; Textes; Tables; Commentaire",
langs_i18n_list_all_string = "Cette liste montre tous les textes, mais ne peut remplacer les déclarations originales.",
langs_languages_nbr_and_list = "\n* Il y a %1 tables de traductions dans ces langues : %2
",
langs_string_translated_in_langs = "Il y a %1 textes traduits en %2 langues.",
langs_no_wiki_translations_err = "Erreur interne : Module sans table d'arguments traduits.",
langs_list_in_translated_lang = "%1 traductions en langage %2 : %3 : %4",
langs_changing_translations_title = "langs.changing_translations() Changements de traduction dans les tables i18n",
langs_changing_translations_headers = "Module; Langue; Clé i18n; Traduction précédente; Traduction changeante",
langs_missing_translations_title = "langs.missing_translations() Traductions manquantes dans les tables i18n.",
langs_missing_translations_headers = "Langue; clé i18n; Traduction précédente; Nouvelle traduction; Module",
langs_changing_translations_help = "Voir aussi %1 pour demander de l'aide pour traduire.",
langs_mixed_translations_title = "Tables de traductions i18n combinées :",
langs_dummy_languages_title = "langs.dummy_languages() Caractéristiques de quelques langues:",
langs_Module_Central_version = "Central-w-fr",
langs_selectLang_tests_title = "langs.select_lang() Tests: Select a language for tests or other",
langs_selectLang_test_headers = "Wiki language; User language; Sought language; Selected language; Example",
langs_selectLang_test_example = "Language: content = %1, user = %2, selected = %3.",
langs_selectLang_test_err = "Internal error : langs.select_lang(lang) has no tests table.",
langs_selectLang_test_cat = "Module avec erreur interne",
langs_missing_one_translation_err = "Traduction manquante, clé %1 en langue %2",
langs_missing_one_translation_i_cat = "Traduction manquante, au moins une", -- + "Module with internal error",
} -- langs.i18n.br
langs.i18n.de = {
language = 'Sprache',
langs_translations_counts_title = "langs.translations_counts() Übersetzungen in Tabellen zählen",
langs_translations_stats_report_title = "Übersetzungen: Zahlen nach Sprachen und nach Bibliotheken oder Modulen.",
langs_translations_stats_report_headers = "Berechnete Kopfzeilen",
langs_form9user_tests_title = "viewers.form9user() Test: Ersetzen Sie %1 bis %9 durch tostring(argN) von den Argumenten",
langs_form9user_all_types_values = "Testergebnisse: string=%1 number=%2 nil=%3 function=%4 table=%5.",
langs_form99user_tests_title = "viewers.form99user() Test: Ersetzen Sie %01 bis %99 durch tostring(argN) von den Argumenten",
langs_form99user_all_types_values = "en viewers.form99user() Werte aller Arten: %1, %2, %3, %4, %5.",
langs_translations_key_missing = "Interner Fehler: Fehlender oder abnormaler Übersetzungsschlüssel viewers.trans9vars()",
langs_form99user_no_tranlation = "in viewers.form99user() Mangel an Übersetzung.",
langs_form99user_a_value_is_table = "in viewers.form99user() Ein Wert ist eine Tabelle.",
langs_lang_not_exist_err = "Fehler: %1 Sprache ist nicht verfügbar.",
langs_abnormal_char_in_text_title = "langs.abnormal_char_in_text() Test: Ermitteln Sie abnormale Zeichen in einem einsprachigen Text.",
langs_abnormal_char_in_alphabet = "abcdefghabklmnopqrstuvwxyz ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 àéèêëiouüœ ÀÉÈÊËIOUÜŒ ,;.:!?",
langs_list_MediaWiki_languages_title = "langs.list_MediaWiki_languages() Liste aller MediaWiki-Sprachen.",
-- Haupttexte, Fehler und Kategorien von Werkzeugen
langs_first_tests_languages = "Dokumentation der ersten Sprachen",
langs_content_page_user_lang_msg = "Sprachen: content: %1, page: %2, user: %3.",
langs_without_translation_err = "Bekannt, aber nicht übersetzt: %1.",
langs_without_translation_N_err = "Es gibt %1 nicht übersetzte Argumente.",
langs_main_i18n_languages_count = "Dieses Modul kann %1 Sätze in %2 Sprachen übersetzen.",
langs_table_can_translate_counts = "LaDie Tabelle %1 kann %2 Sätze in %3 Sprachen übersetzen.",
langs_mw_language_fetchLanguageName = "%1(%2=%3), ",
langs_counts_translations_headers = "*; Name der Tabelle; Texte; Tabellen; Kommentar",
langs_i18n_list_all_string = "Diese Liste zeigt alle Texte, kann aber die ursprünglichen Aussagen nicht ersetzen.",
langs_languages_nbr_and_list = "\n* Es gibt %1 Übersetzungstabellen in diesen Sprachen: %2
",
langs_string_translated_in_langs = "Es sind %1 Texte in %2 Sprachen übersetzt.",
langs_no_wiki_translations_err = "Interner Fehler: Modul ohne übersetzte Argumententabelle.",
langs_list_in_translated_lang = "%1 Sprachübersetzungen %2 : %3 : %4",
langs_changing_translations_title = "langs.changing_translations() Übersetzungsänderungen in i18n-Tabellen",
langs_changing_translations_headers = "Modul; Sprache; Schlüssel i18n; Vorherige Übersetzung; Ändern der Übersetzung",
langs_missing_translations_title = "langs.missing_translations() Fehlende Übersetzungen in i18n-Tabellen.",
langs_missing_translations_headers = "Sprache; i18n Schlüssel; Vorherige Übersetzung Neue Übersetzung Modul",
langs_changing_translations_help = "Siehe auch %1 für die Hilfe beim Übersetzen.",
langs_mixed_translations_title = "i18n Übersetzungstabellen kombiniert:",
langs_dummy_languages_title = "langs.dummy_languages() Eigenschaften einiger Sprachen:",
langs_dummy_languages_headers = "Sprache; Tag; Inhalt; Fallbacks; unterstützt; gültig; ist RTL; ist bekannt; gültig gebaut; gültiger Code",
langs_Module_Central_version = "Central-w-de",
langs_selectLang_tests_title = "langs.select_lang() Tests: Wählen Sie eine Sprache für Tests oder andere Tests aus",
langs_selectLang_test_headers = "Wiki-Sprache; Benutzersprache; Gesuchte Sprache; Ausgewählte Sprache; Beispiel",
langs_selectLang_test_example = "Sprache: content = %1, user = %2, selected = %3.",
langs_selectLang_test_err = "Internal error : langs.select_lang(lang) has hat keine Testtabelle.",
langs_selectLang_test_cat = "Modul mit internem Fehler",
langs_missing_one_translation_err = "Fehlende Übersetzung, Schlüssel %1 in Sprache %2",
langs_missing_one_translation_i_cat = "Fehlende Übersetzung, mindestens eine", -- + "Module with internal error",
} -- langs.i18n.de
langs.i18n.en = {
language = 'language',
langs_translations_counts_title = "langs.translations_counts() Counts of translations into tables",
langs_translations_stats_report_title = "Translations: numbers by language and by libraries or modules.",
langs_translations_stats_report_headers = "Computed headers",
langs_form9user_tests_title = "viewers.form9user() Test: Replace %1 to %9 by tostring( argN ) from arguments",
langs_form9user_all_types_values = "Résultats de test: string=%1 number=%2 nil=%3 function=%4 table=%5.",
langs_form99user_tests_title = "in viewers.form99user() Test: Replace %01 to %99 by tostring( argN ) from arguments",
langs_form99user_all_types_values = "in viewers.form99user() Values of all types: %1, %2, %3, %4, %5.",
langs_form99user_no_tranlation = "in viewers.form99user() Lack of translation.",
langs_form99user_a_value_is_table = "in viewers.form99user() A value is a table.",
langs_translations_key_missing = "Internal error: Translations key missing or abnormal in viewers.trans9vars()",
langs_lang_not_exist_err = "Error: The language %1 is not available.",
langs_abnormal_char_in_text_title = "langs.abnormal_char_in_text() Test: Detect abnormal characters in an unilingual text.",
langs_abnormal_char_in_alphabet = "abcdefghabklmnopqrstuvwxyz ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 ,;.:!?",
langs_list_MediaWiki_languages_title = "langs.list_MediaWiki_languages() List all MediaWiki languages.",
-- Main string, errors and categories of tools
langs_first_tests_languages = "Documentation of first languages",
langs_content_page_user_lang_msg = "Languages: content: %1, page: %2, user: %3.",
langs_without_translation_err = "Known argument, but not translated: %1.",
langs_without_translation_N_err = "There are %1 arguments untranslated.",
langs_main_i18n_languages_count = "This module can translate %1 sentences into %2 languages: ",
langs_table_can_translate_counts = "The table %1 can translate %2 sentences into %3 languages.",
langs_mw_language_fetchLanguageName = "%1(%2=%3), ",
langs_counts_translations_headers = "*; Table name; Texts; Tables; Comment",
langs_i18n_list_all_string = "This list show all the string, but cannot replace the original declarations.",
langs_languages_nbr_and_list = "\n* There are %1 tables of translations in these languages : %2
",
-- Miscellaneous warnings and errors
langs_string_translated_in_langs = "There are %1 string translated in %2 languages.",
langs_no_wiki_translations_err = "Error: Module without translated arguments table.",
langs_list_in_translated_lang = "%1 translations in language %2 : %3 : %4",
langs_transdiff_wanted_error_err = "Wanted error for minimal test of langs.missing_translations().",
langs_missing_translations_title = "langs.missing_translations() Missing translations in i18n tables.",
langs_missing_translations_headers = "Language; i18n Key; Previous translation; New translation; Module",
langs_changing_translations_headers = "Language; i18n Key; Previous translation; New translation; Module",
langs_changing_translations_help = "See also %1 to ask for help to langs.",
langs_mixed_translations_title = "langs.i18n_lister() Combined i18n translations tables:",
langs_dummy_languages_title = "langs.dummy_languages() Characteristics of some languages:",
langs_dummy_languages_headers = "language; tag; content; fallbacks; supported; valid; is RTL; is known; built; valid code",
langs_Module_Central_version = "Central-w-en",
langs_selectLang_tests_title = "langs.select_lang() Tests: Select a language for tests or other",
langs_selectLang_test_headers = "Wiki language; User language; Sought language; Selected language; Example",
langs_selectLang_test_example = "Language: content = %1, user = %2, selected = %3.",
langs_selectLang_test_err = "Internal error : langs.select_lang(lang) has no tests table.",
langs_selectLang_test_cat = "Module with internal error",
langs_missing_one_translation_err = "Missing translation key %1 in %2 language",
langs_missing_one_translation_i_cat = "Missing at least one translation", -- + "Module with internal error",
} -- langs.i18n.en
langs.i18n.es = { -- ¿Quién es?
language = 'lenguaje',
langs_translations_counts_title = "langs.translations_counts() Condes des traducciones en tablas",
langs_translations_stats_report_title = "Traducciones: números por idioma y por bibliotecas o módulos.",
langs_translations_stats_report_headers = "Encabezados calculados",
langs_form9user_tests_title = "viewers.form9user() Prueba: Reemplazar %1 a %9 por tostring( argN ) a partir de argumentos",
langs_form9user_all_types_values = "Résultats de test: string=%1 number=%2 nil=%3 function=%4 table=%5.",
langs_form99user_tests_title = "en viewers.form99user() Prueba: Reemplazar %01 a %99 por tostring( argN ) a partir de argumentos",
langs_form99user_all_types_values = "en viewers.form99user() Valores de todos los tipos: %1, %2, %3, %4, %5.",
langs_form99user_no_tranlation = "en viewers.form99user() Falta de traducción.",
langs_form99user_a_value_is_table = "en viewers.form99user() Un valor es una tabla.",
langs_translations_key_missing = "Error interno: Traducciones clave que falta o anormal en viewers.trans9vars()",
langs_lang_not_exist_err = "Error: El lenguaje %1 no está disponible.",
langs_abnormal_char_in_text_title = "langs.abnormal_char_in_text() Prueba: Detectar caracteres anormales en un texto monolingüe.",
langs_abnormal_char_in_alphabet = "abcdefghabklmnopqrstuvwxyz ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 àéèêëiouüœ ÀÉÈÊËIOUÜŒ ,;.:!?",
langs_list_MediaWiki_languages_title = "langs.list_MediaWiki_languages() Lista de todos los idiomas de MediaWiki.",
-- Textos principales, errores y categorías de instrumentos
langs_first_tests_languages = "Documentación de las primeras idiomas",
langs_content_page_user_lang_msg = "Idiomas: content: %1, page: %2, user: %3.",
langs_without_translation_err = "Argumento conocido, pero no traducido: %1.",
langs_without_translation_N_err = "Hay %1 argumentos no traducidos.",
-- Diversos mensajes y errores
langs_main_i18n_languages_count = "Este módulo puede traducir %1 frases en %2 idiomas: ",
langs_table_can_translate_counts = "Tabla %1 puede traducir %2 frases en %3 idiomas.",
langs_mw_language_fetchLanguageName = "%1( %2 = %3 ), ",
langs_counts_translations_headers = "*; Nombre de la tabla; Textos; Mesas; Comentario",
langs_languages_nbr_and_list = "\n* Hay %1 mesas de traducciones en estas idiomas: %2
",
langs_string_translated_in_langs = "Hay %1 textos traducidos en %2 idiomas.",
langs_no_wiki_translations_err = "Error: Módulo sin argumentos traducidos tabla.",
langs_i18n_list_all_string = "Esta lista muestra todos los textos, pero no puede sustituir a las declaraciones originales.",
langs_list_in_translated_lang = "%1 traducciones en idioma %1:%2:%3 %4 ",
langs_missing_translations_title = "langs.missing_translations() Faltan traducciones en las tablas i18n.",
langs_missing_translations_headers = "Idioma; llave i18n; Traducción previa; Nueva traducción; Módulo",
langs_changing_translations_title = "langs.changing_translations() Changing (or missing) translations in i18n tables.",
langs_changing_translations_title = "langs.changing_translations() Traducciones que cambian (o falta de) en las tablas i18n.",
langs_changing_translations_headers = "Idioma; Clave i18n; Traducción anterior; Nueva traducción; Módulo",
langs_changing_translations_help = "Consulte también %1 para solicitar ayuda para traducir.",
langs_mixed_translations_title = "Tablas traducciones i18n combinadas:",
langs_dummy_languages_title = "langs.dummy_languages() Características de algunos idiomas:",
langs_dummy_languages_headers = "idioma; etiqueta; retrocesos; soportado; válido; es RTL; es conocida; construido; codigo valido",
langs_Module_Central_version = "Central-w-es",
langs_selectLang_tests_title = "langs.select_lang() Tests: Select a language for tests or other",
langs_selectLang_test_headers = "Wiki language; User language; Sought language; Selected language; Example",
langs_selectLang_test_example = "Language: content = %1, user = %2, selected = %3.",
langs_selectLang_test_err = "Internal error : langs.select_lang(lang) has no tests table.",
langs_selectLang_test_cat = "Module with internal error",
langs_missing_one_translation_err = "Falta traducción, clave %1 en el idioma %2",
langs_missing_one_translation_i_cat = "Falta la traducción, al menos uno", -- + "Module with internal error",
} -- langs.i18n.es
langs.i18n.fr = {
language = 'langue',
langs_translations_counts_title = "langs.translations_counts() Comptages des traductions en tables",
langs_translations_stats_report_title = "Traductions: nombres par langues et par librairies ou modules.",
langs_translations_stats_report_headers = "En-têtes calculés",
langs_form9user_tests_title = "viewers.form9user() Test: Remplacer %1 à %9 par tostring( argN ) à partir des arguments",
langs_form9user_all_types_values = "Résultats de test: string=%1 number=%2 nil=%3 function=%4 table=%5.",
langs_form99user_tests_title = "viewers.form99user() Test: Remplacer %01 à %99 par tostring( argN ) à partir des arguments",
langs_form99user_all_types_values = "en viewers.form99user() Valeurs de tous types : %1, %2, %3, %4, %5.",
langs_translations_key_missing = "Erreur interne: Clé de traduction manquante ou anormale dans viewers.trans9vars()",
langs_form99user_no_tranlation = "en viewers.form99user() Manque de traduction.",
langs_form99user_a_value_is_table = "en viewers.form99user() Une valeur est une table.",
langs_lang_not_exist_err = "Erreur : La langue %1 n'est pas disponible.",
langs_abnormal_char_in_text_title = "langs.abnormal_char_in_text() Test: Détecter les caractères anormaux dans un texte unilingue.",
langs_abnormal_char_in_alphabet = "abcdefghabklmnopqrstuvwxyz ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 àéèêëiouüœ ÀÉÈÊËIOUÜŒ ,;.:!?",
langs_list_MediaWiki_languages_title = "langs.list_MediaWiki_languages() Liste de toutes les langues de MediaWiki.",
-- Principaux textes, erreurs et catégories des outils
langs_first_tests_languages = "Documentation des premières langues",
langs_content_page_user_lang_msg = "Langues : content: %1, page: %2, user: %3.",
langs_without_translation_err = "Argument connu, mais non traduit : %1.",
langs_without_translation_N_err = "Il y a %1 arguments non traduits.",
langs_main_i18n_languages_count = "Ce module peut traduire %1 phrases en %2 langues : ",
langs_table_can_translate_counts = "La table %1 peut traduire %2 phrases en %3 langues.",
langs_mw_language_fetchLanguageName = "%1(%2=%3), ",
langs_counts_translations_headers = "*; Nom de la table; Textes; Tables; Commentaire",
langs_i18n_list_all_string = "Cette liste montre tous les textes, mais ne peut remplacer les déclarations originales.",
langs_languages_nbr_and_list = "\n* Il y a %1 tables de traductions dans ces langues : %2
",
langs_string_translated_in_langs = "Il y a %1 textes traduits en %2 langues.",
langs_no_wiki_translations_err = "Erreur interne : Module sans table d'arguments traduits.",
langs_list_in_translated_lang = "%1 traductions en langage %2 : %3 : %4",
langs_changing_translations_title = "langs.changing_translations() Changements de traduction dans les tables i18n",
langs_changing_translations_headers = "Module; Langue; Clé i18n; Traduction précédente; Traduction changeante",
langs_missing_translations_title = "langs.missing_translations() Traductions manquantes dans les tables i18n.",
langs_missing_translations_headers = "Langue; clé i18n; Traduction précédente; Nouvelle traduction; Module",
langs_changing_translations_help = "Voir aussi %1 pour demander de l'aide pour traduire.",
langs_mixed_translations_title = "Tables de traductions i18n combinées :",
langs_dummy_languages_title = "langs.dummy_languages() Caractéristiques de quelques langues:",
langs_dummy_languages_headers = "langue; balise; contenu; replis; en charge; valide; est RTL; est connu; construit; code valide",
langs_Module_Central_version = "Central-w-fr",
langs_selectLang_tests_title = "langs.select_lang() Tests: Select a language for tests or other",
langs_selectLang_test_headers = "Wiki language; User language; Sought language; Selected language; Example",
langs_selectLang_test_example = "Language: content = %1, user = %2, selected = %3.",
langs_selectLang_test_err = "Internal error : langs.select_lang(lang) has no tests table.",
langs_selectLang_test_cat = "Module avec erreur interne",
langs_missing_one_translation_err = "Traduction manquante, clé %1 en langue %2",
langs_missing_one_translation_i_cat = "Traduction manquante, au moins une", -- + "Module with internal error",
} -- langs.i18n.fr
langs.MetaSupportedLanguages = { "ja", "es", "ru", "de", "nl", "tr", "fr", "pt", "ko", "en", "it", "oc", "pl", "fa", "ar", "vi", "arz", "hi", "sv", "diq", "pt-br", "zh", "th", "bg", "hu", "uk", "en-gb", "sh", "id", "bn", "az", "fi", "be", "he", "eo", "el", "sd", "kn", "ro", "yue", "sr", "mk", "ta", "pa", "hy", "lb", "tt", "si", "yi", "ne", "cs", "sk", "ms", "eu", "mr", "sa", "tl", "eml", -- https://meta.wikimedia.org/wiki/Special:SupportedLanguages on 20170629 Rical } -- 58 languages in total.
function langs.i18n_sub_counts(subnames_in, key_form, lang) -- Count i18n in the last sub-table from its sub-names. -- local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts(subnames_in, key_form, lang) local subnames_in, key_form, lang = subnames_in, key_form, lang if (type(subnames_in) ~= "string") then subnames_in = "" end local t, strings_c, tables_c, strs_on_tabs, subnames = "", 0, 0, 0, "" local sub_names = mw.text.split(subnames_in, '%.') -- table of words local in_i18n, i18n_i, subnames_, sub_tab, all_strings, strs_on_tabs, separ local i18n_counts, i18n_strings_c, i18n_tables_c local lang_counts, lang_strings_c, lang_tables_c = {} if (type(sub_names) == "table") then subnames_ = "" separ = "" in_i18n = nil i18n_i = 0 for i, sub_name in ipairs(sub_names) do subnames_ = subnames_ .. separ .. sub_name separ = "." subnames = subnames_ -- string.sub(subnames_, 2, -1) -- like modes.i16n.fr if viewers.is_in("i18n", sub_name) then -- In a i18n table i18n_i = i sub_tab = lua_table.from_subnames_table(subnames) -- Get the last sub-table from its sub-names. i18n_counts = lua_table.count_types(sub_tab) i18n_strings_c = i18n_counts.string or "0" i18n_tables_c = i18n_counts.table or 0 tables_c = i18n_tables_c all_strings = 0 if (type(sub_tab) == "table") then -- until last subname for key, val in pairs(sub_tab) do if (type(val) == "table") then all_strings = all_strings + lua_table.count_all(val) -- Actual count end end end strs_on_tabs = math.floor( (all_strings + 0.49) / math.min(tables_c, 1) ) strings_c = strs_on_tabs elseif i > i18n_i then -- In a language sub-table sub_tab = lua_table.from_subnames_table(subnames) -- Get the last sub-table from its sub-names. lang_counts = lua_table.count_types(sub_tab) lang_strings_c = lang_counts.string lang_tables_c = lang_counts.table strings_c = lang_strings_c tables_c = 1 end end end -- This module can translate... = langs_main_i18n_languages_count local strings_c = strings_c or 0 -- or lang_counts.strings_c local tables_c = tables_c or 0 -- or i18n_tables_c.tables_c local strs_on_tabs = strs_on_tabs or 0 -- Formats resulting text if (type(lang) ~= "string") then lang = "user" elseif lang == "c" then lang = "content" elseif lang == "p" then lang = "page" elseif lang == "u" then lang = "user" end if (type(key_form) ~= "string") then key_form = "langs_table_can_translate_counts" end local t = viewers.form9user(key_form, subnames, strings_c, tables_c) if lang == "page" then t = viewers.form9page(key_form, subnames, strings_c, tables_c) end if lang == "content" then t = viewers.form9content(key_form, subnames, strings_c, tables_c) end return t, strings_c, tables_c, strs_on_tabs, subnames -- local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts(subnames_in, key_form, lang) end -- function langs.i18n_sub_counts(subnames_in, key_form, lang)
function langs.translations_counts(t) -- Counts of contents of some tables, from their names. -- S170618ltc local memo = viewers.save_configs("langs.translations_counts") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* langs.translations_counts(t) : Counts of contents of some tables, from their names' end local selector = "br;es;vi;modes;begin;translate;" -- Select a reduces table view. local object_loaded, counts, pre_counts, tables_c, sub_string_count local tabname, subnames, tt, lang local trans_Group, trans_counts = {}, {} local libname_total = 0 local select_track = "-" -- nil local trans_counts = {} for libname, library in pairs(package.loaded) do if (type(library.i18n) == "table") then -- Select all libraries with i18n tables. tabname = libname .. ".i18n" table.insert(trans_Group, { tabname } ) -- Build a table with translations counts. end end table.sort(trans_counts, function (row_x, row_y) return ( row_x[1] < row_x[1] ) end ) -- Sort based on [1]=tabname local test_tables = "versions.memo_i18n;begin.i18n.de;begin.i18n.hu;begin.i18n.vi;modes.i18n.fr" -- Select a reduces table view. local test_tables_tab = mw.text.split(test_tables, ';') -- table of words for i, subnames_in in ipairs(test_tables_tab) do -- list all used names, only one each, in alphabetic order table.insert(trans_Group, { ["subnames_in"] = subnames_in, ["i"] = i } ) -- Build a table with translations counts. end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = trans_Group, title_memo = "langs_translations_counts_title", -- "langs.translations_counts() Counts of translations in tables", headers = "langs_counts_translations_headers", -- "*; Table name; Texts; Tables; Comment",en form_one_case = function(case) -- Convert a case from test_group to rowGroup. case.subnames_in = case.subnames_in or "subnames_in" case.sub_names = lua_table.from_subnames_table(case.subnames_in, case.base_table) -- Get the last sub-table from its sub-names. case.i = case.i or 33 case.t, case.strings_c, case.tables_c, case.strs_on_tabs, case.subnames = langs.i18n_sub_counts(case.subnames_in, "langs_table_can_translate_counts", "user") case.comment = viewers.form9user("langs_table_can_translate_counts", case.subnames, case.strings_c, case.tables_c) return { case.i, case.subnames_in, case.strings_c, case.tables_c, case.t, } -- .. comment .. trk end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "langs.translations_counts") -- Restore global configurations after eventual changes. return t end -- t = function langs.translations_counts(t)
versions.central_libraries_sort = versions.central_libraries_sort or {} versions.bind_main_and_sub_modules_get = versions.bind_main_and_sub_modules_get or {}
function langs.translations_statistics_report(t) -- Reports statistics on translations.
local memo = viewers.save_configs("langs.translations_statistics_report") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* langs.translations_statistics_report(t) : Reports statistics on translations' end
t = t .. "\n* Guideline for this stat : Count lists of translations by languages and libraries, then convert in a 2D table, then format and report them."
t = t .. "\n* Normal result: Counts are similar in all languages."
local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- }
local translate_i18n = versions.memo_i18n
local all_stats = {} -- all_stats + Total
local trans_count, case, i18n_group, total_stat, total_stats = 0
-- Guideline for this stat : Collect counts of translations by languages and libraries, then put them in a 2D table, then format and report them.RIC
for libname, vers in pairs(package.loaded) do -- in reverse order bind_libra
total_stat = { ["libr"] = tostring(vers.libname), ["code"] = "en", ["content"] = 0, ["page"] = 0, ["user"] = 0, ["n_langs"] = 0, ["total"] = 0, }
if (type(vers) == "table") and (type(vers.i18n) == "table") then
local case = { ["libr"] = tostring(vers.libname), ["code"] = "en", ["content"] = 0, ["page"] = 0, ["user"] = 0, ["n_langs"] = 0, ["total"] = 0, }
for code_lang, available_translations in pairs(vers.i18n) do -- import and mix known args and properties
case.code = code_lang
case.count = lua_table.level_count(available_translations)
-- case.i18n = vers.i18n
case.total_stat = { ["libr"] = tostring(vers.libname), ["code"] = "en", ["content"] = 0, ["page"] = 0, ["user"] = 0, ["n_langs"] = 0, ["total"] = 0, }
if case.code == langs.content_lang then case.content = case.count ; total_stat.content = total_stat.content + case.count end
if case.code == langs.page_lang then case.page = case.count ; total_stat.page = total_stat.page + case.count end
if case.code == langs.user_lang then case.user = case.count ; total_stat.user = total_stat.user + case.count end
-- total_stat.code = (total_stat.code or 0) + 1
total_stat.n_langs = (total_stat.n_langs or 0) + 1
case = { ["libr"] = tostring(vers.libname), ["code"] = case.code,
["content"] = case.content or 0, ["page"] = case.page or 0, ["user"] = case.user or 0, ["n_langs"] = 1, ["total"] = 0, }
end
table.insert( all_stats, case )
end
end
local list_case_libname = {} -- list of libnames
langs.list_case_libname = list_case_libname
for i, case in pairs(all_stats) do table.insert(langs.list_case_libname, case.libr) end
table.sort(langs.list_case_libname, function (a, b) return ( tostring(a) < tostring(b) ) end ) -- sort found langcodes
local headers = "langcode" -- and add list of libnames
for x, libname in pairs(langs.list_case_libname) do headers = headers .. ";" .. tostring(libname) end
headers = string.gsub(headers, versions.ModuleNS, "")
local libraries = {}
local langcodes = {} -- langcodes collection
local libnames = { "langcode" } -- libnames collection
for title, obj in pairs(package.loaded) do -- Get all libraries and libnames names.
local get = versions.bind_main_and_sub_modules_get[title]
if get and get.is_library and (type(get.i18n) == "table") then -- select libraries only
local libname = tostring(get.title)
table.insert( libnames, libname )
end
end
for i, libname in pairs(libnames) do -- for all objects
local get = versions.bind_main_and_sub_modules_get[libname]
if get and get.is_library and (type(get.module) == "table") and (type(get.title) == "string") then -- select libraries only
libname = get.title -- for all libraries
local lib = get.module
for langcode, trans_tab in pairs(lib.i18n) do -- To collect all langcode
if type(langcode) == "string" then langcodes[langcode] = langcode end -- add the langcode
end
end
end
local list_case_langcode = {} -- list of found langcodes
langs.list_case_langcode = list_case_langcode
for x, langcode in pairs(langcodes) do table.insert(list_case_langcode, langcode) end
table.sort(list_case_langcode, function (a, b) return ( tostring(a) < tostring(b) ) end ) -- sort found langcodes
local langcode_libname_2D = {}
local list_trans = {} -- list of number of translations in one library.
for i, langcode in pairs(list_case_langcode) do -- Structure a 2D table : libraries in langcodes.
local lib_tab = { langcode }
for j, libname in pairs(list_case_libname) do -- List all package.loaded objects.
local lib = package.loaded[tostring(libname)]
table.insert( lib_tab, lua_table.level_count(lib.i18n[tostring(langcode)]) )
end
table.insert(langcode_libname_2D, lib_tab)
end
local tab_view = { -- Group datas and options for a table view with lines and columns.
test_group = langcode_libname_2D,
title_memo = "langs_translations_stats_report_title",
form_one_case = function(case) -- Convert a case from test_group to row_group.
return case
end,
["headers"] = "Lang;activity;datas;langs;events;lua_table;mathroman;modes",
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "langs.translations_statistics_report") -- Restore global configurations after eventual changes.
return t
end -- res = res .. langs.translations_statistics_report(t)
function langs.key(key, lang) -- Translate the key in user, wiki and content languages. if (type(key) ~= "string") then key = "translate_missing_key_err" end if (type(lang) ~= "string") then lang = nil end local translate_i18n = versions.memo_i18n function translate_one_key(translate_i18n, key, lang) if lang and (type(translate_i18n) == "table") then translate_i18n = translate_i18n[lang] end if key and (type(translate_i18n) == "table") then translate_i18n = translate_i18n[key] end return translate_i18n end translate_i18n = translate_one_key(translate_i18n, key, lang) if (type(lang) == "string") then -- Only the selected language return translate_i18n else return translate_one_key(translate_i18n, key, langs.user_lang), translate_one_key(translate_i18n, key, langs.content_lang), translate_one_key(translate_i18n, key, langs.page_lang) end -- local user, wiki, page = langs.key(key, lang) -- Examples of uses end -- function langs.key(key, lang)
function langs.main_i18n_languages_list() -- List available translations and languages local main_i18n = versions.memo_i18n or {} local xxx, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts("versions.memo_i18n", "langs_main_i18n_languages_count", "user") local tab_to_sort = {} for lang, modname in pairs(main_i18n) do table.insert(tab_to_sort, lang) -- build a table with only languages codes end table.sort(tab_to_sort, function (a, b) -- sort the languages codes in stable alphabetic order return ( a < b ) end ) strs_on_tabs = math.floor(strs_on_tabs / tables_c) local t = viewers.form9user("langs_main_i18n_languages_count", strs_on_tabs, tables_c) for i, lang in pairs(tab_to_sort) do -- Name and count translations in each language local langi18n = "langs.main_i18n." .. lang local xxx, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts(langi18n, "langs_main_i18n_languages_count", "user") t = t .. "" .. strings_c .. "-" local nativename = mw.language.fetchLanguageName(lang) local englishname = mw.language.fetchLanguageName(lang, "en") local englishname = mw.language.fetchLanguageName(lang, "en") t = t .. viewers.form9user("langs_mw_language_fetchLanguageName", nativename, lang, englishname) -- "%1(%2=%3), " if i > 12 then t = t .. " ..." ; break end end -- see langs.select_lang return t end -- function langs.main_i18n_languages_list()
langs.Central_version = "Central-s-fr" -- To adapt the version of Module:Centralizer in any translated text. langs.default_user_lang = "en" -- To adapt the version of Module:Centralizer in any translated text. -- waiting T68051 Central modules need the user language to display errors and category names
function langs.init_content_page_user_lang(content_lang, page_lang, user_lang) -- Initialize or change the content, the page and the user languages and their translations tables. -- Guide line: decreasing priority, for each of these 3 languages, is : argument, else MediaWiki, else default values. -- See also https://meta.wikimedia.org/wiki/Translate_extension and Special:PageLanguage 2016-12-19 local main_i18n = versions.memo_i18n or langs.main_i18n or versions.main_i18n local t = "" -- internal track local lg = {} local modesCont, modesPage, modesUser = nil, nil, nil if modes.args_source then -- and modes.args_source.userlang Does module arguments ask a content_lang? local modes_args = modes.args_known or modes.args_source -- work after full init or before modesCont = modes_args.contentlang modesPage = modes_args.pagelang modesUser = modes_args.userlang end -- waiting T68051 Central modules need the user language to display errors and category names -- Activate these languages for all uses. if type(main_i18n) ~= "table" then main_i18n = {} end -- default empty main_i18n. Only for languages langs.content_lang = content_lang or get_content_lang or "en" langs.content_translations = main_i18n[langs.content_lang] langs.page_lang = page_lang or get_page_lang or "en" langs.page_translations = main_i18n[langs.page_lang] langs.user_lang = user_lang or get_user_lang or langs.default_user_lang or "en" langs.user_translations = main_i18n[langs.user_lang] langs.main_i18n = main_i18n versions.main_i18n = main_i18n return t end -- function langs.init_content_page_user_lang(content_lang, page_lang, user_lang) -- _new
function langs.select_lang( lang ) -- Select a language for tests or other purpose. if type(lang) ~= "string" then lang = "user_lang" end -- default is user language -- Select between : user_lang content_lang tests en es fr or any available in i18n. if lang == "tests" then lang = "tests" elseif versions.memo_i18n and versions.memo_i18n[lang] then lang = lang -- available in i18n elseif lang == "user_lang" then lang = langs.user_lang elseif lang == "content_lang" then lang = langs.content_lang else lang = langs.user_lang end -- default is user language return lang end -- function langs.select_lang( lang )
function langs.select_lang_test(t) -- Tests: Select a language for tests or other purpose. local memo = viewers.save_configs("langs.select_lang_test") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* langs.select_lang_test(t) : Tests: Select a language for tests or other purpose' end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = { -- events.test_group { content_lang = "en", user_lang = "fr", sought = "content_lang", }, { content_lang = "en", user_lang = "es", sought = "user_lang", }, { content_lang = "en", user_lang = nil , sought = "content_lang", }, { content_lang = nil , user_lang = "es", sought = "user_lang", }, { content_lang = "fr", user_lang = "es", sought = "tests", }, }, headers = "langs_selectLang_test_headers", form_one_case = function(case) -- Convert a case from test_group to rowGroup. local selected = langs.select_lang( lang ) local example = viewers.form9user("langs_selectLang_test_example") if selected == "tests" then example = viewers.form9tests("selectLang", case.content_lang, case.user_lang, case.sought) end return { tostring(case.content_lang), tostring(case.user_lang), tostring(case.sought), tostring(selected), tostring(example), } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "langs.select_lang_test") -- Restore global configurations after eventual changes. return t end -- langs.select_lang_test(t)
function langs.list_MediaWiki_languages(t, lang) -- List all MediaWiki languages.
local memo = viewers.save_configs("langs.list_MediaWiki_languages") -- Save global configuration before eventual changes.
if type(t) ~= "string" then t = "\n* langs.list_MediaWiki_languages() List all known MediaWiki languages:" end
local interwikiMap = mw.site.interwikiMap("local") local lang = mw.language.new( langs.user_lang or "en" )
local LangCode = lang:getFallbackLanguages()
local lang_code_name = mw.language.fetchLanguageNames() -- inLanguage, 'mwfile' )
local toSort, t2 = {}, ""
local t = t .. "\n* Infos lang_code_name: " .. viewers.ta("#lang_code_name", lua_table.level_count(lang_code_name) )
for code, name in pairs(lang_code_name) do -- make a true table in rough order
table.insert(toSort, { code, name } )
-- insert detail { [1]=code, [2]=name } )
end
table.sort(toSort, function (row_x, row_y) return ( row_x[1] < row_x[1] ) end ) -- Sort based on [1]=code
table.sort(toSort, function (row_x, row_y) return ( row_x[2] < row_x[2] ) end ) -- Sort based on [2]=name
t = t .. "\n* List of known languages of MediaWiki lang_code_name:
" .. t2
t = t .. "\n* Infos: " .. viewers.ta("#lang_code_name", lua_table.level_count(lang_code_name) ) .. viewers.ta("#toSort", lua_table.level_count(toSort) ) .. viewers.ta("user_lang", langs.user_lang)
t2 = ""
for i, lang in pairs(toSort) do
local ok = 1 or langs.abnormal_char_in_text(lang[2], langs.user_lang) -- Detect abnormal characters in an unilingual text.
local lang_2 = lang[2]
if not ok then lang_2 = viewers.styles_color_error(lang_2) end
t2 = t2 .. viewers.ta( lang[1], lang_2 ) -- .. "\n* "
end
t = t .. "\n* List of known languages of MediaWiki:
" .. t2
viewers.restore_configs(memo, "langs.list_MediaWiki_languages") -- Restore global configurations after eventual changes.
return t
end -- function langs.list_MediaWiki_languages(t, lang)
function langs.abnormal_char_in_text(t) -- Test: Detect abnormal characters in an unilingual text. if type(t) ~= "string" then return false end -- langs_abnormal_char_in_text_title -- local ok, normal = true, "ABCDEFGHABKLMNOPQRSTUVWXYZ 013456789 abcdefghabklmnopqrstuvwxyz àéèêëiouüœ ÀÉÈÊËIOUÜŒ ,;.:!?" local ok, normal = true, viewers.form9user("langs_abnormal_char_in_alphabet") local letter, nn = "x", string.len(t .. " abcdef") - 3 for i = 1, nn do -- for all chars in t letter = string.byte(t, i) if not viewers.is_in(letter, normal) then ok = false ; break end end return ok end -- function langs.abnormal_char_in_text(t)
function langs.changing_translations(t) -- List all changing translations
local memo = viewers.save_configs("langs.changing_translations") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* langs.changing_translations(t) : List all changing translations' end
local i18n = versions.memo_i18n
langs.translations_differences = langs.translations_differences or {}
local nerr, errors, trans, err = 0, "*", "", ""
local nbr, nbr_in_lang, list = 0, 0, ""
local nbr_in_lang_limit = 4
local prev_i18n, next_i18n, prev_table, next_table, max, nkeys = {}, {}, {}, {}, 0, 0
local strnew, lang, prev_lang, refer_lang, cats = "strnew", "", "", "", "", ""
-- change means a different text in the main module relative to the text inside each central library, based on the same keyi18n.
local changingGroup, libraries = {}, {}
for title, obj in pairs(package.loaded) do -- For libraries only
local get = versions.bind_main_and_sub_modules_get[title]
if get and get.is_library and (type(get.i18n) == "table") then
prev_lang = refer_lang
prev_i18n = get.i18n
next_i18n = i18n
table.insert(libraries, get.module)
end
end
local lib_langs_keys = {} -- To mix libraries their langs and keys and vals
for title, onelibrary in pairs(libraries) do -- For all libraries only
for onelang, lang_table in pairs(onelibrary.i18n) do -- For all languages in each library
lib_langs_keys[onelang] = lib_langs_keys[onelang] or {}
for key, val in pairs(lang_table) do -- For all keys in each language
lib_langs_keys[onelang][key] = val
end
end
end
for refer_lang, next_table in pairs(libraries) do -- For all languages and texts to translate
list = list .. refer_lang .. ", "
nbr = nbr + 1
if type(next_table) == "table" then -- For each pair of languages to compare
nkeys = 0
nbr_in_lang = 0
local all_txts = {}
if type(next_table) == "table" then -- For each language to compare
for keyi18n, stri18n in pairs(next_table) do -- List all texts translated in at least one language
all_txts[keyi18n] = stri18n
end
for keyi18n, stri18n in pairs(all_txts) do -- Look at all translations in one language, but check them only from 1 to nbr_in_lang_limit.
nbr_in_lang = nbr_in_lang + 1
nkeys = nkeys + 1
if (type(keyi18n) == "string") then -- only translations, not positional arguments
keyi18n, stri18n = tostring(keyi18n), tostring(stri18n)
local cut = string.find(tostring(keyi18n) .. "_", "_")
local modul = string.sub(keyi18n, 1, cut - 1)
if (nbr_in_lang == nbr_in_lang_limit) then -- for the last changing
-- local strnew = i18n[refer_lang][keyi18n] or "strnew"
if i18n[refer_lang] then
strnew = i18n[refer_lang][keyi18n] or "strnew"
end
table.insert( changingGroup, { ["lang"] = refer_lang, ["keyi18n"] = keyi18n, ["stri18n"] = stri18n, ["strnew"] = strnew,
["counts"] = viewers.styles_color_error("changing limit = " .. nbr_in_lang_limit), ["modul"] = modul} )
-- nerr = nerr + 1
elseif (nbr_in_lang < nbr_in_lang_limit) then -- for changing before the last
-- headers = "Language; i18n Key; Previous translation; New translation; Module",
if i18n[refer_lang] then
strnew = i18n[refer_lang][keyi18n] or "strnew"
end
table.insert( changingGroup, { ["lang"] = refer_lang, ["keyi18n"] = keyi18n, ["stri18n"] = stri18n, ["strnew"] = strnew,
["counts"] = "changing: " .. nkeys .. " / " .. nerr, ["modul"] = modul} )
nerr = nerr + 1
end
end
end
end
if nkeys > max then max = nkeys end
end
prev_lang = refer_lang
prev_table = next_table
end
if nerr > 0 then
err = events.add_err("versions_module_miss_i18n_count_err", nerr, max)
t = t .. "
" .. err .. " "
errors = errors .. err
cats = cats .. events.add_cat("versions_err_module_miss_i18n_cat")
else
errors = errors .. " no errors "
-- err = events.add_wng("versions_module_miss_i18n_none_err")
end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "langs_changing_translations_title",
test_group = changingGroup,
langs_changing_translations_title = "langs.changing_translations() Changing (or missing) translations in i18n tables.",
langs_changing_translations_headers = "Language; i18n Key; Previous translation; New translation; Module",
headers = "Language; Key; Translation; N errs / N keys, Module",
headers = "langs_changing_translations_headers", -- CHANGING headers = "Language; Key; Previous translation; New translation; Module",
headers = "Language; i18n Key; Previous translation; New translation; counts; Module",
kind = "projects", -- MediaWiki or projects
typ = "err",
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
errors = errors or " no errors "
if errors ~= "" then errors = viewers.styles_color_error(errors) end
t = t .. viewers.ta("#tab_view.rowGroup", lua_table.level_count(tab_view.rowGroup) ) -- Formats a table with lines and columns.
viewers.restore_configs(memo, "langs.changing_translations") -- Close a cats and errors table. For one test or main module.
return t --, errors -- translate_missing_translations_title
end -- function langs.changing_translations(t)
function langs.missing_translations_init(t) -- Initialize the list of known translations, and their counts. local t = t -- t or if (type(t) ~= "string") then t = '\n* langs.missing_translations_init(t) : Initialize the list of known translations, and their counts' end langs.known_translations = langs.known_translations or {} versions.memo_i18n = mw.clone(versions.main_i18n or langs.main_i18n) local i18n = versions.memo_i18n langs.known_langs = i18n langs.known_texts = {} langs.known_langs_maxi = 0 langs.known_texts_maxi = 0 for refer_lang, next_table in pairs(i18n) do -- For all languages and texts to translate if (type(other_trans) == "table") then langs.known_langs[refer_lang] = refer_lang t = t .. "\n* for refer_lang : " .. viewers.ta("refer_lang", refer_lang) .. viewers.ta("#next_table", lua_table.level_count(next_table) ) for name, txt in pairs(next_table) do -- mix translations for 1 language in 1 library -- table.insert( langs.known_texts, { name = txt } ) langs.known_texts[name] = txt end t = t .. " end for : " .. viewers.ta("#langs.known_texts", lua_table.level_count(langs.known_texts) ) end end t = t .. "\n* i18n end: " .. viewers.ta("#langs.known_langs", lua_table.level_count(langs.known_langs) ) .. viewers.ta("#langs.known_texts", lua_table.level_count(langs.known_texts) ) if (langs.known_langs_maxi < lua_table.level_count(i18n) ) then langs.known_langs_maxi = lua_table.level_count(i18n) end -- Maximum number of languages return t end
function langs.missing_translations(t) -- List all missing translations local memo = viewers.save_configs("langs.missing_translations") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* langs.missing_translations(t) : List all missing translations' end local i18n = versions.memo_i18n local errors = "*" local changingGroup = {} local missingGroup = {} langs.translations_differences = langs.translations_differences or {} local nerr, trans, err = 0, "", "" local nbr, nbr_in_lang, list = 0, 1, "" local nbr_in_lang_limit = 4 local prev_table, next_table, max, nkeys = {}, {}, 0, 0 local lang, prev_lang, refer_lang, cats = "", "", "", "" local refer_stri18n, other_stri18n = "-" local count_known_texts = lua_table.level_count(langs.known_texts) local count_changingGroup = lua_table.level_count(changingGroup) local count_missingGroup = 0 t = t .. langs.missing_translations_init(t) -- Initialize the list of known translations, and their counts. t = t .. "\n* Insure next_table is OK: " local nkeys = 0 local err_in_refer_lang, err_in_other_lang, err_in_refer_lang_limit = 0, 0, 5 for refer_lang, refer_trans in pairs(langs.known_langs) do -- for all languages if not ( (refer_lang == "en") or (refer_lang == "es") or (refer_lang == "fr") ) then -- small langs for tests debug t = t .. ", L=" .. refer_lang ..": n=".. lua_table.level_count(refer_trans) refer_trans = i18n[refer_lang] -- Look at all translations in one language, but check them only from 1 to nbr_in_lang_limit. if not ( (other_lang == "en") or (other_lang == "es") or (other_lang == "fr") ) then -- small langs for tests debug t = t .. ", O=" .. other_lang ..": n=".. lua_table.level_count(other_trans) if (type(other_trans) == "table") then -- if the translations in the alternate language is ok t = t .. ", nlt=" .. refer_lang for keyi18n, stri18n in pairs(refer_trans) do -- Look at all translations local cut = string.find(tostring(keyi18n) .. "_", "_") local modul = string.sub(keyi18n, 1, cut - 1) refer_stri18n = i18n[refer_lang][keyi18n] other_stri18n = i18n[other_lang][keyi18n] count_known_texts = lua_table.level_count(langs.known_texts) count_changingGroup = lua_table.level_count(changingGroup) if (not other_stri18n) and (err_in_refer_lang < err_in_refer_lang_limit) then -- if missing err_in_refer_lang = err_in_refer_lang + 1 count_missingGroup = lua_table.level_count(count_missingGroup) + 1 local missing_case = { ["refer_lang"] = refer_lang, ["other_lang"] = other_lang, ["keyi18n"] = keyi18n, ["refer_stri18n"] = refer_stri18n, ["counts"] = viewers.form9user("counts missing=%1 / changing=%2 count_known_texts=%3 (err n=%4)", count_missingGroup, count_changingGroup, count_known_texts, err_in_refer_lang), ["modul"] = modul } table.insert( missingGroup, missing_case ) t = t .. viewers.form9user( "\n* missing err: refer_lang=%1, other_lang=%2, missing=%3 / changing=%4, keyi18n=%5", refer_lang, other_lang, count_missingGroup, count_changingGroup, keyi18n) elseif (other_stri18n ~= refer_stri18n) and (err_in_other_lang < err_in_refer_lang_limit) then -- if changing err_in_other_lang = err_in_other_lang + 1 count_changingGroup = lua_table.level_count(changingGroup) + 1 local counts = viewers.form9user("refer_lang=%1, other_lang=%2, counts changing=%3 / missing=%4, texts=%5, error=%6", refer_lang, other_lang, count_changingGroup, count_missingGroup, count_known_texts, err_in_other_lang) local changing_case = { ["refer_lang"] = refer_lang, ["other_lang"] = other_lang, ["keyi18n"] = keyi18n, ["refer_stri18n"] = refer_stri18n, ["other_stri18n"] = other_stri18n, ["counts"] = counts, ["modul"] = modul, } table.insert( changingGroup, changing_case ) t = t .. viewers.form9user( "\n* changing err: refer_lang=%1, other_lang=%2, changing=%3 / missing=%4, keyi18n=%5", refer_lang, other_lang, count_changingGroup, count_missingGroup, keyi18n) end end end end end end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = missingGroup, langs_missing_translations_title = "langs.missing_translations() Missing translations in i18n tables.", langs_missing_translations_headers = "Language; i18n Key; Previous translation; New translation; Module", title_memo = "langs_missing_translations_title", headers = "langs_missing_translations_headers", -- MISSING "Language; i18n Key; Previous translation; New translation; Module", headers = "Languages; missing Key; Previous translation; New translation; Module", form_one_case = function(case) return { case.refer_lang, case.other_lang, case.keyi18n, case.refer_stri18n, case.counts, } end, kind = "projects", -- MediaWiki or projects typ = "err", headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "langs.missing_translations") -- Restore global configurations after eventual changes. return t --, errors -- langs_missing_translations_title end -- function langs.missing_translations(t)
function langs.i18n_lister(t, i18n_tables) -- This list show all the string, but cannot replace the original declarations if type(i18n_tables) ~= "table" then i18n_tables = versions.memo_i18n end local t = t -- t or if (type(t) ~= "string") then t = '\n* langs.i18n_lister(t, i18n_tables) : This list show all the string, but cannot replace the original declarations' end t = t .. viewers.styles_color_error("\n* This list show all the string, but cannot replace the original declarations. ") t = t .. viewers.styles_color_error("\n* " .. viewers.form9user("langs_i18n_list_all_string") .. " " ) for lang, lang_table in pairs(i18n_tables) do t = t .. "\np.i18n." .. lang .. ' = { ' if type(lang_table) == "table" then for key, text in pairs(lang_table) do if key and text then t = t .. "\n:" .. key .. ' = "' .. text .. '",' end end end t = t .. "\n}\n" end return t end -- function langs.i18n_lister(t, i18n_tables)
-- - - - ------------------ - - - - --------------------------------- -- Manage translations of arguments and warnings -- Gestione traducciones de argumentos y advertencias -- Gérer les traductions des arguments et warnings -- - - - ------------------ - - - - ---------------------------------
function langs.dummy_languages() -- Test dummy languages S170614tva -- https://fr.wikipedia.org/wiki/%C3%89tiquette_d%27identification_de_langues_IETF -- https://fr.wikipedia.org/wiki/Module:Langue/Data -- pour convertir en code de langue IETF les noms français de langues -- https://www.MediaWiki.org/wiki/Manual:$wgDummyLanguageCodes -- List of language codes that have been renamed to new (correct) codes, or don't correspond to an actual interface language. -- array( 'als' => 'gsw', 'bat-smg' => 'sgs', 'be-x-old' => 'be-tarask', 'bh' => 'bho'... langs.MetaSupportedLanguages = { "ja", "es", "ru", "de", "nl", "tr", "fr", "pt", "ko", "en", "it", "oc", "pl", "fa", "ar", "vi", "arz", "hi", "sv", "diq", "pt-br", "zh", "th", "bg", "hu", "uk", "en-gb", "sh", "id", "bn", "az", "fi", "be", "he", "eo", "el", "sd", "kn", "ro", "yue", "sr", "mk", "ta", "pa", "hy", "lb", "tt", "si", "yi", "ne", "cs", "sk", "ms", "eu", "mr", "sa", "tl", "eml", -- https://meta.wikimedia.org/wiki/Special:SupportedLanguages on 20170629 Rical } -- 58 languages in total. local dummy_i18n = { "en", -- english "es", -- spanish "fr", -- french "Fr", -- error test "als", -- alemanish "gsw", -- unknown "bat-smg", -- alemanish "sgs", -- unknown } local t = '\n* langs.dummy_languages() : ' .. viewers.ta("isTag", "isKnownLanguageTag(xx)") .. viewers.ta("isLang", "isSupportedLanguage(xx)") .. viewers.ta("isBuilt", "isValidBuiltInCode(xx)") local testcases = {} local lang, fullname, langname, native, isRTL, isLang, isBuilt, space_name for i, dummy in pairs(dummy_i18n) do table.insert( testcases, { ["lang"] = mw.language.fetchLanguageName(dummy), ["isTag"] = mw.language.isKnownLanguageTag(dummy), ["contentlang"] = mw.language.getContentLanguage(dummy), ["fallbacksfor"] = mw.language.getFallbacksFor(dummy), ["supported"] = mw.language.isSupportedLanguage(dummy), ["valid"] = mw.language.isValidBuiltInCode(dummy), ["isRTL"] = mw.language:isRTL(dummy), ["isBuilt"] = mw.language.isValidBuiltInCode(dummy), ["isknown"] = mw.language.isKnownLanguageTag(dummy), ["validbuilt"] = mw.language.isValidBuiltInCode(dummy), ["validcode"] = mw.language.isValidCode(dummy), } ) end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = testcases, title_memo = "langs.dummy_languages() -- Test dummy languages", headers = "langs_dummy_languages_headers", -- language; is a tag; content; fallbacks for; supported; valid; is RTL; is known; valid built; valid code form_one_case = function(case) return { case.lang, case.isTag, case.contentlang, case.fallbacksfor, case.supported, case.valid, case.isRTL, case.isknown, case.validbuilt, case.validcode, } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. return t end -- function langs.dummy_languages()
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:lua_table enhances the support of previous table library from Lua. -- "lua_table" avoids ambiguities with other kind of tables. -- To enhance, we could write here : lua_table = table. -- see Extension:Scribunto/Lua reference manual : class nameTest extends Scribunto_LuaEngineTestBase -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - ---------------------------------
-- lua_table = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
-- The Module:Centralizer/I18N translations for lua_table library update and complete Module:Centralizer translations. lua_table.i18n = {} -- Translations for lua_table library lua_table.i18n.br = { luaTable_recursive_luaTable_title = "MediaWiki lua_table récursive", luaTable_rough_view_tests_title = "lua_table.rough_view() Test: Former un code Lua grossier d'une table", luaTable_structure_level_maxi = "Limite de niveau recursif = %1 ", luaTable_table_listlimit_max_n = "Limite de longueur max_n = %1 ", lua_table_structure_recursive_report= "lua_table.structure() Lister une table, test avec ou sans limites :", luaTable_toList_tests_title = "lua_table.to_list() Retourne une liste à partir d'une table Lua.", luaTable_toList_tests_headers = "Cas testé; Table à lister, vue brute; Liste de sortie", luaTable_toTable_tests_title = "lua_table.to_table() Test: convertir une phrase en table de mots", luatable_form_subcounts_subtables = "La table %1 compte %2 variables, %3 sous-tables, %4 fonctions.", luaTable_fromsubnames_base_err = "Erreur interne: dans langs.sub_i18n_counts(), base indisponible pour la table subnames %1.", luaTable_fromsubnames_subtable_err = "Erreur interne: dans langs.sub_i18n_counts(), %1 n'est pas une sous-table dans subnames %2.", luaTable_form_sub_counts_type_err = "Un %1 remplace la table : %2.", -- luaTable_fromsubnames_missing_err = "Erreur interne : in lua_table.form_sub_counts() La recherche de cette sous-table %1 n'a trouvé que celle-ci %2.", obsolete luaTable_fromsubnames_tests_headers = "Sous-nom; Table de base; Taille de la table; Entrée lua_table.rough_view", luaTable_table_dont_exists_err = "La table %1 n'existe pas.", luaTable_table_args_source_title = "lua_table.structure() Table des arguments reçus, args_source :", } -- lua_table.i18n.br lua_table.i18n.de = { luaTable_recursive_luaTable_title = "MediaWiki lua_table rekursive", luaTable_rough_view_tests_title = "lua_table.rough_view() Test: Bilden Sie einen groben Lua-Code aus einer Tabelle", luaTable_structure_level_maxi = "Rekursives Level-Limit = %1 ", luaTable_table_listlimit_max_n = "Längenbegrenzung max_n = %1 ", lua_table_structure_recursive_report= "lua_table.structure() Listen Sie eine Tabelle auf, testen Sie mit oder ohne Grenzen:", luaTable_toList_tests_title = "lua_table.to_list() Gibt eine Liste aus einer Lua-Tabelle zurück.", luaTable_toList_tests_headers = "Fall getestet; Tabelle zu Liste, grobe Ansicht; Freigabeliste", luaTable_toTable_tests_title = "lua_table.to_table() Test: Konvertiere einen Satz in eine Worttabelle", luatable_form_subcounts_subtables = "Die Tabelle %1 zählt %2 Variablen, %3 Untertabellen, %4 Funktionen.", luaTable_fromsubnames_base_err = "Interner Fehler: in langs.sub_i18n_counts(), Basis für die Tabelle der Unternamen nicht verfügbar %1.", luaTable_fromsubnames_subtable_err = "Interner Fehler: In langs.sub_i18n_counts(), ist %1 keine Untertabelle in Unternamen %2.", luaTable_fromsubnames_subtable_err = "Interner Fehler: In langs.sub_i18n_counts(), %1 ist keine Untertabelle in Unternamen %2.", luaTable_form_sub_counts_type_err = "Ein %1 ersetzt die Tabelle: %2.", luaTable_fromsubnames_tests_headers = "Teilname; Basistabelle; Größe des Tisches; Eintrag lua_table.rough_view", luaTable_table_dont_exists_err = "Tabelle %1 existiert nicht.", luaTable_table_args_source_title = "lua_table.structure() Tabelle der Argumente erhaltenTabelle der Argumente erhalten, args_source:", } -- lua_table.i18n.de lua_table.i18n.en = { luaTable_recursive_luaTable_title = "MediaWiki recursive lua_table", luaTable_rough_view_tests_title = "lua_table.rough_view() Test: Formats a rough Lua code of a table", luaTable_structure_level_maxi = "Recursive level limit = %1 ", luaTable_table_listlimit_max_n = "Length limit max_n = %1 ", lua_table_structure_recursive_report= "lua_table.structure() List a table, test with or without limits:", luaTable_toList_tests_title = "lua_table.to_list() Return a list from a Lua table.", luaTable_toList_tests_headers = "Tested case; Input table, rough_view; Output list", luaTable_toTable_tests_title = "lua_table.to_table() Test: convert a string to a table of words", luatable_form_subcounts_subtables = "The table %1 counts %2 values, %3 sub-tables and %4 functions.", luaTable_fromsubnames_base_err = "Internal error: in langs.sub_i18n_counts(), base unavailable for the subnames table %1.", luaTable_fromsubnames_subtable_err = "Internal error: in langs.sub_i18n_counts(), %1 is not a sub-table in subnames %2.", luaTable_form_sub_counts_type_err = "A %1 replaces the table: %2.", -- luaTable_fromsubnames_missing_err = "Internal error: in lua_table.form_sub_counts() The search for this sub-table %1 found only this one %2.", obsolete luaTable_fromsubnames_tests_headers = "Sub name; Base table; Table count; Input lua_table.rough_view", luaTable_table_dont_exists_err = "The table %1 does not exist.", luaTable_table_args_source_title = "lua_table.structure() Table of received arguments, args_source:", } -- lua_table.i18n.en lua_table.i18n.es = { luaTable_recursive_luaTable_title = "MediaWiki lua_table recursiva", luaTable_rough_view_tests_title = "lua_table.rough_view() Prueba: Formar un código de Lua grueso de una tabla", luaTable_structure_level_maxi = "Límite de nivel recursivo = %1 ", luaTable_table_listlimit_max_n = "Límite de longitud max_n = %1 ", lua_table_structure_recursive_report= "lua_table.structure() Enumerar una tabla, prueba con o sin límites:", luaTable_toList_tests_title = "lua_table.to_list() Devolver una lista de una tabla Lua.", luaTable_toList_tests_headers = "Probados casos; Tabla a listar, ver prima; lista de salida", luaTable_toTable_tests_title = "Prueba: convertir una cadena en una tabla de palabras", luatable_form_subcounts_subtables = "La tabla %1 cuenta %2 valores, %3 sub-tablas y %4 funciones.", luaTable_fromsubnames_base_err = "Error interno: en langs.sub_i18n_counts(), base no disponible para la tabla subnames %1.", luaTable_fromsubnames_subtable_err = "Error interno: en langs.sub_i18n_counts(), %1 no es una sub-tabla en subnames %2.", luaTable_form_sub_counts_type_err = "Un %1 reemplaza la tabla: %2.", -- luaTable_fromsubnames_missing_err = "Error interno: in lua_table.form_sub_counts() La búsqueda de este subtabla %1 encontró que %2.", obsolete luaTable_fromsubnames_tests_headers = "Sub nombre; Mesa base; Tamaño de la mesa; lua_table.rough_view de entrada", luaTable_table_dont_exists_err = "La tabla %1 no existe.", luaTable_table_args_source_title = "lua_table.structure() Tabla de argumentos recibido, args_source:", } -- lua_table.i18n.es lua_table.i18n.fr = { luaTable_recursive_luaTable_title = "MediaWiki lua_table récursive", luaTable_rough_view_tests_title = "lua_table.rough_view() Test: Former un code Lua grossier d'une table", luaTable_structure_level_maxi = "Limite de niveau recursif = %1 ", luaTable_table_listlimit_max_n = "Limite de longueur max_n = %1 ", lua_table_structure_recursive_report= "lua_table.structure() Lister une table, test avec ou sans limites :", luaTable_toList_tests_title = "lua_table.to_list() Retourne une liste à partir d'une table Lua.", luaTable_toList_tests_headers = "Cas testé; Table à lister, vue brute; Liste de sortie", luaTable_toTable_tests_title = "lua_table.to_table() Test: convertir une phrase en table de mots", luatable_form_subcounts_subtables = "La table %1 compte %2 variables, %3 sous-tables, %4 fonctions.", luaTable_fromsubnames_base_err = "Erreur interne: dans langs.sub_i18n_counts(), base indisponible pour la table subnames %1.", luaTable_fromsubnames_subtable_err = "Erreur interne: dans langs.sub_i18n_counts(), %1 n'est pas une sous-table dans subnames %2.", luaTable_form_sub_counts_type_err = "Un %1 remplace la table : %2.", -- luaTable_fromsubnames_missing_err = "Erreur interne : in lua_table.form_sub_counts() La recherche de cette sous-table %1 n'a trouvé que celle-ci %2.", obsolete luaTable_fromsubnames_tests_headers = "Sous-nom; Table de base; Taille de la table; Entrée lua_table.rough_view", luaTable_table_dont_exists_err = "La table %1 n'existe pas.", luaTable_table_args_source_title = "lua_table.structure() Table des arguments reçus, args_source :", } -- lua_table.i18n.fr
function lua_table.from_subnames_object(sub_names, base_table) -- Get the last sub-object from its sub-names, but not a table. local sub_obj = nil if (type(base_table) ~= "table")then base_table = package.loaded end local sub_names = mw.text.split(sub_names, '%.') -- table of words local sub_tab, sub_obj = base_table, nil for i, sub_name in ipairs(sub_names) do sub_obj = sub_tab[sub_name] if (type(sub_obj) == "table") -- the search continue in sub tables and cannot search a table then sub_tab = sub_obj else break end -- get the last object which is not a table end return sub_obj end
function lua_table.from_subnames_table(sub_names, base_table) -- Get the last sub-table from its sub-names. -- S170625ste sub_tab is bad, but it run if (type(base_table) ~= "table")then base_table = package.loaded end local sub_names = mw.text.split(sub_names, '%.') -- table of words local sub_tab = base_table for i, sub_name in ipairs(sub_names) do if (type(sub_tab) == "table") and (type(sub_tab[sub_name]) == "table") then sub_tab = sub_tab[sub_name] else sub_tab = nil end end return sub_tab end
function lua_table.named_sub_counts(subnames_in, base_table) -- Count all objects of all types in all levels, in the sub-tables from their sub-names. local t = "\n* lua_table.named_sub_counts() Count all objects of all types in all levels" if (type(subnames_in) ~= "string") then subnames_in = "." end -- Default base_table for libraries and modules. local base_table = base_table -- Do not disturb other processes through an external pointer. if (type(base_table) ~= "table") then base_table = package.loaded end -- luaTable_fromsubnames_base_err = "Internal error: in langs.sub_i18n_counts(), base unavailable for the subnames table %1.", local subnames, k = "", "" local count, pre_count, errs = 0, 0, ", errs: " local subnames_tab = mw.text.split(subnames_in, '.', true) local subnames_1 = subnames_tab[1] -- Default base_table for not loaded libraries. if (type(base_table) ~= "table") and (type(subnames_1) == "string") and (type(_G[subnames_1]) == "table") then base_table = _G end local sub_table, object_loaded = base_table, sub_table local obj_typ, count, pre_count = "string", 0, 0 local counts, all_counts = {}, {} local pre_counts = nil local functions_c, numbers_c, strings_c, tables_c, last_count, all_strings, sub_tables_count = 0, 0, 0, 0, 0, 0, 0, 0 local isi18n, endi18n, to_break = false, false local max_string_count, max_tables_count, missing_trans = 0, 0, 0, 0 local loop = 1 for i, partname in pairs(subnames_tab) do loop = loop + 1 subnames = subnames .. "." .. partname object_loaded = sub_table[partname] obj_typ = type(object_loaded) all_strings = 0 functions_c, numbers_c, strings_c, tables_c, sub_tables_count = 0, 0, 0, 0, 0 endi18n = string.sub(subnames, -4, -1) -- Is this an i18n table? isi18n = (endi18n == "i18n") -- Is this an i18n table? if (type(object_loaded) == "table") then -- Count languages tables. if isi18n then -- Count languages tables. for key, val in pairs(object_loaded) do if (type(val) == "table") then tables_c = tables_c + 1 end loop = loop + 1 if loop > 99 then break end end sub_tables_count = 0 for key, val in pairs(object_loaded) do if (type(val) == "table") then sub_tables_count = sub_tables_count + 1 all_strings = all_strings + lua_table.count_all(val) end end else -- Count translations in this table. for key, val in pairs(object_loaded) do if (type(val) == "string") then strings_c = strings_c + 1 if strings_c > max_string_count then max_string_count = strings_c end elseif (type(val) == "number") then numbers_c = numbers_c + 1 elseif (type(val) == "function") then functions_c = functions_c + 1 end loop = loop + 1 if loop > 99 then break end end end -- local strs_on_tabs = all_strings / tables_c, ["subnames"] = subnames, obj = object_loaded, typ = obj_typ, local strs_on_tabs = math.floor( (all_strings + 0.49) / math.min(sub_tables_count, 1) ) -- 1/1 = 1.4/1 = 1 3/3 = 3.4/3 = 1.13 = 1 10/2 = 10.5/2 = 5.25 = 5 counts = { ["i"] = i, ["partname"] = partname, ["subnames"] = subnames, ["object_loaded"] = object_loaded, ["obj_typ"] = obj_typ, ["isi18n"] = isi18n, ["endi18n"] = endi18n, ["tables_c"] = tables_c, ["strings_c"] = strings_c, ["numbers_c"] = numbers_c, ["functions_c"] = functions_c, ["booleans_c"] = booleans_c, ["all_strings"] = all_strings, ["max_string_count"] = max_string_count, ["pre_counts"] = pre_counts, ["all_counts"] = all_counts, -- details: ["strs_on_tabs"] = strs_on_tabs, ["missing_trans"] = missing_trans, -- special langs, remove here ["sub_tables_count"] = sub_tables_count, -- special langs, remove here, obsolete, replaced by pre_counts ["to_break"] = to_break, ["loop"] = loop, -- internal, anticrash and tests only } table.insert(all_counts, counts) -- Build a table with translations counts. if (type(pre_counts) == "table") and (type(counts) == "table") then counts.pre_counts = pre_counts pre_counts.post_counts = counts end pre_counts = counts counts.tt = viewers.form9user( "\n* counts: %1, %2, %3, %4, %5, %6.", counts.i, counts.partname, counts.endi18n, counts.strings_c, counts.tables_c, counts.all_strings) if loop > 99 then break end end t = t .. (counts.tt or "counts.tt") end local strs_on_tabs = math.floor( (strings_c + 0.49999) / math.min(tables_c, 1) ) counts.t = t return strings_c, tables_c, strs_on_tabs, subnames, counts, all_counts, counts.t -- local strings_c, tables_c, strs_on_tabs, subnames, counts, all_counts, t = lua_table.named_sub_counts(subnames_in, base_table) end -- function lua_table.named_sub_counts(subnames_in, base_table)
function lua_table.count_all(tab) -- Count all objects in the table. local count = 0 for key, elem in pairs(tab or {}) do count = count + 1 end return count end
function lua_table.count_types(tab) -- Count in the table, for each type, the number of objects of the this type. local types_counts = {} -- S170620csc for key, obj in pairs(tab or {}) do types_counts[type(obj)] = (types_counts[type(obj)] or 0) + 1 end return types_counts end
function lua_table.count_values(tab) -- Count in the table, for each value, the number of objects of the this value. local values_counts = {} for key, obj in pairs(tab or {}) do values_counts[obj] = (values_counts[obj] or 0) + 1 end return values_counts end
function lua_table.counts(obj, opt) -- Reports the parameterizable object accounts in a table local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.counts(obj, opt) : Reports the parameterizable object accounts in a table' end t = t .. viewers.ta("count_done", count_done) .. viewers.ta("count_now", count_now) .. viewers.ta("count_later", count_later) local counts_fields = { -- define counts : caracterize available counts where_to_count = { "string table numbers function", }, -- Detect object type to count. Convert from function. where_to_count = { "tostring totable tonumbers", }, -- Convert asked totable() or tostring() or tonumber() which_part = { "coli coln colname rowi rown rowname", }, -- in which object part to count : column i, named row what_to_count = { "column_i column_n row_i row_n word_i word_n group_i group_n", }, -- count in the column_i. count column_n = the number of columns how_to_count = { "group_i group_n", }, -- group_i = number of objects in which_part how_to_sort = { "nosort 0to9 9to0 atoz ztoa", }, -- sort or no, in alpha or digital, increasing decreasing or none example_1 = { opt = "tostring ztoa", }, -- Count words in a string. Sort in reverse order. example_3 = { opt = "totable column_n", }, -- Convert to table or insure that. Count the number of columns. example_2 = { opt = "totable colname group_n 9to0", }, -- Convert to table. Count in column colname. Count in each group_n of values. Sort decreasing. } return count, t -- count can be a number, a list, a simple table, an array table of counts end -- count, t = lua_table.counts(obj, opt) -- Counts in object types
function lua_table.to_list(tab, ...) -- Return a list from any Lua table. -- This function is the reverse of func( ... ) if (type(tab) ~= "table") then tab = {} end local tab = mw.clone(tab) -- to not disturb original table local maxn = lua_table.count_all(tab) local function tabN_to_list1(tab, n, ...) local max_tab = lua_table.count_all(tab) local listab = {...} local max_list = lua_table.count_all(listab) local tab_last = tab[n] -- last element, even a table to not delete below local tab_last_string = type(tab_last) -- tostring(tab_last) if (type(tab_last) ~= "nil") and (n <= max_tab) then if (type(tab) == "table") then return tab_last, tabN_to_list1(tab, n + 1, ...) else tab_last = tostring(tab_last) end else return end end return tabN_to_list1(tab, 1, ...) end -- function lua_table.to_list(tab, ...)
function lua_table.to_list_tests(t) -- Tests the return of a list from a Lua table. local memo = viewers.save_configs("lua_table.to_list_tests") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.to_list_tests(t) : Tests the return of a list from a Lua table' end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = { { "Simple table", { 123, "abc", key = "txt" }, }, { "All types transmited", { "name", 111, true, false, { 789, "xyz"}, function()end }, }, { "10 values in the table", { "a", "b", "c", "d", "e", "f", "g", "h", "i9", "j10" }, }, { "Any number of values", { "a", "b", "c", "d", "e", "f", "g", "h", "i09", "j10", "a", "b", "c", "d", "e", "f", "g", "h", "i19", "j20", "a", "b", "c", "d", "e", "f", "g", "h", "i29", "j30", "a", "b", "c", "d", "e", "f", "g", "h", "i39", "j40", "a", "b", "c", "d", "e", "f", "g", "h", "i49", "j50", "a", "b", "c", "d", "e", "f", "g", "h", "i59", "j60" }, }, }, title_memo = "luaTable_toList_tests_title", -- "lua_table.to_list() Return a list from a Lua table.", headers = "luaTable_toList_tests_headers", -- "Tested case; Input table, rough_view; Output list", headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup. local descript = case[1] local tabview = lua_table.rough_view( case[2] ) local tab_list = { lua_table.to_list( case[2] ) } local t1 = "" for i, elem in ipairs(tab_list) do t1 = t1 .. viewers.ta( "[" .. i .. "]", tostring(elem) ) end return { descript, tabview, t1, } end local t = tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "lua_table.to_list_tests") -- Restore global configurations after eventual changes. return t --, errors -- langs_missing_translations_title end -- function lua_table.to_list_tests(t)
function lua_table.to_table(stringList, pattern, plain) -- convert a string to a table of words if type(stringList) ~= "string" then stringList = "" end if type(pattern) ~= "string" then pattern = "" end if plain then plain = true else plain = false end local tab = mw.text.split(stringList, pattern, plain) local tab2 = {} for i, word in ipairs(tab) do -- for all names word = mw.text.trim(word) -- clean spaces in each name tab2[word] = word -- not table.insert(tab2, name) end return tab2 end
function lua_table.to_table_test(t) -- Tests the conversion of a string to a table of words local memo = viewers.save_configs("lua_table.to_table_test") -- Save global configuration before eventual changes. local stringList = "" local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.to_table_test(t) : Tests the conversion of a string to a table of words' end local tab_view = { -- Group datas and options for a table view with lines and columns. test_group = { { stringList = "docview nocatview : tests docline", pattern = nil, }, { stringList = "docview nocatview : tests docline", pattern = " ", plain = nil, }, { stringList = "docview,nocatview, : ,tests docline", pattern = ",", plain = true, }, { stringList = "docview docline : tests", pattern = " ", plain = true, }, { stringList = "docview; nocatview; : tests; docline", pattern = ";", plain = false, }, { stringList = "abc ; ; def.;ghi;,jkl", pattern = ";", }, }, headers = "langs_selectLang_test_headers", -- "stringList; pattern; plain; result" headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup. local tab = lua_table.to_table(case.stringList, case.pattern, case.plain) local t1 = "" for key, elem in pairs(tab) do t1 = t1 .. viewers.ta("[" .. viewers.value(key) .. "]", elem) end return { case.stringList, case.pattern, case.plain, t1, } end t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "lua_table.to_table_test") -- Restore global configurations after eventual changes. return t end -- function lua_table.to_table_test(t)
function lua_table.old_to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed. "20180307", "NOW", "Rical", "S180810lts", "new function local opt = opt or {} if (type(tab) ~= "table") then tab = {} end if (type(sortfield) ~= "string") then sortfield = "" end if (type(sortorder) ~= "string") then sortorder = "" end local sorted, i = {}, 0 for key, elem in pairs(tab) do i = i + 1 table.insert(sorted, elem) end return sorted end -- local sorted = lua_table.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed.
function lua_table.to_sort_tests(t) -- Sorts any table and convert it in sequence if needed. local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.to_sort_tests(t) : Sorts any table and convert it in sequence if needed' end local opt = opt or {} local sorted = lua_table.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed. local sorted, i = {}, 0 for key, elem in pairs(tab) do i = i + 1 elem[sortfield] = i table.insert(sorted, elem) end t = t .. "\n* " .. viewers.ta("tab count", lua_table.level_count(tab) ) t = t .. "\n* " .. viewers.ta("sorted count", lua_table.level_count(sorted) ) return t end -- local sorted = lua_table.to_sort(tab, sortfield, sortorder) -- To sort any table and convert in sequence if needed.
-- local tot_vars, tot_tabs, tot_func, vr_tb = lua_table.sub_counts(tablebase, tabname, opt, recursiveLevel) function lua_table.sub_counts(tablebase, tabname, opt, recursiveLevel) -- In a table, recursive counts of vars, sub-tables and functions. local opt = opt or {} opt.recursiveLevel = recursiveLevel or opt.recursiveLevel opt.recursiveLevel, opt.recursive_limit, opt.recursiveLevel_err = modes.recursive_normal(opt.recursiveLevel, modes.recursive_limit) local isempty = true local tot_vars, tot_tabs, tot_func = opt.tot_vars or 0, opt.tot_tabs or 0, opt.tot_func or 0 -- lua_table.sub_counts(get.i18n, get.pagename) -- : attempt to index local 'opt' (a nil value). local nbr_vars, nbr_tabs, nbr_func = 0, 0, 0 local txt, vr, tb, fn, vrtb, vr_tb = "", 0, 0, 0, 0, 0 local case = "" if (type(tablebase) == "table") and (type(tabname) == "string") then -- for any tables -- normal case OK, do nothing case = " tab+name" elseif (type(tablebase) == "table") and (type(tabname) ~= "string") then -- for abnormal or missing tabname tabname = "tabname=" .. tostring(tablebase) .. "?" tabname = viewers.styles_color_error(tabname) case = " tab+noname" elseif (type(tablebase) ~= "table") and (type(tabname) == "string") then -- for abnormal table tabname = "tabname=" .. tostring(tabname) .. "?" tabname = viewers.styles_color_error(tabname) case = " notab+name" elseif type(tablebase) == "string" then -- for viewers.tables tabname = "package.loaded." .. tablebase case = " tab=name" else tabname = "tabname=" .. tostring(tablebase) .. "?" tabname = viewers.styles_color_error(tabname) case = " notab+noname" end if (type(tablebase) == "table") and (type(tabname) == "string") then -- for normal cases for key, var in pairs(tablebase) do -- List and count vars, functions and sub tables local sub_tabname = tostring(key) if type(var) == "table" then local sub_tablebase = var nbr_tabs = nbr_tabs + 1 if (opt.recursiveLevel < opt.recursive_limit) then -- if (opt.recursiveLevel > 0) and (opt.recursiveLevel < opt.recursive_limit) then -- vr, tb, fn, vrtb, opt.recursiveLevel = lua_table.sub_counts(var, tabname, opt) opt.recursiveLevel = opt.recursiveLevel + 111 vr, tb, fn, vrtb = lua_table.sub_counts(sub_tablebase, sub_tabname, opt, opt.recursiveLevel) tot_vars = tot_vars + vr tot_tabs = tot_tabs + tb + 1 tot_func = tot_func + fn end elseif type(var) == "function" then nbr_func = nbr_func + 1 tot_func = tot_func + 1 isempty = false else -- type(var) == other nbr_vars = nbr_vars + 1 tot_vars = tot_vars + 1 isempty = false end end end local vr_tb = 0 if tot_tabs == 0 then vr_tb = tot_vars -- string number in all languages else -- How many translations in each language? Approximative if not equal. vr_tb = tot_vars / tot_tabs -- string number in one language, like + 33.49 vr_tb = math.floor( vr_tb ) -- digital string number in each language end opt.tot_vars = tot_vars -- total number of variables in the table opt.tot_tabs = tot_tabs -- total number of sub-tables in the table opt.tot_func = tot_func -- total number of functions in the table opt.vr_tb = vr_tb -- digital string number in each language return tot_vars, tot_tabs, tot_func, vr_tb -- , opt.recursiveLevel end -- local tot_vars, tot_tabs, tot_func, vr_tb = lua_table.sub_counts(tablebase, tabname, opt, recursiveLevel)
function lua_table.level_count(tab) -- Count all objects in the table, or 0 if tab is not a table. local count = 0 if (type(tab) ~= "table") then return count end for k,v in pairs(tab) do count = count + 1 end return count end -- c = lua_table.level_count(tab)
function lua_table.count(t, n) return viewers.ta(t, lua_table.level_count(n)) end -- Is a Syntactic sugar for lua_table.level_count(tab) -- Count all objects or 0.
function lua_table.level_get(tab, typ) -- Get only the first level of the table. Get only one key type if asked. local level = {} local count = 0 if (type(tab) ~= "table") then return level, count end for key, val in pairs(tab) do if (type(typ) == "string") and (type(val) == typ) then level[key] = val ; count = count + 1 else level[key] = val ; count = count + 1 end end return level, count end -- function lua_table.level_get(tab, typ)
function lua_table.level_list(tab, typ, select, field) -- Collect and count selected or all keys, in the first level of the table -- subtasks S170813lll -- typ = "key;val;keys;vals;sort;boolean;function;number;string;table;" -- Get only the first level of the table. Select only keys containing select. Select the field as key if defined. -- Collects and counts the selected keys, or all, in recording order -- Count the key of the typ type local list, count, level, split, ok = "", 0, {}, {}, false local sort, keyval = typ, "" if (type(tab) ~= "table") then return list, count, level, split end for key, val in pairs(tab) do table.insert(level, val) ok = false if (typ == "key") then -- Count and list keys from select and field. sort, keyval = false, key if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ == "val") then -- Count and list values... sort, keyval = false, val if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ == "keys") then -- Count and sort keys... sort, keyval = true, key if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ == "vals") then -- Count and sort values... sort, keyval = true, val if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ == "sort") then -- Sort all values... sort, keyval = true, tab[field or 1] if viewers.is_in( tostring(keyval), tostring(select) ) then ok = true end -- Select a value if the val is in select. else -- lua_table.count_values() local typ2 = type(typ) -- To select a type or the type of a variable. if (typ2 == "boolean") or (typ == "boolean") then -- Count only these types. if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ2 == "function") or (typ == "function") then if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ2 == "number") or (typ == "number") then if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ2 == "string") or (typ == "string") then if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. elseif (typ2 == "table") or (typ == "table") then if viewers.is_in(keyval, select) then ok = true end -- Select a value if the val is in select. end end if ok then table.insert(split, keyval) -- Collect the selected keys, or all, in recording order count = count + 1 -- Count the key of the typ type list = list .. tostring(keyval) .. ", " -- List values end end if (sort == "sort") or (sort == true) then table.sort( split ) end -- in alphabetic order -- , function (a, b) end list = table.concat(split, ", ") return list, count, level, split end -- local list, count, level, split = lua_table.level_list(tab, typ, select, field) lua_table.level_list_tests(
function lua_table.count_tests(t) -- Tests the accounts of certain types of objects in a table or lists them for a level local memo = viewers.save_configs("lua_table.count_tests") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.to_sort_tests(t) : Tests the accounts of certain types of objects in a table or lists them for a level' end local test_table = { "name", 111, "other", function() return 2 end, true, false, { 789, "xyz"}, function() return 1 end } local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "lua_table.count_tests", -- "lua_table.count_values() Count all objects or types or values in the table.", test_group = { { "count_all", { "name", 111, "other", function() end, true, false, { 33 }, function() end }, }, { "count_types", { "name", 111, "other", function() end, true, false, { 33 }, function() end }, }, { "count_values", { "name", 111, "other", function() end, true, false, { 33 }, function() end }, }, { "count_all", { a = "abc", 11, z = "xyz", t = true, false, n = nil, min = 11, 33, nil, 33, max = 55, "abc", }, }, { "count_types", { a = "abc", 11, z = "xyz", t = true, false, n = nil, min = 11, 33, nil, 33, max = 55, "abc", }, }, { "count_values", { "abc", 11, "xyz", true, false, nil, 11, 33, nil, 33, 55, "abc", }, }, { "level_list", { "abc", 11, "xyz", true, false, nil, 11, 33, nil, 33, 55, "abc", }, "key", "3", }, { "level_list", { "abc", 11, "xyz", true, false, nil, 11, 33, nil, 33, 55, "abc", }, "val", "3", }, { "level_list", { "abc", 11, "xyz", true, false, nil, 11, 33, nil, 33, 55, "abc", }, "keys", "3", }, { "level_list", { "abc", "bcd", "xyz", "bcbc", nil, 11, 33, nil, 33, 55, "abc", }, "vals", "bc", }, { "level_list", { "name", 111, "other", function() end, true, false, { 33 }, function() end }, "sort", }, -- local list, count, level, split = lua_table.level_list(tab, typ, select, field) -- typ = "key;val;keys;vals;sort;boolean;function;number;string;table;" { "level_list", { "abc", "bcd", "xyz", "bcbc", nil, 11, 33, nil, 33, 55, "abc", }, "boolean", "bc", }, { "level_list", { "abc", "bcd", "xyz", "bcbc", nil, 11, 33, nil, 33, 55, "abc", }, "function", "bc", }, { "level_list", { "abc", "bcd", "xyz", "bcbc", nil, 11, 33, nil, 33, 55, "abc", }, "number", "bc", }, { "level_list", { "abc", "bcd", "xyz", "bcbc", nil, 11, 33, nil, 33, 55, "abc", }, "string", "bc", }, { "level_list", { "abc", { "bcbc", nil }, "bcd", "xyz", { "tab1", "tab2" }, "abc", }, "table", "bc", }, { "level_list", "abcdefg", "table", "bc", }, { "level_list", 12345, "table", "bc", }, }, headers = "luaTables_count_all_types_values_headers", -- "Tested case; Input table, rough_view; Output list", headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup RIC05900470 local func_name = case[1] local test_table = case[2] local count_kind = case[3] if (type(test_table) ~= "table") then test_table = { test_table } end -- if (type(func_name) ~= "string") then test_table = { test_table } end local values_counts = lua_table[func_name](test_table) -- Select the function to test if (type(values_counts) ~= "table") then values_counts = { values_counts } end local tests_view = "" for key, val in pairs(test_table) do val = tostring(val) tests_view = tests_view .. viewers.ta(key, val) end local counts_view = "" for key, val in pairs(values_counts) do val = tostring(val) counts_view = counts_view .. viewers.ta(key, val) end return { tests_view, func_name, count_kind, counts_view } end t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "lua_table.count_tests") -- Restore global configurations after eventual changes. return t end -- function lua_table.count_tests(t)
-- opt = { dropit.dropit = "dropit", level_maxi = 3, max_n = 2, exclude1 = "hou" } ) -- example of use , {width = "88%", tc1 = "blue"} function lua_table.normal_options(opt, recursiveLevel, recursive_limit) -- Normalize lua_table options. if type(opt) ~= "table" then opt = {} end if type(opt.level_maxi) ~= "number" then opt.level_maxi = 111 end if type(opt.max_n) ~= "number" then opt.max_n = 9999 end opt.max_n = opt.max_n or 9999 opt.recursiveLevel = recursiveLevel or opt.recursiveLevel or 1 opt.recursive_limit = recursive_limit or opt.recursiveLevel or 111 opt.exclude1 = opt.exclude1 or "" opt.exclude2 = opt.exclude2 or "" opt.exclude3 = opt.exclude3 or "" opt.countonly = opt.countonly and true return opt end
function lua_table.rough_view(table, option, level) -- Formats a string to describe a value like: true, 123.456, "abcd", func(), table{} if type(table) ~= "table" then return viewers.value(table) end local opt = option if type(opt) ~= "table" then opt = {} end opt.level = (opt.level or 1) opt.recursive_limit = tonumber(opt.recursive_limit) or 11111 if type(level) == "number" then opt.recursive_limit = level end opt.max_n = tonumber(opt.max_n) or 11111 local shift = "\n" .. string.rep(":", opt.level) local t = "" local n = 0 local continue = true if opt.level > opt.recursive_limit then -- Limit the number of levels of sub-tables to opt.recursive_limit local col = viewers.styles_color_warning( viewers.form9user( '%1 = %2', "recursive_limit", opt.recursive_limit) ) t = t .. viewers.form9user( '{ %1 }', col ) else shift = "\n" .. string.rep(":", opt.level) for k, v in pairs(table) do n = n + 1 if n > opt.max_n then -- Limit the number of elements in each-subtable to opt.max_n. local col = viewers.styles_color_warning( viewers.form9user( '%1 = %2', "max_n", opt.max_n ) ) continue = false end if continue then if (type(k) == "string") then t = t .. viewers.form9user( '["%1"] = %2, ', k, tostring(v), shift ) else t = t .. viewers.form9user( '[%1] = %2, ', tostring(k), tostring(v), shift ) end end end for k, v in pairs(table) do n = n + 1 if n > opt.max_n then local col = viewers.styles_color_warning( viewers.form9user( '%1 = %2', "max_n", opt.max_n ) ) continue = false end if continue then -- Do not list if exclude1, exclude2 or exclude3 are in the table name. if (type(v) == "table") and (k ~= opt.exclude1) and (k ~= opt.exclude2) and (k ~= opt.exclude3) then opt.level = (opt.level or 1) + 1 shift = "\n" .. string.rep(":", opt.level) local tt = lua_table.rough_view(v, opt) opt.level = (opt.level or 1) - 1 shift = "\n" .. string.rep(":", opt.level) t = t .. viewers.form9user( '%3 ["%1"] = %2 ', k, tt, shift ) elseif (type(v) == "function") then t = t .. viewers.form9user( '%3 ["%1"] = %2() ', k, "function", shift ) elseif (type(v) == "nil") then t = t .. viewers.form9user( '%3 %1 = %2() ', k, "nil", shift ) end end end end t = "{ " .. t .. " }" return t end -- t = lua_table.rough_view(table) -- Formats a string to describe a value like: true, 123.456, "abcd", func(), table{}
function lua_table.rough_view_test(t) -- Tests formats of a string to describe a value like: true, 123.456, "abcd", func(), table{} local memo = viewers.save_configs("lua_table.rough_view_test") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.rough_view_test(t) : Tests formats of a string to describe a value like: true, 123.456, "abcd", func(), table{}' end local table_key = { "A table used as key.", key = "string", bar = "bartxt", } local table_value = { "A table used as value is expended in the main table.", abc = "ABC", [5] = "five", ghi = "JKL", } local tae_val = "A table used as value is expended in the main table." local function funcView() return "A function result in this string." end local test_table = { key = "string", "string one without key", [12] = "number key twelve", ["12"] = "string key twelve in brace", sub_table = { [4] = "four", abc = "ABC", [5] = "five", ghi = "JKL", }, func = funcView(), "string two without key", [tonumber] = "A function used as key.", [true] = "A Lua reserved value used as key.", } local t = t .. lua_table.rough_view(test_table) viewers.restore_configs(memo, "lua_table.rough_view_test") -- Restore global configurations after eventual changes. return t end -- function lua_table.rough_view_test(t)
function lua_table.sort_onkey(tab, key) -- Sort a table with any types of keys. local key = key or "keyword" return table.sort(tab, function (a, b) if (type(a[key]) == type(b[key])) then return ( a[key] < b[key] ) -- any translated arguments of same types else return ( tostring(a[key]) < tostring(b[key]) ) end -- alphabetic sort of translated arguments end ) end
function lua_table.sort_types(tab, key, decrease) -- Sort a table, with any types of fields, even of differents types as strings. if (type(tab) ~= "table") then return tab end if (type(key) ~= "string") then key = "keyword" end if decrease == ">" then -- sort in decreasing order table.sort(tab, function (a, b) if ( type(a[key]) == type(b[key]) ) then return ( a[key] > b[key] ) -- Sort same types else return (tostring(a[key]) > tostring(b[key]) ) end -- Sort differents types as strings end ) else -- sort in increasing order table.sort(tab, function (a, b) if ( type(a[key]) == type(b[key]) ) then return ( a[key] < b[key] ) -- Sort same types else return (tostring(a[key]) < tostring(b[key]) ) end -- Sort differents types as strings end ) end end -- function lua_table.sort_types(tab, key, decrease)
function lua_table.structure_recursive(tbl, uppername, name, recursiveLevel, opt) -- countonly, level_maxi, max_n, exclude1, exclude2, exclude3)
if type(tbl) ~= "table" then tbl = {} end
if type(uppername) ~= "string" then name = "uppername" end
if type(name) ~= "string" then name = "table" end
local res, newname, part, shift = "", "", "", ""
local sep, N = ", ", 0
local isempty = true
local levelname = uppername .. "." .. name
local tot_vars, tot_func, tot_tabs = 0, 0, 0
local nbr_vars, lst_vars = 0, ""
local nbr_func, lst_func = 0, ""
local nbr_tabs, lst_tabs = 0, ""
local max, lst_subtabs = 0, ""
local st, vr, fn, tb = "", 0, 0, 0
local list = not opt.countonly
if recursiveLevel > opt.level_maxi then -- limit the number of the level of sub-tables
local t_levelmaxi = viewers.form9user("luaTable_structure_level_maxi", recursiveLevel)
return viewers.styles_color_warning( tostring(t_levelmaxi ) ), tot_vars, tot_func, tot_tabs
end
opt.max_n = tonumber(opt.max_n) or 11111
shift = string.rep("*", recursiveLevel)
-- Do not list if exclude1, exclude2 or exclude3 is in the table name.
if type(opt.exclude1) == "string" and opt.exclude1 ~= "" and string.find(name, opt.exclude1) ~= nil
then return "", tot_vars, tot_func, tot_tabs end
if type(opt.exclude2) == "string" and opt.exclude2 ~= "" and string.find(name, opt.exclude2) ~= nil
then return "", tot_vars, tot_func, tot_tabs end
if type(opt.exclude3) == "string" and opt.exclude3 ~= "" and string.find(name, opt.exclude3) ~= nil
then return "", tot_vars, tot_func, tot_tabs end
if type(tbl) ~= "table" then -- display table error
return '
The variable "' .. tostring(name) .. '" is not a table.
', tot_vars, tot_func, tot_tabs
end
for k, v in pairs(tbl) do -- List and count vars, functions and sub tables
k = tostring(k)
if type(v) == "table" then
lst_tabs = lst_tabs .. k .. sep
nbr_tabs = nbr_tabs + 1
isempty = false
newname = tostring(k)
max = max + 1
if recursiveLevel <= opt.level_maxi then -- List recursively each sub-table
st, vr, fn, tb = lua_table.structure_recursive(v, levelname, newname, recursiveLevel + 1, opt) -- countonly, level_maxi, max_n, exclude1, exclude2, exclude3)
tot_vars = tot_vars + vr
tot_func = tot_func + fn
tot_tabs = tot_tabs + tb + 1
if list then lst_subtabs = lst_subtabs .. st end
else
local t_levelmaxi = viewers.form9user("luaTable_structure_level_maxi", recursiveLevel)
if list then res = res .. " " .. viewers.styles_color_warning( t_levelmaxi ) end
end
local sep = ""
if max == opt.max_n then
local luaTable_table_listlimit_max_n = viewers.form9user("luaTable_table_listlimit_max_n", opt.max_n)
if list then res = res .. "\n" .. shift .. " Table " .. levelname .. " " .. viewers.styles_color_warning(luaTable_table_listlimit_max_n) end
break
end
elseif type(v) == "function" then
nbr_func = nbr_func + 1
tot_func = tot_func + 1
isempty = false
if list then lst_func = lst_func .. k .. sep end
else -- type(v) == other
nbr_vars = nbr_vars + 1
tot_vars = tot_vars + 1
isempty = false
if list then lst_vars = lst_vars .. type(v) .. " - " .. tostring(k) .. " = " .. tostring(v) .. " " .. sep end
end
end
if list then res = res .. "\n" .. shift .. " Table " .. levelname .. ", " .. tostring(nbr_vars) .. " vars: " .. lst_vars end
if list then res = res .. "\n" .. shift .. " Table " .. levelname .. ", " .. tostring(nbr_func) .. " functions: " .. lst_func end
if list then res = res .. "\n" .. shift .. " Table " .. levelname .. ", " .. tostring(nbr_tabs) .. " tables: " .. lst_tabs .. lst_subtabs end
return res, tot_vars, tot_func, tot_tabs
end -- function lua_table.structure_recursive(tbl, uppername, name, recursiveLevel, opt) -- countonly, level_maxi, max_n, exclude1, exclude2, exclude3)
-- - - - ------------------ - - - - --------------------------------- -- Document the tables and their structures. List a table content, with formating. -- Documentar las tablas y sus estructuras. Lista de un contenido de la tabla, con el formateo. -- Documenter les tables et leurs structures. Lister un contenu de la table, avec le formatage. -- - - - ------------------ - - - - --------------------------------- -- Dump and format the content of a table and its sub-tables ; with limits in length, deep and exceptions. -- Listar y formatar le contento de una tabla y su sub-tablas. -- Lister et formater le contenu d'une table et ses sous-tables ; avec des limites en longueur, profondeur et exceptions. -- For each (sub)table, list : in first vars, then functions, then sub-tables list, then sub-tables contents
-- Auto test of limits of the table list. -- Auto test des limites de liste de table. lua_table.tablim = { "one", "two", max1 = "MAX1", max2 = "MAX2", max3 = "MAX3"} lua_table.tablim.life = { animal = "dog", vegetal = { big = "tree", small = "flower"} } lua_table.tablim.life.animals = { "turtle"} lua_table.tablim.comfort = { "tv", mobile = "car", sub2 = { "phone", fix = "wall", sub3 = { "bed", up = "roof", sub4 = { "ball"} } } } lua_table.tablim.house = { "kitcheen", "bedroom"} lua_table.tablim.house.garden = { flower = "rose", nature = "river"} -- opt = { dropit.dropit = "dropit", level_maxi = 3, max_n = 2, exclude1 = "hou" } ) -- , {width = "88%", tc1 = "blue"}
function lua_table.structure(table, tablename, opt) -- luaTable_structure_limits_title = "List a table, test with limits:", local memo = viewers.save_configs("lua_table.structure") -- Save global configuration before eventual changes. local recursiveLevel, recursive_limit, recursiveLevel_err = 1, 1111, "" local res = "\n* Content of the " .. tostring(tablename) .. " table, begin:" if not opt then opt = { recursive_limit = 11111 } end local recursiveLevel = opt.recursiveLevel or 1 if langs.main_i18n_complete then recursiveLevel, recursive_limit, recursiveLevel_err = modes.recursive_normal(recursiveLevel, modes.recursive_limit) end -- local recursiveLevel, recursive_limit, recursiveLevel_err = modes.recursive_normal(recursiveLevel, modes.recursive_limit) if type(opt.level_maxi) ~= "number" then opt.level_maxi = 222 end -- opt.level_maxi = opt.level_maxi or 222 if type(opt.max_n) ~= "number" then opt.max_n = 3333 end opt.max_n = opt.max_n or 3333 opt.recursiveLevel = opt.recursiveLevel or recursiveLevel or 1 opt.exclude1 = opt.exclude1 or "" opt.exclude2 = opt.exclude2 or "" opt.exclude3 = opt.exclude3 or "" opt.countonly = opt.countonly and true local tot_vars, tot_func, tot_tabs = 0, 0, 0 if recursiveLevel > opt.level_maxi then -- even for abnormal limit -- Erreur Lua dans Module:Centralizer-s-fr à la ligne 7271 : attempt to compare number with nil. return "", tot_vars, tot_func, tot_tabs end local st, vr, fn, tb = lua_table.structure_recursive(table, "", tablename, 1, opt) -- countonly, level_maxi, max_n, exclude1, exclude2, exclude3) res = res .. st tot_vars = tot_vars + vr tot_func = tot_func + fn tot_tabs = tot_tabs + tb res = res .. "\n* Content of the " .. tostring(tablename) .. " table, end: " res = res .. viewers.form9user(" %1 variables, %2 functions, %3 sub-tables.\n", vr, fn, tb) viewers.restore_configs(memo, "lua_table.structure") -- Restore global configurations after eventual changes. return res, tot_vars, tot_func, tot_tabs end -- function lua_table.structure(table, tablename, opt)
function lua_table.structure_recursive_report(t) -- Reports the structure of a table, with or without limits local t = t -- t or if (type(t) ~= "string") then t = '\n* lua_table.structure_recursive_report(t) : Reports the structure of a table, with or without limits' end local opt = { ["dropit"] = "dropit", ["level_maxi"] = 3, ["max_n"] = 2, ["exclude1"] = "hou" } local res, tot_vars, tot_func, tot_tabs = lua_table.structure(lua_table.tablim, "lua_table.tablim", opt) local t = t .. res -- luaTable_structure_limits_title local t = t .. "\n* ." local t = t .. "\n* lua_table.structure() List a table, test without limits:" local res, tot_vars, tot_func, tot_tabs = lua_table.structure(lua_table.tablim, "lua_table.tablim", nil) local t = t .. res -- luaTable_structure_nolimits_title return t end -- local t = lua_table.structure_recursive_report(t)
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:mathroman is here as an example of very small central library. It becomes central using the central modules system. -- function mathroman.roman2int(rm, testcase) -- Convert a roman number to decimal -- function mathroman.int2roman(i, testcase) -- Convert a integer number to roman -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- mathroman = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
-- The Module:Centralizer/I18N translations for lua_table library update and complete Module:Centralizer translations. mathroman.i18n = {} -- Translations for mathroman library mathroman.i18n.br = { mathroman_errors_head_err = "Erreur : ", mathroman_roman_err = "Erreur de romain : ", mathroman_value_error_err = "Erreur de valeur : ", mathroman_J_before_end_err = "Caractère J avant la fin", mathroman_char_X_in_N_err = "Caractère %1 en %2", mathroman_char_increase_err = "3 caractères croissants", mathroman_greater_4999_err = "Valeur > 4999", mathroman_null_value_err = "Valeur nulle", mathroman_rom2dig_value_err = "Erreur de valeur de nombre romain", mathroman_dig2rom_value_err = "Erreur de valeur décimale", mathroman_roman2int_tests_title = "mathroman.roman2int() Test des nombres romains en nombres décimaux", mathroman_roman2int_tests_headers = "Nombre romain; Valeur décimale; Correct; Erreur(s)", mathroman_int2roman_test_title = "mathroman.int2roman() Test des nombres décimaux en nombres romains", mathroman_int2roman_tests_headers = "Nombre décimal; Valeur romaine; Correct; Erreur(s)", mathroman_int_is_not_integer_err = "Le nombre non entier %1 n'est pas convertible en nombre romain", mathroman_int_is_not_number_err = "La valeur %1 n'est pas un nombre convertible en nombre romain", mathroman_is_not_string_err = "La valeur %1 n'est pas un texte convertible en nombre", } -- mathroman.i18n.br mathroman.i18n.de = { mathroman_errors_head_err = "Fehler: ", mathroman_roman_err = "Römischer Fehler: ", mathroman_value_error_err = "Wert Fehler: ", mathroman_J_before_end_err = "J Zeichen vor dem Ende", mathroman_char_X_in_N_err = "Zeichen %1 in %2", mathroman_char_increase_err = "3 zunehmende Charaktere", mathroman_greater_4999_err = "Wert > 4999", mathroman_null_value_err = "Nullwert", mathroman_rom2dig_value_err = "Roman Wert Fehler", mathroman_dig2rom_value_err = "Dezimalwertfehler", mathroman_roman2int_tests_title = "mathroman.roman2int() Test römischer Zahlen in Dezimalzahlen", mathroman_roman2int_tests_headers = "Römische Nummer; Dezimalwert; Richtig; Error (s)", mathroman_int2roman_test_title = "mathroman.int2roman() Test von Dezimalzahlen in römischen Zahlen", mathroman_int2roman_tests_headers = "Dezimalzahl; Römischer Wert; Richtig; Error (s)", mathroman_int_is_not_integer_err = "Das nicht ganzzahlige %1 ist nicht in römische Zahl umwandelbar", mathroman_int_is_not_number_err = "Der Wert %1 ist keine Zahl, die in eine römische Zahl umgewandelt werden kann", mathroman_is_not_string_err = "Der Wert %1 ist kein konvertierbarer Text in der Zahl", } -- mathroman.i18n.de mathroman.i18n.en = { mathroman_errors_head_err = "Error: ", mathroman_roman_err = "Roman error: ", mathroman_value_error_err = "Value error: ", mathroman_J_before_end_err = "character J before the end", mathroman_char_X_in_N_err = "character %1 in %2", mathroman_char_increase_err = "3 increasing characters", mathroman_greater_4999_err = "value > 4999", mathroman_null_value_err = "null value", mathroman_rom2dig_value_err = "roman value error", mathroman_dig2rom_value_err = "digital value error", mathroman_roman2int_tests_title = "mathroman.roman2int() Test roman to digital numbers", mathroman_roman2int_tests_headers = "Roman number; Digital value; Correct; Error(s)", mathroman_int2roman_test_title = "mathroman.int2roman() Test digital numbers to roman numbers", mathroman_int2roman_tests_headers = "Digital number; Roman value; Correct; Error(s)", mathroman_int_is_not_integer_err = "The not integer number %1 is not convertible to Roman numeral", mathroman_int_is_not_number_err = "The value %1 is not a convertible number to Roman numeral", mathroman_is_not_string_err = "The value %1 is not a text convertible to number" } -- mathroman.i18n.en mathroman.i18n.es = { mathroman_errors_head_err = "Error: ", mathroman_roman_err = "Error de romano: ", mathroman_value_error_err = "Error de valor: ", mathroman_J_before_end_err = "Carácter J antes del fin", mathroman_char_X_in_N_err = "Carácter %1 en %2", mathroman_char_increase_err = "3 crecientes caracteres", mathroman_greater_4999_err = "Valor > 4999", mathroman_null_value_err = "Valor null", mathroman_rom2dig_value_err = "Romano valor error", mathroman_dig2rom_value_err = "Decimale valor error", mathroman_roman2int_tests_title = "mathroman.roman2int() Prueba de números romanos a números decimales", mathroman_roman2int_tests_headers = "Número romano; Valor digital; Corregido; Error(s)", mathroman_int2roman_test_title = "mathroman.int2roman() Prueba de números decimales a números romanos", mathroman_int2roman_tests_headers = "Número decimal, Valor romana; Correcto; Error(es),", mathroman_int_is_not_integer_err = "El no entero %1 no se puede convertir en número romano", mathroman_int_is_not_number_err = "El valor %1 no es un número y no se puede convertir en número romano", mathroman_is_not_string_err = "El valor %1 no es un texto y no se puede convertir en número", } -- mathroman.i18n.es mathroman.i18n.fr = { mathroman_errors_head_err = "Erreur : ", mathroman_roman_err = "Erreur de romain : ", mathroman_value_error_err = "Erreur de valeur : ", mathroman_J_before_end_err = "Caractère J avant la fin", mathroman_char_X_in_N_err = "Caractère %1 en %2", mathroman_char_increase_err = "3 caractères croissants", mathroman_greater_4999_err = "Valeur > 4999", mathroman_null_value_err = "Valeur nulle", mathroman_rom2dig_value_err = "Erreur de valeur de nombre romain", mathroman_dig2rom_value_err = "Erreur de valeur décimale", mathroman_roman2int_tests_title = "mathroman.roman2int() Test des nombres romains en nombres décimaux", mathroman_roman2int_tests_headers = "Nombre romain; Valeur décimale; Correct; Erreur(s)", mathroman_int2roman_test_title = "mathroman.int2roman() Test des nombres décimaux en nombres romains", mathroman_int2roman_tests_headers = "Nombre décimal; Valeur romaine; Correct; Erreur(s)", mathroman_int_is_not_integer_err = "Le nombre non entier %1 n'est pas convertible en nombre romain", mathroman_int_is_not_number_err = "La valeur %1 n'est pas un nombre convertible en nombre romain", mathroman_is_not_string_err = "La valeur %1 n'est pas un texte convertible en nombre", } -- mathroman.i18n.fr mathroman.i18n.hu = { mathroman_errors_head_err = "Hiba: ", mathroman_roman_err = "Római hiba: ", mathroman_value_error_err = "Értékhiba: ", mathroman_J_before_end_err = "Karakter J a vége előtt", mathroman_char_X_in_N_err = "%1 karakter %2 -ben", mathroman_char_increase_err = "3 növekvő karakter", mathroman_greater_4999_err = "Érték > 4999", mathroman_null_value_err = "Null érték", mathroman_rom2dig_value_err = "Római számérték hiba", mathroman_dig2rom_value_err = "Tizedes érték hiba", mathroman_roman2int_tests_title = "mathroman.roman2int() A római számok tizedes számok tesztelése", mathroman_roman2int_tests_headers = "Római szám; Decimális érték; helyes; Hiba (k)", mathroman_int2roman_test_title = "mathroman.int2roman() A decimális számok vizsgálata római számokban", mathroman_int2roman_tests_headers = "Tizedes szám; Római érték; helyes; Hiba (k)", mathroman_int_is_not_integer_err = "A nem egész %1 nem konvertálható a római számra", mathroman_int_is_not_number_err = "A %1 érték nem egy szám, amely átváltható egy római számra", mathroman_is_not_string_err = "Az %1 érték nem konvertibilis szöveg", } -- mathroman.i18n.hu mathroman.i18n.vi = { mathroman_errors_head_err = "Lỗi: ", mathroman_roman_err = "Lỗi roman: ", mathroman_value_error_err = "Lỗi giá trị: ", mathroman_J_before_end_err = "Ký tự J trước khi kết thúc", mathroman_char_X_in_N_err = "%1 ký tự trong %2", mathroman_char_increase_err = "3 ký tự tăng", mathroman_greater_4999_err = "Giá trị> 4999", mathroman_null_value_err = "Giá trị rỗng", mathroman_rom2dig_value_err = "Lỗi giá trị số La Mã", mathroman_dig2rom_value_err = "Lỗi giá trị thập phân", mathroman_roman2int_tests_title = "mathroman.roman2int() Kiểm tra các số La Mã trong các số thập phân", mathroman_roman2int_tests_headers = "Số La Mã; Giá trị thập phân; chính xác; Lỗi", mathroman_int2roman_test_title = "mathroman.int2roman() Kiểm tra các số thập phân trong số La Mã", mathroman_int2roman_tests_headers = "Số thập phân; Giá trị La Mã; chính xác; lỗi", mathroman_int_is_not_integer_err = "Số nguyên %1 không thể chuyển đổi thành số La Mã", mathroman_int_is_not_number_err = "Giá trị %1 không phải là số có thể chuyển đổi thành số La Mã", mathroman_is_not_string_err = "Giá trị %1 không phải là văn bản có thể chuyển đổi trong số", } -- mathroman.i18n.vi
-- vueRomains : XIJ=12 MCXI=1111 MCDXLIV=1444 MDCLXVI=1666 MCMXCIX=1999 MMCCXXII=2222 MMMMCMXCIX=4999 ERREURS=0 erreur caractere S en 7. XIA=11 erreur caractere A en 3. XJI=12 erreur caractere J avant la fin. IXC=89 erreur caracteres croissants. VLD=445 erreur caracteres croissants. MMMMM=5000 erreur > 4999. MMMMMYJXC=5089 erreur > 4999. erreur caractere Y en 6. erreur caractere J avant la fin.
-- Romans view : XIJ=12 MCXI=1111 MCDXLIV=1444 MDCLXVI=1666 MCMXCIX=1999 MMCCXXII=2222 MMMMCMXCIX=4999 ERREURS=0 erreur caractere S en 7. XIA=11 erreur caractere A en 3. XJI=12 erreur caractere J avant la fin. IXC=89 erreur caracteres croissants. VLD=445 erreur caracteres croissants. MMMMM=5000 erreur > 4999. MMMMMYJXC=5089 erreur > 4999. erreur caractere Y en 6. erreur caractere J avant la fin.
function mathroman.roman2int(rm) -- Convert a roman number to integer -- S170606rmn -- { ["name"] = "mathroman.roman2int (4)', ["args"] = { "VI", }, ["expect"] = { 123 } }, -- example of test case local v = 0 -- valeur totale local v1 = 0 -- valeur de derniere lettre local v2 = 0 -- valeur de lettre precedente local v3 = 0 -- valeur de lettre precedente local x = '-' -- caractere en cours d'evaluation local i = 1 -- numero du caractere en cours d'evaluation local j = 0 -- numero du caractere de reference courant (debut en Lua) local k = 0 -- numero du caractere de reference courant (fin en Lua) local errs, errtab = "", {} if type(rm) ~= "string" then table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", tostring(rm) ) ) ) return 0, errs end if rm == "" then errs = errs .. events.add_err("mathroman_is_not_string_err", '""') table.insert(errtab, tostring(events.add_err("mathroman_is_not_string_err", '""') ) ) return 0, errs end if type(rm) ~= "string" then rm = "-" end local lst = '-MDCLXVIJ' -- caracteres autorises x = string.sub(rm, i, i) or while (x ~= ) do v3 = v2 v2 = v1 v1 = 0 if ( x == 'M' ) then v1 = 1000 end if ( x == 'D' ) then v1 = 500 end if ( x == 'C' ) then v1 = 100 end if ( x == 'L' ) then v1 = 50 end if ( x == 'X' ) then v1 = 10 end if ( x == 'V' ) then v1 = 5 end if ( x == 'I' ) then v1 = 1 end if ( x == 'J' ) then v1 = 1 end if ( x == 'J' ) and ( i < string.len(rm) ) then errs = errs .. events.add_err("mathroman_J_before_end_err") -- e4 = 'character J before the end' table.insert(errtab, tostring(events.add_err("mathroman_J_before_end_err") ) ) -- e4 = 'character J before the end' end if ( v1 == 0 ) then errs = errs .. events.add_err("mathroman_char_X_in_N_err", x, i) -- e3 = "character K in 3" table.insert(errtab, tostring(events.add_err("mathroman_char_X_in_N_err", x, i) ) ) end v = v + v1 if ( (v1 == 5*v2) or (v1 == 10*v2) ) then v = v - (2*v2) end -- adjust 4, 9, 40, 90 ... j, k = string.find(lst, x) if ( j == nil ) then j = -1 end if ( k == nil ) then k = -1 end if (v1 > v2) and (v2 > v3) and (v3 > 0) then errs = errs .. events.add_err("mathroman_char_increase_err") -- e2 = ' increasing chars.' table.insert(errtab, tostring(events.add_err("mathroman_char_increase_err") ) ) end i = i + 1 x = string.sub(rm, i, i) or end if ( v < 1 ) then -- e0 = ' valeur nulle.' errs = errs .. events.add_err("mathroman_null_value_err") table.insert(errtab, tostring(events.add_err("mathroman_null_value_err") ) ) end if ( v > 4999 ) then -- e1 = ' valeur > 4999.' errs = errs .. events.add_err("mathroman_greater_4999_err") table.insert(errtab, tostring(events.add_err("mathroman_greater_4999_err") ) ) end errs = table.concat(errtab, " ; ") return v, errs -- with or without errors end -- function mathroman.roman2int(rm)
function mathroman.romani2r(i, j) if ( j == nil ) then j = end local rm= if ( i == 1000 ) then rm = 'M' end if ( i == 500 ) then rm = 'D' end if ( i == 100 ) then rm = 'C' end if ( i == 50 ) then rm = 'L' end if ( i == 10 ) then rm = 'X' end if ( i == 5 ) then rm = 'V' end if ( i == 1 ) then rm = 'I' if ( j == 'J' ) then rm = 'J' end end return rm end -- function mathroman.romani2r(i, j)
function mathroman.int2roman(int) -- Convert an integer to a roman number, also if int is a string -- { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { int = 444 }, ["expect"] = { "CDXLIV" } }, -- example of test case local errs = "" -- local collection of errors -- S170606rmn local roman, n = "", tonumber(int) if n then local floor = math.floor(n) if n ~= floor then errs = errs .. events.add_err("mathroman_int_is_not_integer_err", tostring(int) ) roman = "" return roman, errs -- with error end elseif int == "" then errs = errs .. events.add_err("mathroman_is_not_string_err", '""' ) return "", errs else errs = errs .. events.add_err("mathroman_int_is_not_number_err", tostring(int) ) roman = "" return roman, errs -- with error end if type(n) ~= "number" then n = 0 end n = math.floor(n) n = n or 0 -- delete after debug local v100 = 100 local v500 = v100*5 local v1000 = v100*10 -- roman cycle romain 1000, 100, 10, 1 local v, v1, v2, v3 = 0, 0, 0, 0 -- Total value, last, and previous. Valeur totale, derniere, et precedentes. local reste, reduction = 0, 0 -- Rest to convert, last reduction. Reste a convertir, derniere reduction. local rm = local roman = -- chiffre et nombre romain resultant reste = n if ( n > 4999 ) then errs = errs .. events.add_err("mathroman_greater_4999_err") -- e1 = ' valeur > 4999.' reste = 0 roman = "" -- 'ERROR' end if ( n < 1 ) then errs = errs .. events.add_err("mathroman_null_value_err") -- e2 = ' valeur < 1.' reste = 0 roman = "" -- 'ERROR' end while (reste > 0) do v3 = v2 v2 = v1 v1 = reste reduction = 0 if ( reste >= v1000 ) then reduction = v1000 elseif ( reste >= v100*9 ) then reduction = v100 reste = reste + v100*2 elseif ( reste >= v500 ) then reduction = v500 elseif ( reste >= v100*4 ) then reduction = v100 reste = reste + v100*2 elseif ( reste >= v100 ) then reduction = v100 elseif ( reste >= 1000 ) then v100 = 100 v1000 = 1000 reduction = v1000 end rm = mathroman.romani2r(reduction) roman = roman .. rm reste = reste - reduction if ( reste < v100 ) then if ( v100 >= 10 ) then v100 = v100/10 v500 = v100*5 v1000 = v100*10 end end end return roman, errs -- with or without errors end -- function mathroman.int2roman(int)
function mathroman.roman2int_tests(t) -- Tests of the conversion of a Roman number to a decimal value -- S170606rmn local memo = viewers.save_configs("mathroman.roman2int_tests") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* mathroman.roman2int_tests(t) : Tests of the conversion of a Roman number to a decimal value' end local tab_view = { -- Group datas and options for a table view with lines and columns. tests_title = "mathroman_roman2int_tests_title", -- "mathroman.roman2int() Test roman to digital numbers" test_group = { { 123, }, { 2.78, }, { "-X", }, { "", }, { "0", }, { "MCXI", },{ "XIJ", }, { "XJI", }, { "XIA", }, { "VLD", }, { "IXC", }, { "MMMMCMXCIX", }, { "MMMMM", }, { "MMMMMYJXC", }, { {x}, }, { function()end, }, }, headers = "mathroman_roman2int_tests_headers", -- "Roman number; Digital value; Correct; Error(s)" headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. viewers.ta("roman2int_tests: ", "start") t = t .. viewers.ta("#test_group: ", lua_table.level_count(tab_view.test_group) ) function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup. local word = case[1] -- DEBUG : mathroman.roman2int() can fail without blocking page. local valX, errs = mathroman.roman2int(word) -- DEBUG : mathroman.roman2int() can fail without blocking page. local wordX, errsX = mathroman.int2roman(valX) -- DEBUG : mathroman.roman2int() can fail without blocking page. return { word, valX, wordX, errs .. " " .. errsX, } end t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "mathroman.roman2int_tests") -- Restore global configurations after eventual changes. return t end -- function mathroman.roman2int_tests(t)
function mathroman.int2roman_test(t) -- Tests of the conversion of a decimal number to a Roman number local memo = viewers.save_configs("mathroman.int2roman_test") -- Save global configuration before eventual changes. local t = t -- t or if (type(t) ~= "string") then t = '\n* mathroman.int2roman_test(t) : Tests of the conversion of a decimal number to a Roman number' end t = t .. "\n* " .. viewers.form9user("mathroman_int2roman_test_title") local tab_view = { -- Group datas and options for a table view with lines and columns. tests_title = "mathroman_int2roman_test_title", -- "mathroman.int2roman() Test digital numbers to roman numbers" test_group = { { -10, }, { 3.14, }, { "not-a-number", }, { "", }, { 0, }, { 12, }, { 17, }, { "18", }, { "19", }, { 111, }, { 444, }, { 555, }, { "777", }, { "1111", },{ "4999", }, { "5000", }, }, headers = "mathroman_int2roman_tests_headers", -- "Digital number; Roman value; Correct; Error(s)" headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. viewers.ta("int2roman_tests: ", "start") t = t .. viewers.ta("#test_group: ", lua_table.level_count(tab_view.test_group) ) function tab_view.form_one_case(case) -- Convert a case from test_group to rowGroup. local val = case[1] -- DEBUG : mathroman.roman2int() can fail without blocking page. local wordX, errs = mathroman.int2roman(val, " ") -- DEBUG : mathroman.int2roman() can fail without blocking page. local valX, errsX = mathroman.roman2int(wordX) -- DEBUG : mathroman.roman2int() can fail without blocking page. return { val, wordX, valX, errs .. " " .. errsX, } end t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "mathroman.int2roman_test") -- Restore global configurations after eventual changes. return t end -- function mathroman.int2roman_test(t)
-- vueRomains : XIJ=12 MCXI=1111 MCDXLIV=1444 MDCLXVI=1666 MCMXCIX=1999 MMCCXXII=2222 MMMMCMXCIX=4999 ERREURS=0 erreur caractere S en 7. XIA=11 erreur caractere A en 3. XJI=12 erreur caractere J avant la fin. IXC=89 erreur caracteres croissants. VLD=445 erreur caracteres croissants. MMMMM=5000 erreur > 4999. MMMMMYJXC=5089 erreur > 4999. erreur caractere Y en 6. erreur caractere J avant la fin. -- { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", group = mathroman.TestsCasesGroup, }, -- { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { 1 }, ["expect"] = { "I" } },
mathroman.TestsCasesGroup = { -- Autotest cases to validate the mathroman library at MediaWiki level. -- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 8 cases { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XXII" }, ["expect"] = { 22 }, }, }
mathroman.Tests_cases = { -- Autotest cases to validate the mathroman library at MediaWiki level. -- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 5 cases { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { 12, }, ["expect"] = { "XII" }, }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "VIA", }, ["expect"] = { 6, "character AAA in 3" }, }, }
mathroman.int2romanTests = { -- Autotest cases to validate the mathroman library at MediaWiki level. -- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 8 - 1 = 7 + 8 = 15 cases { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { "19" }, ["expect"] = { "XII" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { 4999 }, ["expect"] = { "MMMMCMXCIX" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { 5000 }, ["expect"] = { "0", "value > 4999" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { -10 }, ["expect"] = { "X", "null value" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.int2roman", ["args"] = { 0 }, ["expect"] = { "0", "null value" } }, } mathroman.roman2intTests = { -- Autotest cases to validate the mathroman library at MediaWiki level. -- each test_case defines a name, a function, an input, an output. See also viewers.strTestCase. 6 cases { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "-X" }, ["expect"] = { 10, "mathroman_char_X_in_N_err---1-" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "0" }, ["expect"] = { 0, "null value" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XIA" }, ["expect"] = { 11, "character A in 3" } }, --[ { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "" }, ["expect"] = { 0 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "MCXI" }, ["expect"] = { 1111 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XIJ" }, ["expect"] = { 12 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XJI" }, ["expect"] = { 12, "X Y Z" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XJI" }, ["expect"] = { 12, "mathroman_char_increase_err" } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "VLD" }, ["expect"] = { 445 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "IXC" }, ["expect"] = { 89 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "MMMMCMXCIX" }, ["expect"] = { 4999 } }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "MMMMM" }, ["expect"] = { 5000, "mathroman_J_before_end_err-XJI" } }, --]] { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "MMMMMYJXC" }, ["expect"] = { 5089, ";mathroman_J_before_end_err;mathroman_char_increase_err;mathroman_char_X_in_N_err-Y-6;mathroman_greater_4999_err;" } }, }
mathroman.testsRecursive = { -- Autotest cases to validate the mathroman library at MediaWiki level. { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "XXIJ" }, ["expect"] = { 22 } }, -- { ["errorsKey"] = 2, ["modulename"] = "mathroman", funcname = 'recurse', group = mathroman.testsRecursive, }, { ["errorsKey"] = 2, ["modulename"] = "mathroman", ["funcname"] = "mathroman.roman2int", ["args"] = { "MCXI" }, ["expect"] = { 1111 } }, -- { ["errorsKey"] = 2, ["modulename"] = "mathroman", funcname = 'recurse', group = mathroman.testsRecursive, }, }
local func_example = { ["funcname"] = "mathroman.roman2int", ["args"] = { "MCXI" }, ["expect"] = { 1111 }, ["errorsKey"] = 2, } local group_example = { ["name"] = "mathroman.roman2int.5", ["modulename"] = "mathroman", ["groupname"] = "mathroman.testsRecur", }
mathroman.testsGroups = { -- Autotest cases to validate the mathroman library at MediaWiki level. -- Each test_case defines a name, a function, an input, an output. { ["name"] = "mathroman", ["modulename"] = "mathroman", ["funcname"] = "runGroups", ["groupname"] = "mathroman.Tests_cases", }, -- { ["name"] = "mathroman", ["modulename"] = "mathroman", ["funcname"] = "runGroups", ["groupname"] = "mathroman.int2romanTests", }, -- { ["name"] = "mathroman", ["modulename"] = "mathroman", ["funcname"] = "runGroups", ["groupname"] = "mathroman.roman2intTests", }, -- -- modulename = "mathroman", ["funcname"] = "runGroups", ["groupname"] = "mathroman.testsRecursive", }, }
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:modes support modes and their options, like p.read(frame). -- count = number of tests; provide( n ) returns three values: n, and expected output; run( n ) returns one string. -- see Extension:Scribunto/Lua reference manual : class nameTest extends Scribunto_LuaEngineTestBase -- This library supports modules to: -- * Define their modes, used with frame: p.read(frame) -- * Default modes are read, edit, doc or tests -- * And their options -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- modes = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
-- The Module:Centralizer/I18N translations for lua_table library update and complete Module:Centralizer translations.
modes.cat_view = "" -- = ":" to document a category rather than truly categorize it
modes.i18n = {} -- Translations for modes library
modes.i18n.br = {
-- Noms et descriptions des arguments de configurations
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label_descr = "Argument automatique de Wikidata.",
sitelink = 'sitelink',
sitelink_descr = "Argument automatique de Wikidata.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Langue du wiki.",
pagelang = "pagelang",
pagelang_descr = "Langue de la page.",
userlang = "userlang",
userlang_descr = "Language du lecteur de la page.",
--
QITEM = 'QITEM',
uri = 'uri',
itemid = 'itemid',
itemid_descr = "Identifiant des données de Wikidata, comme Q535
pour Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Autre identifiant des données de Wikidata, comme Q535
pour Victor Hugo.",
debug = 'debug',
category = 'Catégorie',
mode = "mode",
mode_descr = "Type d'utilisation du module ou du modèle : lire, éditer, documenter, tester.",
options = "options",
options_descr = "Options d'affichage d'un module ou d'un modèle.",
c = "c",
c_descr = "Options d'affichage d'un module ou d'un modèle.",
knownversions = "knownversions",
knownversions_descr = "Versions connues, pour les gérer.",
soughtversions = "soughtversions",
soughtversions_descr = "Versions demandées, pour les gérer.",
modes_form_ok_categ_tests = "Test de génération de catégorie OK",
-- Principaux textes, erreurs et catégories des outils
language = 'langue',
-- Messages et erreurs divers
modes_used_options_list_title = "modes.used_options_list() Utilisation des options :",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Modes et options en bref",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Test des options de modes",
modes_options_from_args_title = "Test des options des arguments",
-- Groupes d'arguments
modes_needed_to_verify = "(obligatoire, à vérifier)",
modes_list_needed_args = "Liste des arguments nécessaires :",
modes_list_all_config_arguments = "Liste des arguments de configuration :",
modes_list_all_system_arguments = "Liste des arguments système :",
modes_list_all_other_args = "Liste des autres arguments :",
modes_language_cat = 'Parle %1',
modes_date_months_names = "Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre",
modes_date_to_part_format = "dd yyyy mmmm",
modes_date_to_part_call_err = "Erreur interne : Argument anormal de définition de date %1.",
modes_date_to_part_call_cat = "Module avec erreur interne",
modes_date_to_part_not_found_err = "Erreur interne : partie non définie de date %1.",
-- Gestion des arguments
modes_error_list_header_err = "Assistance sur les paramètres de ce modèle :",
modes_need_arg_value_err = "Erreur : Vous devez définir cet argument nécessaire mais absent : %1.",
modes_none_value_err = "Erreur : Aucun argument n'a été défini.",
modes_unknown_argument_err = "Erreur : Le paramètre %1 est inconnu dans ce modèle. Vérifier ce nom ou signaler ce manque.",
modes_too_unnamed_arguments_err = "Erreur : Ce paramètre non nommé est en trop : %1 = %2.",
modes_without_translation_wsid_err = "Erreur interne : Signaler au développeur que l'argument interne %1 est inconnu dans les notices.",
modes_is_defined_err = "L'argument %1:%2 est défini.",
modes_is_undefined_err = "L'argument %1:%2 n'est pas défini.",
modes_args_values_err = "Valeur anormale de l'argument %1 = %2 parmi : (%3) ",
-- Messages et erreurs divers
modes_nearest_argument_err = "Erreur : Voulez vous l'argument connu %1 ?",
modes_max_nearest_argument_msg = "Un nom d'argument plus long accepte plus d'erreurs de lettres.",
modes_value_re_defined_err = "Erreur : La valeur de l'argument %1 est déjà définie. Choisir une seule valeur d'un seul synonyme.",
modes_lang_table_err = "Erreur interne : La langue %1 ou sa table est erronée.",
modes_lang_table_err_i_cat = "Module avec erreur interne", -- modes_no_source_arguments_cat
modes_lang_table_err_i_cat = "Module avec langue d'arguments erronée",
modes_lang_not_translated_err = "Erreur : La langue %1 n'est pas traduite.",
modes_generDoc1_paramName_err = "Erreur interne : en generDoc1, mauvais argument %1.",
modes_unknown_auto_arg_err = "Erreur interne: Argument automatique inconnu : %1 = %2.",
--
modes_delete_docbox_wng = "Vous devez supprimer cette documentation avant d'enregistrer.
Supprimez tous les modes pour revenir en mode read.",
modes_auto_val_warning_wng = "Vérifiez l'argument automatique.",
--
modes_assist_user_param_err = "Support aux utilisateurs pour vérifier les paramètres :",
modes_args_values_err = "Valeur anormale de l'argument %1 = %2 (%3)",
--
modes_no_known_arguments_err = "Erreur interne : Module sans table d'arguments connus.",
modes_no_known_arguments_i_cat = "Module sans table d'arguments connus.",
modes_no_source_arguments_err = "Erreur interne : Module sans table d'arguments sources.",
modes_no_source_arguments_i_cat = "Module sans table d'arguments source.",
--
modes_list_all_args_main_title = "modes.list_all_args_main() Liste de tous les arguments acceptés",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Test des distances de Levenshtein entre mots:",
modes_args_known_structure_title = "modes.args_known_structure() Définitions des arguments",
modes_args_unknown_report_title = "viewers.simple_list_test() Signaler les arguments inconnus",
modes_normal_box_main_text_1 = "Boîte d'information simple : titre de cette page %1, description : %2",
modes_normal_box_main_text_2 = "
Il était %1, se nommait %2 %3, il est mort en %4.",
-- Ces textes sont utilisés pour titrer des tests.
modes_list_wiki_selectors_title = "Liste des sélecteurs de ce module :",
modes_all_categories_list_title = "modes.all_categories_list() Liste des catégories éventuelles de ce module :",
modes_all_errors_list_title = "modes.all_errors_list() Liste des erreurs détectables de ce module :",
modes_multiple_values_tests_title = "modes.multiple_values() Test des arguments à valeurs multiples",
modes_multiple_selection_tests_title= "modes.multiple_selection() Test de sélection multiple",
modes_multiple_selection_test_headers= "Options;Sélecteur;À sélectionner;Sélectionnés",
modes_multiple_selection_test_select= "2;nobel;président;député;prix",
modes_recursiveLevel_err = "Erreur de niveau récursif %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalise le niveau récursif et la limite récursive",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, et noms de pages :",
modes_args_known_report_title = "modes.args_known_report(t) Rapport des principaux arguments connus.",
modes_args_known_report_headers = "clé; valeur; type; nécessaire; mot-clé; synonyme; propriété; format; source",
} -- modes.i18n.br
modes.i18n.de = {
-- Namen und Beschreibungen von Konfigurationsargumenten
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Wikidata automatisches Argument.",
sitelink = 'sitelink',
sitelink_descr = "Wikidata automatisches Argument.",
-- Sprachen
contentlang = "contentlang",
contentlang_descr = "Wiki-Sprache.",
pagelang = "pagelang",
pagelang_descr = "Sprache der Seite.",
userlang = "userlang",
userlang_descr = "Lesersprache der Seite.",
--
QITEM = 'QITEM',
uri = 'uri',
QITEM_descr = "Name der Wikidata-Daten wie Q535
für Victor Hugo.",
itemid = 'itemid',
itemid_descr = "Name der Wikidata-Daten wie Q535
für Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Name der Wikidata-Daten wie Q535
für Victor Hugo.",
debug = 'debug',
category = 'Kategorie',
mode = "modo",
mode_descr = "Art der Verwendung des Moduls oder Modells: Lesen, Bearbeiten, Dokumentieren, Testen.",
options = 'opciones',
options_descr = "Anzeigeoptionen für ein Modul oder ein Modell.",
c = "c",
c_descr = "Anzeigeoptionen für ein Modul oder ein Modell.",
knownversions = "knownversions",
knownversions_descr = "Bekannte Versionen, um mit ihnen umzugehen.",
soughtversions = "soughtversions",
soughtversions_descr = "Verlangen Sie Versionen, um mit ihnen umzugehen.",
modes_form_ok_categ_tests = "Testkategoriegenerierung OK",
--
-- Titel der Pruebas
modes_used_options_list_title = "modes.used_options_list() Verwendung von Optionen:",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Modi und Optionen in Kürze",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Testmodusoptionen",
modes_options_from_args_title = "Optionen für das Testen von Argumenten",
-- Gruppen von Argumenten
modes_needed_to_verify = "(obligatorio, se debe comprobar)",
modes_list_needed_args = "Liste der notwendigen Argumente:",
modes_list_all_config_arguments = "Liste der Konfigurationsargumente:",
modes_list_all_system_arguments = "Liste der Systemargumente:",
modes_list_all_other_args = "Liste anderer Argumente:",
-- Haupttexte, Fehler und Instrumentenkategorien
modes_language_cat = 'Sprechen %1',
modes_date_months_names = "Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember",
modes_date_to_part_format = "dd mmmm yyyy",
modes_date_to_part_call_err = "Interner Fehler: anomale Aufrufargumente am Datum %1.",
modes_date_to_part_call_cat = "Modul mit internem Fehler",
modes_date_to_part_not_found_err = "Interner Fehler: Nicht am Datum gefunden %1.",
-- Kontrolle der Argumente
modes_error_list_header_err = "Unterstützung in den Parametern dieses Modells:",
modes_need_arg_value_err = "Fehler: Sie müssen dieses notwendige Argument beheben, aber es fehlt: %1.",
modes_none_value_err = "Fehler: Es wurde kein Argument definiert.",
modes_unknown_argument_err = "Fehler: Der Parameter %1 ist in diesem Modell unbekannt. Überprüfen Sie den Namen oder melden Sie diesen Fehler.",
modes_too_unnamed_arguments_err = "Fehler: Zu viel Argument ohne einen Namen: %1 = %2.",
modes_without_translation_wsid_err = "Interner Fehler: Informiere den Entwickler, dass das interne Argument %1 ist in den Aufzeichnungen unbekannt.",
modes_is_defined_err = "Das %1:%2 Argument ist definiert.",
modes_args_values_err = "Abnormaler Wert des Arguments %1 = %2 dazwischen: (%3) ",
modes_is_undefined_err = "Das %1:%2 Argument ist nicht definiert.",
modes_args_values_err = "Abnormaler Wert des Arguments %1 = %2 zwischen: (%3) ",
modes_nearest_argument_err = "Fehler : Willst du das bekannte Argument %1 ?",
modes_max_nearest_argument_msg = "Längeres Namensargument akzeptiert mehr Buchstabenfehler.",
modes_value_re_defined_err = "Fehler: Der Wert des Arguments %1 ist bereits definiert. Wählen Sie nur einen Wert eines einzelnen Synonyms aus",
modes_lang_table_err = "Fehler: Die Sprache %1 oder ihre Tabelle ist falsch.",
modes_lang_table_err_i_cat = "Modul mit internem Fehler", -- modes_lang_table_err_i_cat
modes_lang_table_err_i_cat = "Modul mit der Sprache der fehlerhaften Argumente", -- modes_no_source_arguments_cat
modes_lang_not_translated_err = "Fehler: Die Sprache %1 ist nicht übersetzt.",
modes_generDoc1_paramName_err = "Fehler intern: in generDoc1, schlechtes Argument %1.",
--
modes_unknown_auto_arg_err = "Interner fehler: Automatisches unbekanntes Argument: %1 = %2.",
modes_delete_docbox_wng = "Sie müssen diese Dokumentation vor dem Brennen entfernen.
Entfernen Sie alle Modi, um in den Lesemodus zurückzukehren.",
modes_auto_val_warning_wng = "Überprüfen Sie die automatischen Argumente.",
--
modes_assist_user_param_err = "Benutzerunterstützung zur Überprüfung der Konfiguration:",
modes_args_values_err = "Abnormaler Wert des Arguments %1 = %2 (%3)",
modes_no_known_arguments_err = "Fehler intern: Modul ohne Tabelle mit bekannten Argumenten.",
modes_no_known_arguments_i_cat = "Modul ohne Tabelle bekannter Argumente.",
modes_no_source_arguments_err = "Fehler interno: Modul ohne Quellenargumententabelle.",
modes_no_source_arguments_i_cat = "Modul ohne Quellenargumententabelle.",
modes_list_all_args_main_title = "modes.list_all_args_main() Liste aller akzeptierten Argumente",
modes_levenshtein_similar_tests_title= "modes.levenshtein() Beweis der Entfernungen Levenshtein zwischen den Wörtern:",
modes_args_known_structure_title = "modes.args_known_structure() Definitionen von Argumenten",
modes_args_unknown_report_title = "viewers.simple_list_test() Melden Sie unbekannte Argumente",
modes_normal_box_main_text_1 = "Einfaches Informationsfeld: Titel der Seite: %1, Beschreibung: %2",
modes_normal_box_main_text_2 = "
Er war ein %1, heißt %2 %3 war in gestorben %4.",
-- Diese Texte werden verwendet, um einige Tests zu benennen.
modes_list_wiki_selectors_title = "Liste der Selektoren in diesem Modul:",
modes_all_categories_list_title = "modes.all_categories_list() Liste der möglichen Kategorien dieses Moduls:",
modes_all_errors_list_title = "modes.all_errors_list() Liste der erkennbaren Fehler in diesem Modul:",
modes_multiple_values_tests_title = "modes.multiple_values() Testen mehrerer Argumentwerte",
modes_multiple_selection_tests_title= "modes.multiple_selection() Mehrfachauswahltest",
modes_multiple_selection_test_headers= "Optionen; Auswahl; Um auszuwählen; Ausgewählt",
modes_multiple_selection_test_select= "2; nobel; Präsident; stellvertretender; Preis",
modes_recursiveLevel_err = "Fehler der rekursiven Ebene %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalisieren Sie die rekursive Ebene und die rekursive Grenze",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, Namespaces und Seitennamen:",
modes_args_known_report_title = "modes.args_known_report(t) Bericht der wichtigsten bekannten Argumente.",
modes_args_known_report_headers = "Schlüssel Wert tippen Sie ein; notwendig Schlüsselwort Synonyme; Eigentum; Format; Brunnen",
} -- modes.i18n.de
modes.i18n.en = { -- 182 <tab>mode_...
-- From here, TRANSLATE ONLY descriptions with a key like label_descr
-- To translate, always keep
-- Names and descriptions of configurations arguments
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Automatic Wikidata argument.",
sitelink = 'sitelink',
sitelink_descr = "Automatic Wikidata argument.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Language of the wiki.",
pagelang = "pagelang",
pagelang_descr = "Language of the page.",
userlang = "userlang",
userlang_descr = "Language of the page reader.",
--
QITEM = 'QITEM',
uri = 'uri',
QITEM_descr = "Wikidata data identifier, like Q535
for Victor Hugo.",
itemid = 'itemid',
itemid_descr = "Wikidata data identifier, like Q535
for Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Wikidata data identifier, like Q535
for Victor Hugo.",
debug = 'debug',
category = 'Category',
mode = "mode",
mode_descr = "Type of use of the module or template: read, edit, document, test.",
options = "options",
options_descr = "Display options of a module or a model.",
c = "c",
c_descr = "Display options of a module or a model.",
knownversions = "knownversions",
knownversions_descr = "Known versions, to manage them.",
soughtversions = "soughtversions",
soughtversions_descr = "Sought versions, to manage them.",
modes_used_options_list_title = "modes.used_options_list() Use of options:",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Options uses and short test",
--
modes_list_all_args_main_title = "modes.list_all_args_main() List of all accepted arguments",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Test options from modes", -- argschanges
modes_options_from_args_title = "Test options from arguments",
-- Groups of arguments
modes_needed_to_verify = "(required, to be checked)",
modes_list_needed_args = "List of needed arguments:",
modes_list_all_config_arguments = "List of all config arguments:",
modes_list_all_system_arguments = "List of all system arguments:",
modes_list_all_other_args = "List of all other arguments:",
-- Main string, errors and categories of tools
modes_language_cat = 'Speaking %1',
modes_date_months_names = "January, February, March, April, May, June, July, August, September, October, November, December",
modes_date_to_part_format = "dd yyyy mmmm",
modes_date_to_part_call_err = "Internal Error: Abnormal calling arguments in date %1.",
modes_date_to_part_call_cat = "Module with internal error",
modes_date_to_part_not_found_err = "Internal Error: No part found in date %1.",
-- Arguments management
modes_error_list_header_err = "Support on the parameters of this model:",
modes_need_arg_value_err = "Error: This argument is required but absent : %1. Should define it.",
modes_none_value_err = "Error: No argument has been defined.",
modes_unknown_argument_err = "Error: parameter %1 is unknown in this template. Check the name or report this gap.",
modes_too_unnamed_arguments_err = "Error: This unnamed argument is too many: %1 = %2.",
modes_without_translation_wsid_err = "Internal Error: Notify the developer that the internal argument %1 is unknown in the records.",
modes_is_defined_err = "The argument %1:%2 is defined.",
modes_is_undefined_err = "The argument %1:%2 is not defined.",
modes_args_values_err = "Abnormal value of the argument %1:%2 including (%3) ",
modes_nearest_argument_err = "Error: Do you need the known argument %1 ?",
modes_max_nearest_argument_msg = "A longer name argument accepts more letter errors.",
modes_value_re_defined_err = "Error: The value of the argument %1 is already defined. Choose only one value of a single synonymous.",
modes_lang_table_err = "Error: The %1 language or its table is incorrect.",
modes_lang_table_err_i_cat = "Module with internal error", -- modes_lang_table_err_i_cat
modes_lang_table_err_i_cat = "Module with erroneous language of arguments",
modes_lang_not_translated_err = "Error: The language %1 is not translated.",
modes_generDoc1_paramName_err = "Internal Error: in generDoc1, bad argument %1.",
--
modes_unknown_auto_arg_err = "Internal Error: Unknown automatic argument: %1 = %2.",
modes_delete_docbox_wng = "You must remove this documentation before recording.
Remove all modes to return to read mode.",
-- modes_auto_val_warning_wng = "Verify the automatic argument: %1 = %2.",
modes_auto_val_warning_wng = "Verify the automatic arguments.",
--
modes_assist_user_param_err = "User support for checking the settings:",
modes_args_values_err = "Abnormal value of the argument %1 = %2 (%3)",
--
modes_no_known_arguments_err = "Internal Error: Module without known arguments table.",
modes_no_known_arguments_i_cat = "Module without known arguments table.",
modes_no_source_arguments_err = "Internal Error: Module without source arguments table.",
modes_no_source_arguments_i_cat = "Module without source arguments table.",
--
modes_list_all_args_main_title = "modes.list_all_args_main() List of all accepted arguments",
modes_levenshtein_similar_tests_title= "modes.levenshtein() Test the distances between words Levenshtein:",
modes_args_known_structure_title = "modes.args_known_structure() Arguments definitions",
modes_args_unknown_report_title = "viewers.simple_list_test() Report unknown arguments",
modes_normal_box_main_text_1 = "Simple infobox: page title: %1, description: %2",
modes_normal_box_main_text_2 = "
He was %1, named %2 %3 was dead in %4.",
-- These string are used to title some tests. modes_list_wiki_selectors_title = "List of selectors of this module:", modes_all_categories_list_title = "modes.all_categories_list() List of eventual categories of this module:", modes_all_errors_list_title = "modes.all_errors_list() List of detectable errors in this module:", modes_multiple_values_tests_title = "modes.multiple_values() Test of multiple values arguments", modes_multiple_selection_tests_title= "modes.multiple_selection() Multiple selection test", modes_multiple_selection_test_headers= "Options;Selector;To selector;Selected", modes_multiple_selection_test_select= "2;nobel;president;deputy;price", modes_recursiveLevel_err = "Recursive level error %1 > %2", modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalize the recursive level and the recursive limit", modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, and page names:", modes_args_known_report_title = "modes.args_known_report(t) Report of main known args.", modes_args_known_report_headers = "key; val; type; need; keyword; syn; prop; format; source", } -- modes.i18n.en
modes.i18n.es = {
-- Nombres y descripciones de argumentos de configuraciones
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Wikidata automática argumento.",
sitelink = 'sitelink',
sitelink_descr = "Wikidata automática argumento.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Idioma del wiki.",
pagelang = "pagelang",
pagelang_descr = "Idioma de la página.",
userlang = "userlang",
userlang_descr = "Idioma del lector de la página.",
--
QITEM = 'QITEM',
uri = 'uri',
QITEM_descr = "Nombre de los datos Wikidata, como Q535
para Victor Hugo.",
itemid = 'itemid',
itemid_descr = "Nombre de los datos Wikidata, como Q535
para Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Nombre de los datos Wikidata, como Q535
para Victor Hugo.",
debug = 'debug',
category = 'Categoría',
mode = "modo",
mode_descr = "Tipo de uso del módulo o modelo: leer, editar, documentar, probar.",
options = 'opciones',
options_descr = "Opciones de visualización de un módulo o un modelo.",
c = "c",
c_descr = "Opciones de visualización de un módulo o un modelo.",
knownversions = "knownversions",
knownversions_descr = "Conocidas versiones, para manejarlos.",
soughtversions = "soughtversions",
soughtversions_descr = "Versiones demanda, para manejarlos.",
modes_form_ok_categ_tests = "Prueba generación categoría en OK",
--
-- Titres des pruebas
modes_used_options_list_title = "modes.used_options_list() Uso de opciones:",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Modos y opciones en brief",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Prueba de opciones de modos", -- argschanges
modes_options_from_args_title = "Prueba de opciones de argumentos",
-- Grupos de argumentos
modes_needed_to_verify = "(obligatorio, se debe comprobar)",
modes_list_needed_args = "Lista de argumentos necesarios:",
modes_list_all_config_arguments = "Lista de argumentos de configuración:",
modes_list_all_system_arguments = "Lista de argumentos del sistema:",
modes_list_all_other_args = "Lista de los otros argumentos:",
-- Textos principales, errores y categorías de instrumentos
modes_language_cat = 'Hablando %1',
modes_date_months_names = "Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre",
modes_date_to_part_format = "dd mmmm yyyy",
modes_date_to_part_call_err = "Error interno: argumentos de llamadas anómala en fecha %1.",
modes_date_to_part_call_cat = "Módulo con error interno",
modes_date_to_part_not_found_err = "Error interno: No se encuentra en fecha %1.",
-- Control de argumentos
modes_error_list_header_err = "Asistencia de los parámetros de este modelo:",
modes_need_arg_value_err = "Error: Usted tiene que fijar este argumento necesario, pero falta: %1.",
modes_none_value_err = "Error: No hay argumento se ha definido.",
modes_unknown_argument_err = "Error: El parámetro %1 es desconocido en este modelo. Compruebe el nombre o reportar esta falta.",
modes_too_unnamed_arguments_err = "Error: Demasiado argumento sin nombre: %1 = %2.",
modes_without_translation_wsid_err = "Error interno: Informar al el desarrollador que el argumento interno %1 es desconocido en los registros.",
modes_is_defined_err = "El argumento %1:%2 está definido.",
modes_is_undefined_err = "El argumento %1:%2 no está definido.",
modes_args_values_err = "Valor anormal del argumento %1 = %2 entre: (%3) ",
modes_nearest_argument_err = "Error : ¿Es usted conocido argumento %1 ?",
modes_max_nearest_argument_msg = "Un argumento nombre más largo acepta más letras errores.",
modes_value_re_defined_err = "Error: El valor del argumento %1 ya está definido. Elija sólo un valor de un solo sinónimo",
modes_lang_table_err = "Error: La 1% idioma o su tabla es incorrecta.",
modes_lang_table_err_i_cat = "Módulo con error interno", -- modes_lang_table_err_i_cat
modes_lang_table_err_i_cat = "Módulo con lenguaje de argumentos erróneos", -- modes_no_source_arguments_cat
modes_lang_not_translated_err = "Error: El lenguaje %1 no se traduce.",
modes_generDoc1_paramName_err = "Error interno: en generDoc1, mal argumento %1.",
--
modes_unknown_auto_arg_err = "Error interno: Argumento desconocido automático: %1 = %2.",
modes_delete_docbox_wng = "Debe quitar esta documentación antes de grabar.
Retire todos los modos para volver al modo read.",
modes_auto_val_warning_wng = "Verifique el argumentos automáticos.",
--
modes_assist_user_param_err = "Apoyo al usuario para comprobar la configuración:",
modes_args_values_err = "Valor anormal del argumento %1 = %2 (%3)",
--
modes_no_known_arguments_err = "Error interno: Módulo sin tabla de argumentos conocidos.",
modes_no_known_arguments_i_cat = "Módulo sin tabla de argumentos conocidos.",
modes_no_source_arguments_err = "Error interno: Módulo sin tabla de argumentos fuentes.",
modes_no_source_arguments_i_cat = "Módulo sin tabla de argumentos fuente.",
modes_list_all_args_main_title = "modes.list_all_args_main() Lista de todos los argumentos aceptados",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Prueba de las distancias Levenshtein entre las palabras:",
modes_args_known_structure_title = "modes.args_known_structure() Definiciones de argumentos",
modes_args_unknown_report_title = "viewers.simple_list_test() Informar argumentos desconocidos",
modes_normal_box_main_text_1 = "Simple caja de información: Título de la página: %1, descripción: %2",
modes_normal_box_main_text_2 = "
Él era un %1, es nombrado %2 %3 había muerto en %4.",
-- Estos textos se utilizan para titular algunas pruebas.
modes_list_wiki_selectors_title = "Lista de las selectores de este modulo:",
modes_all_categories_list_title = "modes.all_categories_list() Lista de las posibles categorías de este modulo:",
modes_all_errors_list_title = "modes.all_errors_list() Lista de los errores detectables de este modulo:",
modes_multiple_values_tests_title = "modes.multiple_values() Prueba de múltiples valores argumentos",
modes_multiple_selection_tests_title = "modes.multiple_selection() Prueba de selección múltiple",
modes_multiple_selection_test_headers = "Opciones;Selector;Para seleccionar;Seleccionadas",
modes_multiple_selection_test_select = "2;nobel;presidente;diputado;precio",
modes_recursiveLevel_err = "Error de nivel recursivo %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Prueba: Normalizar el nivel recursivo y el límite recursiva",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Módulo, namespaces, y nombres de páginas:",
modes_args_known_report_title = "modes.args_known_report(t) Informe de los principales argumentos conocidos.",
modes_args_known_report_headers = "clave; valor; tipo; necesario; palabra clave; sinónimos; propiedad; formato; fuente",
} -- modes.i18n.es
modes.i18n.fr = {
-- Noms et descriptions des arguments de configurations
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Argument automatique de Wikidata.",
sitelink = 'sitelink',
sitelink_descr = "Argument automatique de Wikidata.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Langue du wiki.",
pagelang = "pagelang",
pagelang_descr = "Langue de la page.",
userlang = "userlang",
userlang_descr = "Language du lecteur de la page.",
--
QITEM = 'QITEM',
uri = 'uri',
itemid = 'itemid',
itemid_descr = "Identifiant des données de Wikidata, comme Q535
pour Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Autre identifiant des données de Wikidata, comme Q535
pour Victor Hugo.",
debug = 'debug',
category = 'Catégorie',
mode = "mode",
mode_descr = "Type d'utilisation du module ou du modèle : lire, éditer, documenter, tester.",
options = "options",
options_descr = "Options d'affichage d'un module ou d'un modèle.",
c = "c",
c_descr = "Options d'affichage d'un module ou d'un modèle.",
knownversions = "knownversions",
knownversions_descr = "Versions connues, pour les gérer.",
soughtversions = "soughtversions",
soughtversions_descr = "Versions demandées, pour les gérer.",
modes_form_ok_categ_tests = "Test de génération de catégorie OK",
-- Principaux textes, erreurs et catégories des outils
language = 'langue',
-- Messages et erreurs divers
modes_used_options_list_title = "modes.used_options_list() Utilisation des options :",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Modes et options en bref",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Test des options de modes", -- argschanges
modes_options_from_args_title = "Test des options des arguments",
-- Groupes d'arguments
modes_needed_to_verify = "(obligatoire, à vérifier)",
modes_list_needed_args = "Liste des arguments nécessaires :",
modes_list_all_config_arguments = "Liste des arguments de configuration :",
modes_list_all_system_arguments = "Liste des arguments système :",
modes_list_all_other_args = "Liste des autres arguments :",
modes_language_cat = 'Parle %1',
modes_date_months_names = "Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre",
modes_date_to_part_format = "dd yyyy mmmm",
modes_date_to_part_call_err = "Erreur interne : Argument anormal de définition de date %1.",
modes_date_to_part_call_cat = "Module avec erreur interne",
modes_date_to_part_not_found_err = "Erreur interne : partie non définie de date %1.",
-- Gestion des arguments
modes_error_list_header_err = "Assistance sur les paramètres de ce modèle :",
modes_need_arg_value_err = "Erreur : Vous devez définir cet argument nécessaire mais absent : %1.",
modes_none_value_err = "Erreur : Aucun argument n'a été défini.",
modes_unknown_argument_err = "Erreur : Le paramètre %1 est inconnu dans ce modèle. Vérifier ce nom ou signaler ce manque.",
modes_too_unnamed_arguments_err = "Erreur : Ce paramètre non nommé est en trop : %1 = %2.",
modes_without_translation_wsid_err = "Erreur interne : Signaler au développeur que l'argument interne %1 est inconnu dans les notices.",
modes_is_defined_err = "L'argument %1:%2 est défini.",
modes_is_undefined_err = "L'argument %1:%2 n'est pas défini.",
modes_args_values_err = "Valeur anormale de l'argument %1 = %2 parmi : (%3) ",
-- Messages et erreurs divers
modes_nearest_argument_err = "Erreur : Voulez vous l'argument connu %1 ?",
modes_max_nearest_argument_msg = "Un nom d'argument plus long accepte plus d'erreurs de lettres.",
modes_value_re_defined_err = "Erreur : La valeur de l'argument %1 est déjà définie. Choisir une seule valeur d'un seul synonyme.",
modes_lang_table_err = "Erreur interne : La langue %1 ou sa table est erronée.",
modes_lang_table_err_i_cat = "Module avec erreur interne", -- modes_no_source_arguments_cat
modes_lang_table_err_i_cat = "Module avec langue d'arguments erronée",
modes_lang_not_translated_err = "Erreur : La langue %1 n'est pas traduite.",
modes_generDoc1_paramName_err = "Erreur interne : en generDoc1, mauvais argument %1.",
modes_unknown_auto_arg_err = "Erreur interne: Argument automatique inconnu : %1 = %2.",
--
modes_delete_docbox_wng = "Vous devez supprimer cette documentation avant d'enregistrer.
Supprimez tous les modes pour revenir en mode read.",
modes_auto_val_warning_wng = "Vérifiez l'argument automatique.",
--
modes_assist_user_param_err = "Support aux utilisateurs pour vérifier les paramètres :",
modes_args_values_err = "Valeur anormale de l'argument %1 = %2 (%3)",
--
modes_no_known_arguments_err = "Erreur interne : Module sans table d'arguments connus.",
modes_no_known_arguments_i_cat = "Module sans table d'arguments connus.",
modes_no_source_arguments_err = "Erreur interne : Module sans table d'arguments sources.",
modes_no_source_arguments_i_cat = "Module sans table d'arguments source.",
--
modes_list_all_args_main_title = "modes.list_all_args_main() Liste de tous les arguments acceptés",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Test des distances de Levenshtein entre mots:",
modes_args_known_structure_title = "modes.args_known_structure() Définitions des arguments",
modes_args_unknown_report_title = "viewers.simple_list_test() Signaler les arguments inconnus",
modes_normal_box_main_text_1 = "Boîte d'information simple : titre de cette page %1, description : %2",
modes_normal_box_main_text_2 = "
Il était %1, se nommait %2 %3, il est mort en %4.",
-- Ces textes sont utilisés pour titrer des tests.
modes_list_wiki_selectors_title = "Liste des sélecteurs de ce module :",
modes_all_categories_list_title = "modes.all_categories_list() Liste des catégories éventuelles de ce module :",
modes_all_errors_list_title = "modes.all_errors_list() Liste des erreurs détectables de ce module :",
modes_multiple_values_tests_title = "modes.multiple_values() Test des arguments à valeurs multiples",
modes_multiple_selection_tests_title= "modes.multiple_selection() Test de sélection multiple",
modes_multiple_selection_test_headers= "Options;Sélecteur;À sélectionner;Sélectionnés",
modes_multiple_selection_test_select= "2;nobel;président;député;prix",
modes_recursiveLevel_err = "Erreur de niveau récursif %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Test: Normalise le niveau récursif et la limite récursive",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Module, namespaces, et noms de pages :",
modes_args_known_report_title = "modes.args_known_report(t) Rapport des principaux arguments connus.",
modes_args_known_report_headers = "clé; valeur; type; nécessaire; mot-clé; synonyme; propriété; format; source",
} -- modes.i18n.fr
modes.i18n.hu = {
-- Nombres y descripciones de argumentos de configuraciones
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Automatikus Wikidata argumentum.",
sitelink = 'sitelink',
sitelink_descr = "Automatikus Wikidata argumentum.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Wiki nyelv.",
pagelang = "pagelang",
pagelang_descr = "Az oldal nyelve.",
userlang = "userlang",
userlang_descr = "Az oldal olvasó nyelve.",
--
QITEM = 'QITEM',
uri = 'uri',
QITEM_descr = "Wikidata adatok neve, például Victor Hugo kódja Q535
.",
itemid = 'itemid',
itemid_descr = "Wikidata adatok neve, például Victor Hugo kódja Q535
.",
itemid2 = 'id',
itemid2_descr = "Wikidata adatok neve, például Victor Hugo kódja Q535
.",
debug = 'debug',
category = 'kategória',
mode = "modo",
mode_descr = "A modul vagy modell használata: olvasás, szerkesztés, dokumentum, tesztelés.",
options = 'opciones',
options_descr = "Egy modul vagy modell megjelenítési lehetőségei.",
c = "c",
c_descr = "Egy modul vagy modell megjelenítési lehetőségei.",
knownversions = "knownversions",
knownversions_descr = "Jól ismert verziók, kezelni őket.",
soughtversions = "soughtversions",
soughtversions_descr = "Kérjen változatokat, kezelni őket.",
-- Textos principales, errores y categorías de instrumentos
modes_form_ok_categ_tests = "OK kategória-generációs teszt",
--
-- Titres des pruebas
modes_used_options_list_title = "modes.used_options_list() Az opciók használata:",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Módok és lehetőségek röviden",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Tesztelési mód beállításai",
modes_options_from_args_title = "Tesztelési argumentum opciók",
-- Grupos de argumentos
modes_needed_to_verify = "(kötelező, ellenőrizze)",
modes_list_needed_args = "A szükséges érvek felsorolása:",
modes_list_all_config_arguments = "Konfigurációs argumentumok listája:",
modes_list_all_system_arguments = "Rendszer-érvek listája:",
modes_list_all_other_args = "Egyéb érvek felsorolása:",
-- Fő szövegek, hibák és műszerkategóriák
modes_language_cat = 'beszélő %1',
modes_date_months_names = "Január, február, március, április, május, június, július, augusztus, szeptember, október, november, december",
modes_date_to_part_format = "dd mmmm yyyy",
modes_date_to_part_call_err = "Belső hiba: anomáliás híváselméletek a dátumon %1.",
modes_date_to_part_call_cat = "Modul belső hibával",
modes_date_to_part_not_found_err = "Belső hiba: Nem található a dátumon %1.",
-- Control de argumentos
modes_error_list_header_err = "A modell paramétereinek támogatása:",
modes_need_arg_value_err = "Hiba: Meg kell oldanod ezt a szükséges érvet, de hiányzik: %1.",
modes_none_value_err = "Hiba: Nincs argumentum definiálva.",
modes_unknown_argument_err = "Hiba: A %1 paraméter ismeretlen ebben a modellben. Ellenőrizze a nevet vagy jelezze ezt a hibát.",
modes_too_unnamed_arguments_err = "Hiba: túl sok argumentum a név nélkül: %1 = %2.",
modes_without_translation_wsid_err = "Belső hiba: Tájékoztassa a fejlesztőt, hogy a %1 belső argumentum ismeretlen a rekordokban.",
modes_is_defined_err = "A argumentum %1:%2 definiálva van.",
modes_is_undefined_err = "A %1:%2 argumentum nincs meghatározva.",
modes_args_values_err = "Az argumentum abnormális értéke %1 = %2 között: (%3) ",
modes_nearest_argument_err = "Hiba: Ismeretes az argumentum %1 ?",
modes_max_nearest_argument_msg = "A hosszabb név argumentum több betűhibát is elfogad.",
modes_value_re_defined_err = "Hiba: Az %1 argumentum értéke már definiált. Válasszon csak egyetlen értéket egy szinonimának",
modes_lang_table_err = "Hiba: A %1 nyelv vagy annak táblája nem megfelelő.",
modes_lang_table_err_i_cat = "Modul belső hibával", -- modes_lang_table_err_i_cat
modes_lang_table_err_i_cat = "A téves érvek nyelvével rendelkező modul", -- modes_no_source_arguments_cat
modes_lang_not_translated_err = "Hiba: A nyelv %1 nem fordított le.",
modes_generDoc1_paramName_err = "Belső hiba: generDoc1-ben, rossz érv %1.",
--
modes_unknown_auto_arg_err = "Belső hiba: Automatikus ismeretlen argumentum: %1 = %2.",
modes_delete_docbox_wng = "Törölje a dokumentációt az égetés előtt.
Távolítsa el az összes módot, hogy visszatérjen az olvasási üzemmódba.",
modes_auto_val_warning_wng = "Ellenőrizze az automatikus érveket.",
--
modes_assist_user_param_err = "Felhasználói támogatás a konfiguráció ellenőrzéséhez:",
modes_args_values_err = "Az érv abnormális értéke %1 = %2 ( %3 )",
--
modes_no_known_arguments_err = "Belső hiba: Az ismert argumentumok táblázata nélküli modul.",
modes_no_known_arguments_i_cat = "Modul tábla nélkül ismert érvekkel.",
modes_no_source_arguments_err = "Belső hiba: A tábla argumentum nélküli tábla nélküli modul.",
modes_no_source_arguments_i_cat = "Modul forrás argumentum táblázattal.Modul forrás argumentum táblázattal.",
modes_list_all_args_main_title = "modes.list_all_args_main() Az elfogadott érvek listája",
modes_levenshtein_similar_tests_title= "modes.levenshtein() A távolságok igazolása Levenshtein entre las palabras:",
modes_args_known_structure_title = "modes.args_known_structure() Az érvek fogalommeghatározása",
modes_args_unknown_report_title = "viewers.simple_list_test() Ismeretlen érvek jelentése",
modes_normal_box_main_text_1 = "Egyszerű információs mező: Az oldal címe: %1, leírás: %2",
modes_normal_box_main_text_2 = "
%1 névvel %2 %3 meghalt %4.",
-- Ezeket a szövegeket néhány teszt tesztelésére használják.
modes_list_wiki_selectors_title = "Ebben a modulban a szelektorkészletek listája:",
modes_all_categories_list_title = "modes.all_categories_list() A modul lehetséges kategóriái:",
modes_all_errors_list_title = "modes.all_errors_list() A modulban észlelhető hibák felsorolása:",
modes_multiple_values_tests_title = "modes.multiple_values() Több argumentum értékének vizsgálata",
modes_multiple_selection_tests_title= "modes.multiple_selection() Többszörös kiválasztási teszt",
modes_multiple_selection_test_headers= "Opciók; Kiválasztó; Kiválasztás; Kiválasztott",
modes_multiple_selection_test_select= "2; Nobel; elnök; helyettese; ár",
modes_recursiveLevel_err = "Rekurzív szint hiba %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Teszt: Normalizálja a rekurzív szintet és a rekurzív határt",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Modul, névterek és oldalnevek:",
modes_args_known_report_title = "modes.args_known_report(t) A legfontosabb ismert érvekről szóló jelentés.",
modes_args_known_report_headers = "kulcs; érték; írja; szükséges; kulcsszó; fordítása; tulajdon; formátumban; forrás",
} -- modes.i18n.hu
modes.i18n.vi = {
-- Noms et descriptions des arguments de configurations
[1] = "1",
[2] = "2",
[3] = "3",
[4] = "4",
["modules_guide"] = "Argument modules_guide",
label = 'label',
label_descr = "Đối số tự động để Wikidata.",
sitelink = 'sitelink',
sitelink_descr = "Đối số tự động để Wikidata.",
-- Languages
contentlang = "contentlang",
contentlang_descr = "Ngôn ngữ wiki.",
pagelang = "pagelang",
pagelang_descr = "Ngôn ngữ trang.",
userlang = "userlang",
userlang_descr = "Ngôn ngữ để người đọc trang.",
--
QITEM = 'QITEM',
uri = 'uri',
itemid = 'itemid',
itemid_descr = "Định danh dữ liệu Wikidata, chẳng hạn như Q535
để Victor Hugo.",
itemid2 = 'id',
itemid2_descr = "Số nhận dạng khác để dữ liệu Wikidata, chẳng hạn như Q535
để Victor Hugo.",
debug = 'gỡ lỗi',
category = 'Loại',
mode = "mode",
mode_descr = "Loại sử dụng mô-đun hoặc mô hình: đọc, chỉnh sửa, tài liệu, kiểm tra.",
options = "options",
options_descr = "Hiển thị tùy chọn mô-đun hoặc mô hình.",
c = "c",
c_descr = "Hiển thị tùy chọn mô-đun hoặc mô hình.",
knownversions = "knownversions",
knownversions_descr = "Các phiên bản đã biết, để quản lý chúng.",
soughtversions = "soughtversions",
soughtversions_descr = "Các phiên bản được yêu cầu, để quản lý chúng.",
-- Principaux textes, erreurs et catégories des outils
language = 'langue',
-- Messages et erreurs divers
modes_used_options_list_title = "modes.used_options_list() Sử dụng các tùy chọn:",
modes_options_uses_tests_title = "modes.options_from_mode_tests() Chế độ và tùy chọn trong ngắn hạn",
versions_bind_arguments_tests_title = "modes.options_from_args_tests() Tùy chọn chế độ thử nghiệm",
modes_options_from_args_title = "Kiểm tra đối số tùy chọn",
-- Groupes d'arguments
modes_needed_to_verify = "(bắt buộc, phải được xác minh)",
modes_list_needed_args = "Danh sách các đối số cần thiết:",
modes_list_all_config_arguments = "Danh sách các đối số cấu hình:",
modes_list_all_system_arguments = "Danh sách các đối số hệ thống:",
modes_list_all_other_args = "Danh sách các đối số khác:",
modes_language_cat = 'Nói tiếng %1',
modes_date_months_names = "Tháng 1, tháng 2, tháng 3, tháng 4, tháng 5, tháng 6, tháng 7, tháng 9, tháng 10, tháng 11, tháng 12",
modes_date_to_part_format = "dd yyyy mmmm",
modes_date_to_part_call_err = "Lỗi nội bộ: Đối số định nghĩa ngày bất thường %1.",
modes_date_to_part_call_cat = "Mô-đun có lỗi nội bộ",
modes_date_to_part_not_found_err = "Lỗi nội bộ: phần không xác định để ngày %1.",
-- Gestion des arguments
modes_error_list_header_err = "Hỗ trợ các thông số để mô hình này:",
modes_need_arg_value_err = "Lỗi: Bạn phải đặt đối số cần thiết nhưng vắng mặt này: %1.",
modes_none_value_err = "Lỗi: Không có đối số nào được xác định.",
modes_unknown_argument_err = "Lỗi: Thông số %1 không xác định trong mẫu này. Kiểm tra tên này hoặc báo cáo sự thiếu này.",
modes_too_unnamed_arguments_err = "Lỗi: Tham số chưa đặt tên này vượt quá: %1 = %2.",
modes_without_translation_wsid_err = "Lỗi nội bộ: Báo cáo cho nhà phát triển rằng đối số nội bộ %1 không xác định trong các bản ghi.",
modes_is_defined_err = "Đối số %1:%2 được đặt.",
modes_is_undefined_err = "Đối số %1:%2 không được xác định.",
modes_args_values_err = "Giá trị bất thường để đối số %1 = %2 từ: ( %3 ) ",
-- Messages et erreurs divers
modes_nearest_argument_err = "Lỗi: Bạn có muốn đối số %1 đã biết không?",
modes_max_nearest_argument_msg = "Tên đối số dài hơn chấp nhận nhiều lỗi thư hơn.",
modes_value_re_defined_err = "Lỗi: Giá trị để đối số %1 đã được đặt. Chọn một giá trị duy nhất từ một từ đồng nghĩa duy nhất.",
modes_lang_table_err = "Lỗi nội bộ: Ngôn ngữ %1 hoặc bảng để nó sai.", -- để=để
modes_lang_table_err_i_cat = "Mô-đun có lỗi nội bộ", -- modes_no_source_arguments_cat
modes_lang_table_err_i_cat = "Mô-đun với ngôn ngữ đối số sai",
modes_lang_not_translated_err = "Lỗi: Ngôn ngữ %1 không được dịch.",
modes_generDoc1_paramName_err = "Lỗi nội bộ: trong generDoc1, đối số không hợp lệ %1.",
modes_unknown_auto_arg_err = "Lỗi nội bộ: Đối số tự động không xác định: %1 = %2.",
--
modes_delete_docbox_wng = "Bạn phải xóa tài liệu này trước khi lưu.
Xóa tất cả các chế độ để trở về chế độ đọc.",
modes_auto_val_warning_wng = "Kiểm tra đối số tự động.",
--
modes_assist_user_param_err = "Hỗ trợ người dùng để kiểm tra cài đặt:",
modes_args_values_err = "Giá trị bất thường để đối số %1 = %2 ( %3 )",
--
modes_no_known_arguments_err = "Lỗi nội bộ: Mô-đun không có bảng các đối số đã biết.",
modes_no_known_arguments_i_cat = "Mô-đun không có bảng các đối số đã biết.",
modes_no_source_arguments_err = "Lỗi nội bộ: Mô-đun không có bảng đối số nguồn.",
modes_no_source_arguments_i_cat = "Mô-đun không có bảng đối số nguồn.",
--
modes_list_all_args_main_title = "modes.list_all_args_main() Danh sách tất cả các đối số được chấp nhận",
modes_levenshtein_similar_tests_title = "modes.levenshtein() Kiểm tra khoảng cách Levenshtein entre mots:",
modes_args_known_structure_title = "modes.args_known_structure() Định nghĩa đối số",
modes_args_unknown_report_title = "viewers.simple_list_test() Báo cáo đối số không xác định",
modes_normal_box_main_text_1 = "Hộp thông tin đơn giản: tiêu đề để trang này %1, mô tả: %2",
modes_normal_box_main_text_2 = "
Anh ta %1, tên anh ta %2 %3, anh ta đã chết %4.",
-- Ces textes sont utilisés pour titrer des tests.
modes_list_wiki_selectors_title = "Danh sách các bộ chọn để mô-đun này:",
modes_all_categories_list_title = "modes.all_categories_list() Danh sách các danh mục có thể có để mô-đun này:",
modes_all_errors_list_title = "modes.all_errors_list() Danh sách các lỗi có thể phát hiện trong mô-đun này:",
modes_multiple_values_tests_title = "modes.multiple_values() Thử nghiệm đối số nhiều giá trị",
modes_multiple_selection_tests_title= "modes.multiple_selection() Kiểm tra nhiều lựa chọn",
modes_multiple_selection_test_headers= "Tùy chọn; Bộ chọn; Để chọn; Đã chọn",
modes_multiple_selection_test_select= "2; nobel; chủ tịch; Phó; giá",
modes_recursiveLevel_err = "Lỗi mức đệ quy %1 > %2",
modes_recursive_normal_tests_title = "modes.recursive_normal() Kiểm tra: Bình thường hóa mức đệ quy và giới hạn đệ quy",
modes_namespaces_page_list_title = "modes.namespaces_page_list() Mô-đun, namespaces, và tên trang:",
modes_args_known_report_title = "modes.args_known_report(t) Báo cáo để các đối số được biết đến chính.",
modes_args_known_report_headers = "chính; giá trị; loại; cần thiết; từ khóa; đồng nghĩa; bất động sản; định dạng; nguồn",
} -- modes.i18n.vi
-- - - - ------------------ - - - - --------------------------------- -- Support of the management of options. Sostén de la gestión de las opciones. Soutien de la gestion des options. -- - - - ------------------ - - - - ---------------------------------
modes.options_for_modes = { -- default options_for_modes read = " box1 ", edit = " box1 docdef docline docsrc docdata catview docview : ", doc = " nobox1 noerr nocatview ", tests = " box1 docdef docline docsrc docdata catview docview : tests ", -- List of parameters for module documentation -- "docview" or ":" add the documentation panel -- "docmin" list only some basic parameters -- "docdef" list only the parameters defined, having a non-zero value -- "docmax" list all known parameters -- "docnotice" generate documentations of records -- "docline" put all parameters on a single line -- "docsrc" put the parameters in colors according to the sources -- modes.options = " docdata docmin docdef docmax docline docview docafter docnotice docsrc : " -- for standard documentation -- modes.options = " erron noerr nobox1 nocatview " -- do not form normal result -- modes.options = " debug tests en es fr " -- enforce a language for debug -- Option nocatview means "Do not categorize and do not show categories." }
-- Manage Library:modes options. Administrar opciones. Gérer les options. modes.template_options = "" -- Normal options from the template, like Modèle:Bananas. modes.mode_options = "" -- Internal options from the mode. modes.available_options = "" -- table to collect all available options, at any time. modes.used_options = {} -- table to collect really or tested options then list them at end of tests.
mathroman.args_known = { -- Table of the definitions of all known arguments at module level. -- Arguments in order without names, with their keyword for use as other arguments. [1] = {need = 0, syn = 2, keyword = "mode"}, -- Special arguments to modify the fonctions and outputs of this module. mode = {typ = "config", need = 0, keyword = "mode"}, c = {typ = "config", need = 0, keyword = "c"}, options = {typ = "config", need = 0, keyword = "options"}, -- The userlang argument permits at an administrator in his own langage (errors, warnings, catégories, tests) to help a wiki in any language. contentlang = {typ = "config", need = 1, keyword = "contentlang"}, pagelang = {typ = "config", need = 2, keyword = "pagelang"}, userlang = {typ = "config", need = 0, keyword = "userlang"}, birthyear = {typ = "dat", need = 0, keyword = "birthyear", prop = "P569", format = "year"}, }
function modes.bind_args_known_props(args_known, args_new) -- Bind known args and their properties for central libraries. Later for modules. local args_known = args_known or modes.args_known or p.args_known or {} if (type(args_known) ~= "table") then return {} end local args_known_one = {} if (type(args_new) ~= "table") then return args_known end for key, props in pairs(args_new) do -- import and mix known args and properties if (type(props) == "table") then args_known_one[key] = props or args_known[key] props.key = key end -- Add properties for a new argument end return args_known_one end -- local args_known_props = modes.bind_args_known_props(args_known, args_new)
function modes.args_known_one_lib(args_known, args_new) -- Bind known args and their properties for central libraries. Later for modules. local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- } if (type(args_known) ~= "table") then return {} end local args_known_props = {} for key, one_lib in pairs(args_new) do -- import and mix known args and properties if (type(one_lib) == "table") then bind_args = modes.bind_args_known_props(args_known, args_new) args_known_props = modes.bind_args_known_props(modes.args_known, args_new) end end return args_known_props end -- function modes.args_known_one_lib(args_known, args_new)
function modes.bind_args_known_one_lib_report(t) -- Reports the binding of one library known arguments.
local memo = viewers.save_configs("modes.bind_args_known_one_lib_report") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* bind_args_known_one_lib_report(t) : Reports the binding of one library known arguments' end
local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- }
local args_known_props = modes.args_known_one_lib(modes.args_known, mathroman.args_known)
t = t .. "\n* " .. viewers.ta("#args_known_props", lua_table.level_count(args_known_props) )
if (type(args_known) ~= "table") then return args_known end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.bind_args_known_one_lib_report(t) Reports the binding of one library known arguments",
test_group = args_known,
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { viewers.value(case.key), case.bind, case.typ, case.need, case.keyword, case.prop, case.format, }
end,
headers = "modes_bind_args_known_report_headers", -- "key;bind;typ;need;keyword;prop;format"
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "modes.bind_args_known_one_lib_report") -- Restore global configurations after eventual changes.
return t
end -- function modes.bind_args_known_one_lib_report(t)
function lua_table.sort_onkey(tab, key) -- Sort a table with any types of keys. -- local tab = tab or {} -- keep table errors to permit to debug local key = key or "keyword" return table.sort(tab, function (a, b) if (type(a[key]) == type(b[key])) then return ( a[key] < b[key] ) -- any translated arguments of same types else return ( tostring(a[key]) < tostring(b[key]) ) end -- alphabetic sort of translated arguments end ) end
function modes.args_known_report(t, args_known) -- Reports of main known arguments.
local memo = viewers.save_configs("modes.args_known_report") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.args_known_report(t, args_known) : Reports of main known arguments' end
local args_known = args_known or modes.args_known or p.args_known or {} -- modes.args_known = { -- p.args_known = { -- }
local args_group = {} -- modes.args_known = { -- p.args_known = { -- }
for key, tab in pairs(args_known) do -- import and mix known args and properties
table.insert( args_group, tab )
end
local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page. ric
table.sort(props, function (a, b) return ( (a.keyword or a.prop) < (b.keyword or b.prop)) end ) -- alphabetic sort of translated arguments
t = t .. "\n* " .. viewers.ta("args_known count", lua_table.level_count(args_known) )
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.args_known_report(t) Report of main known args",
test_group = args_group, -- tab_view.test_group or
headers = "modes_args_known_report_headers", -- headers = "key; val; type; need; keyword; syn; prop; format; source",
form_one_case = function(case) -- Convert a case from test_group to rowGroup. tab_view.form_one_case or
return { (case.keyword), (case.val or "-"), case.typ, case.need, case.keyword, case.syn, case.prop, case.format, case.src, }
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "modes.args_known_report") -- Restore global configurations after eventual changes.
return t
end -- function modes.args_known_report(t, args_known)
function modes.init_options(template_options) -- modes.template_options = modes.init_options(args.options) -- modes.template_options = modes.init_options("fr params docview docmin docmax docdef docnotice docafter docline docsrc") if (type(template_options) == "string") then modes.template_options = template_options end if (type(modes.template_options) ~= "string") then modes.template_options = "" end -- Early effects on options which modify other ones. -- modes.options = " : docdata docmin docdef docmax docline docview docafter docnotice docsrc" -- for documentation -- modes.options = " erron noerr nobox1 nocatview " -- without normal result -- modes.options = " debug tests en es fr " -- for debug or enforce language modes.options_to_cat_view() if modes.option("noerr") then events.erron = false end if modes.option("erron") then events.erron = true end if modes.option("docolor") then modes.docolor = true end -- If an option is a language, enable this language for the user. -- Si una opción es un lenguaje, activar esta lengua para usuario. -- Si une option est une langue, activer cette langue pour l'utilisateur. for lang, tab in pairs(versions.i18n) do if modes.option(lang) then langs.init_content_page_user_lang(langs.content_lang, xx, yy, lang) -- langs.content_lang, langs.user_lang end end return modes.template_options end -- function modes.init_options(template_options)
function modes.options_from_mode(mode_name, options_for_modes) modes.options_for_modes = options_for_modes or modes.options_for_modes modes.mode_name = mode_name or modes.mode_name or "read" if modes.options_for_modes and modes.options_for_modes[mode_name] then modes.mode_options = modes.options_for_modes[mode_name] end return modes.mode_options, mode_name end
function modes.option(key, opt) -- Is one option in available options? -- Language identifiers allow to enforce some languages. -- Errors appear only in Template or Module namespace, waiting the task T53660. if type(key) ~= "string" then key = "" end key = mw.text.trim(key) if type(opt) ~= "string" then opt = "" end opt = mw.text.trim(opt) local available_options = (modes.template_options or "") if available_options and modes.mode_options -- other param can replace modes.mode_options then available_options = " " .. available_options .. " " .. modes.mode_options .. " " elseif available_options and opt then available_options = " " .. available_options .. " " .. opt .. " " end available_options = viewers.simple_list(available_options, " ") -- The searched keyword is it among the options words? And not included in another word. local ifyes = viewers.is_in_sp(key or "", available_options) -- and true -- Collect options tested along the execution of the module modes.used_options = modes.used_options or {} if ifyes then modes.used_options[key] = "y" else modes.used_options[key] = "n" end local used = "" for key, xx in pairs(modes.used_options) do if xx == "y" then used = used .. ", " .. tostring(key) .. " " .. xx else used = used .. " " .. tostring(key) .. ", " .. xx end end modes.available_options = available_options modes.used_opts = used -- yes is not nil return ifyes, used, available_options -- yes is not nil end -- function modes.option(key, opt)
function modes.options_from_mode_tests(t) -- Tests the options of the defined modes
local memo = viewers.save_configs("modes.options_from_mode_tests") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.options_from_mode_tests(t) : Tests the options of the defined modes' end
for md, opt in pairs(modes.options_for_modes) do t = t .. "
- " .. viewers.ta(md, opt) end
t = t .. viewers.table_head() .. viewers.table_col("Mode") .. viewers.table_col("List of options") .. viewers.table_col("noerr value") .. viewers.table_col("docview value") .. viewers.table_col("tests value")
local function test_options_from_mode(md, op1, op2, op3)
modes.available_options = ""
local opstest = modes.options_from_mode(md) or ""
return viewers.table_row() .. viewers.table_dat(md) .. viewers.table_dat(opstest) .. viewers.table_dat( modes.option(op1, opstest) )
.. viewers.table_dat(modes.option(op2, opstest)) .. viewers.table_dat(modes.option(op3, opstest))
end
t = t .. "
options_from_mode_test:"
t = t .. test_options_from_mode("read", "noerr", "docview", "tests")
t = t .. test_options_from_mode("edit", "noerr", "docview", "tests")
t = t .. test_options_from_mode("tests", "noerr", "docview", "tests")
t = t .. viewers.table_end()
viewers.restore_configs(memo, "modes.options_from_mode_tests") -- Restore global configurations after eventual changes.
return t
end -- function modes.options_from_mode_tests(t)
function modes.used_options_list(t, used_options) -- Lists the options of the actual mode
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.used_options_list(t, used_options) : Lists the options of the actual mode' end
used_options = used_options or modes.used_options
modes.mode_name = mode_name or modes.mode_name or "read"
for md, opt in pairs(modes.options_for_modes) do t = t .. "
- " .. viewers.ta(md, opt) end
-- List of used options after collect them
t = t .. "\n* " .. viewers.form9user("langs_content_page_user_lang_msg", langs.user_lang, langs.content_lang)
t = t .. "\n* Actual mode: " .. modes.mode_name .. ""
t = t .. "\n* Options read the last time in these tests, ones activated are in bold: "
t = t .. "\n* Options lues pour la dernière fois pendant ces tests, celles activées sont en gras : "
t = t .. "
"
local used = ""
for key, x in pairs(modes.used_options) do
if x == "y" then used = used .. ", " .. tostring(key) .. " "
else used = used .. ", " .. tostring(key) .. " " end
end
t = t .. used
return t, used
end
function modes.options_to_cat_view() -- Init or restaure modes.cat_view = modes.cat_view from options if modes.option(":") or modes.option("catview") then modes.cat_view = ":" else modes.cat_view = "" end return modes.cat_view end -- function modes.options_to_cat_view()
function modes.options_from_args_tests(t) -- Tests various options to display or not: box, categories, documentation, and in which language local memo = viewers.save_configs("modes.options_from_args_tests") -- Save global configuration before eventual changes. local mode_options_memo = modes.mode_options -- save local template_options_memo = modes.template_options -- save local used_options_memo = mw.clone(modes.used_options) -- save modes.used_options = {} -- for test local t = t -- t or if (type(t) ~= "string") then t = '\n* modes.options_from_args_tests(t) : Tests various options to display or not: box, categories, documentation, and in which language' end t = t .. viewers.table_head() .. viewers.table_col("mode_options") .. viewers.table_col("template_options") .. viewers.table_col("opt can replace mode_options") .. viewers.table_col("available options") .. viewers.table_col("option result") .. viewers.table_col("valid result") local function options_from_args(mode_options, template_options, opt, key, verif) modes.available_options = "" modes.mode_options = mode_options or "" modes.template_options = template_options or "" local ifyes, available_options = modes.option(key, opt) local testOK = "" if tostring(ifyes) == tostring(verif) then testOK = "true" else testOK = "false" end return viewers.table_row() .. viewers.table_dat( mode_options or "" ) .. viewers.table_dat( template_options or "" ) .. viewers.table_dat( opt or "" ) .. viewers.table_dat( modes.available_options ) .. viewers.table_dat( viewers.ta(key, ifyes) ) .. viewers.table_dat( testOK ) end t = t .. options_from_args("nobox1 nocatview", "en docview", nil, "nobox1", "true") t = t .. options_from_args("nobox1 nocatview", "en docview", nil, "nocatview", "true") t = t .. options_from_args("nobox1 nocatview", "en docview", nil, "en", "true") t = t .. options_from_args("nobox1 nocatview", "en docview", nil, "docview", "true") t = t .. options_from_args("nobox1 nocatview", ": docview", nil, ":", "true") t = t .. options_from_args("nobox1 nocatview", "en docview", "docline fr", "docline", "false") t = t .. options_from_args("nobox1 nocatview", "en docview", "docline fr", "docline", "false") t = t .. options_from_args(" ", nil, "docline fr", "docline", "false") t = t .. options_from_args(" ", nil, "docline fr", "fr", "false") t = t .. options_from_args(" ", "en docview", "docline fr", "en", "true") t = t .. options_from_args("nobox1 nocatview", nil, "docline fr", "docline", "false") t = t .. options_from_args("nobox1 nocatview", "en docview", "docline fr", nil, "true") t = t .. options_from_args("nobox1 nocatview", "en docview", nil, "docline", "false") t = t .. viewers.table_end() t = t .. modes.used_options_list(nil, modes.used_options) t = t .. "\n* After these tests, previous options are restored. Après ces tests, les options antérieures sont restaurés." modes.mode_options = mode_options_memo -- restore modes.template_options = template_options_memo -- restore modes.used_options = used_options_memo -- restore viewers.restore_configs(memo, "modes.options_from_args_tests") -- Restore global configurations after eventual changes. return t end -- function modes.options_from_args_tests(t)
function modes.change_itemid(id_in) -- Select a wikidata default item if needed. local id = "" if id_in then -- Local function parameter have priority. id = id_in else -- Else use the template arguments or inforce QITEM here. id = modes.args_source.id -- Nicolas Flamel (Q41568), alchimie Victor Hugo (Q535) très connu, Montaigne (Q41568) education, Dr Ludwik Zamenhof (Q11758) esperanto UMUM end local nst = 10 -- mw.site.namespaces.Template local nsm = 828 -- mw.site.namespaces.Module local mwtitle = mw.title.getCurrentTitle() modes.main_title = mwtitle.text -- Server mw.uri.new local nsX = mw.title.getCurrentTitle():inNamespaces("10", "11", "828", "829") local nsX = mwtitle:inNamespaces("10", "11", "828", "829") local ns = tostring(mw.site.namespaces.id) if viewers.is_in_sp(ns, "10;11;828;829", ";") then -- Change QITEM only where title cannot be in wikidata. id = id or modes.main_title or modes.args_template.title or modes.args_template.QITEM or modes.args_template.label or modes.args_template.itemid end return id end -- function modes.change_itemid(id_in)
function modes.args_known_structure(t, args_known) -- Formats the standard options for all arguments defined as text local t = t -- t or if (type(t) ~= "string") then t = '\n* modes.args_known_structure(t, args_known) : Formats the standard options for all arguments defined as text' end local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { } if type(args_known) == "table" then for key, elem in pairs(args_known) do t = t .. viewers.tam("typ", elem.typ) .. viewers.tam("keyword", elem.keyword) .. viewers.tam("syn", elem.syn) t = t .. viewers.tam("need", elem.need) .. viewers.tam("prop", elem.prop) .. viewers.tam("format", elem.format) t = t .. string.sub(t, 3, -1) t = t .. '\n: ' .. tostring(key) .. ' = { ' .. t .. ' } ' end end return t end -- function modes.args_known_structure(t, args_known)
function modes.levenshtein(word1, word2) -- Compute the Levenshtein distance between 2 ASCII words.
-- prevent exceptions
local cout = 0
if (type(word1) ~= "string") or (type(word2) ~= "string") then
return 999, "
lev: " .. viewers.ta("word1", word1) .. viewers.ta("word2", word2)
end
local len1 = string.len(word1)
local len2 = string.len(word2)
local lev = 0
local t = "
lev: " .. viewers.ta("word1", word1) .. viewers.ta("word2", word2)
if (type(word1) ~= "string") or (type(word2) ~= "string") or (word1 == "") or (word2 == "") then
lev = len1 + len2
return lev, t .. viewers.ta("lev", lev)
end
-- simple case
if (word1 == word2) then
lev = 0
return lev, t .. viewers.ta("lev", lev)
end
local d = {}
for i = 1, len1+2 do -- for i = 1, len1-1+1 do
d[i] = {}
-- d[i][1] = 0 -- d[i][1] = i
for j = 1, len2+2 do
-- d[i][j] = {}
d[i][j] = 0 -- d[1][j] = j
end
end
-- simulate double dimensions tables
for i = 2, len1+1 do -- for i = 1, len1-1+1 do
-- d[i] = {}
d[i][1] = i-1 -- d[i][1] = i
end
for j = 2, len2+1 do
d[1][j] = j-1 -- d[1][j] = j
end
for i = 2, len1+1 do -- for i = 2, len1+1 do
for j = 2, len2+1 do -- for j = 2, len2+1 do
-- we recover the two characters
local c1 = string.byte(word1, i-1)
local c2 = string.byte(word2, j-1)
if (c1 == c2) then
cout = 0
d[i][j] = d[i-1][j-1]
else
cout = 1
d[i][j] = math.min(d[i-1][j], d[i][j-1], d[i-1][j-1]) + 1
end
-- d[i][j] = math.min(d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1]+cout)
end
end
local lev = d[len1+1][len2+1] -- return d[len1-1][len2] - 1
return lev, t .. viewers.ta("lev", lev)
end -- function modes.levenshtein(word1, word2)
function modes.levenshtein_similar_tests(t) -- Tests of the Levenshtein distance between 2 ASCII words
local memo = viewers.save_configs("modes.levenshtein_similar_tests") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.levenshtein_similar_tests(t) : Tests of the Levenshtein distance between 2 ASCII words' end
t = t .. "\n* " .. "Formula to compute the near words limit: Formule de calcul de limite des mots proches : "
local errors, key, argsyn, arglingual, txt = ""
t = t .. "\n* List of diffmaxi / lengths : "
local diffmaxi
for i = 1, 10 do
diffmaxi, tt = modes.similar_args_diffmaxi( string.sub("azertyuiopqsdfghjklm", 1, i), "azertyuiopqsdfghjklm") -- Format a string from the formula
modes.length_from_i[i] = diffmaxi
t = t .. viewers.ta(tostring(i), diffmaxi)
end
local diffmaxi, tt = modes.similar_args_diffmaxi(10, t .. "diffmaxi = ")
local group_test = { -- events.test_group
{ try = "nom", correct = "nom", },
{ try = "nom", correct = "Nom", },
{ try = "top", correct = "pot", },
{ try = "ami", correct = "amis", },
{ try = "nom", correct = "name", },
{ try = "m", correct = "mu", },
{ try = "m", correct = "mur", },
{ try = "mur", correct = "m", },
{ try = "c", correct = "c", },
{ try = "c", correct = "long", },
{ try = "xxx", correct = " ", },
{ try = "", correct = "xyz", },
{ try = "xxx", correct = "xyz", },
{ try = "prénom", correct = "Prenom", },
{ try = "catégorie", correct = "Category", },
{ try = "description", correct = "Description", },
{ try = "anneeDeces", correct = "anneeNaissance", },
{ try = "avant-après", correct = "après-avant", },
}
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.levenshtein_similar_tests(t) -- Tests of the Levenshtein distance between 2 ASCII words",
test_group = group_test,
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
case.try_length = string.len(case.try)
case.correct_length = string.len(case.correct)
case.diffmaxi = modes.similar_args_diffmaxi( string.len(case.try) )
case.diff = modes.similar_args_diffmaxi(case.correct)
if case.diff > case.diffmaxi then case.errors = viewers.usual_color(case.correct, "error") end
return { case.try, case.try_length, case.correct, case.correct_length, case.errors }
end,
headers = "try; try_length; correct; correct_length; error", -- Test Normalize recursiveLevel and recursive_limit
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
t = t .. "\n* levenshtein_test errors = " .. viewers.styles_color_error(errors)
return t
end -- function modes.levenshtein_similar_tests( res, c)
modes.constants = modes.constants or {} -- Similar words search : diff on length -- Cerrar de palabras puscadas: diff en longitud -- Recherche de mots proches: diff sur longueur modes.constants.near_word_search_diff_coef = 0.30 -- Access to change these constants from anywhere. modes.constants.near_word_search_diff_const = 0.82
-- Maximum number of different letters between 2 argument names -- Número máximo de letras diferentes entre 2 nombres de argumento -- Nombre maximum de lettres différentes entre deux noms d'arguments modes.length_from_i = {} -- Format a string from the formula function modes.similar_args_diffmaxi(word, t) -- Format a string from the formula local coef = modes.constants.near_word_search_diff_coef or 0.30 local constant = modes.constants.near_word_search_diff_const or 0.82 local word = tostring(word) local length = string.len(word) local diffmaxi = math.floor( coef * length + constant ) if type(t) == "string" then t = t .. tostring(coef) .. " * length + " .. tostring(constant) else t = "" end return diffmaxi, t end -- local diffmaxi, t = function modes.similar_args_diffmaxi(word, t) -- Format a string from the formula
-- For an unknown argument, seeks the name of the closest among the known arguments translated function modes.similar_args_list(args_known) local list, arglingual = {}, "xxx" local args_known = args_known or modes.args_known or p.args_known or {} if type(args_known) ~= "table" then return "similar_args_list", 1 end for key, argm in pairs(args_known) do -- List only all known arguments if not tonumber(key) then -- For named arguments only key = tostring(key) arglingual = tostring(langs.content_lang[key]) list[key] = arglingual end end return list end -- function modes.similar_args_list(args_known)
-- Check if the value of an argument is among the possible values. -- Vérifier si la valeur d'un argument est parmi les valeurs possibles. -- local ... = modes.multiple_values(test.argm, test.argvalue, test.args_known) function modes.multiple_values(argname, argvalue, args_known, args_known) if type(args_known) ~= "table" then args_known = modes.args_known or {} end local args_known = args_known or modes.args_known or p.args_known or {} local argvalue = argvalue or args_known[argname] local arg_values, key_values, keyword, keyval, argval, rank local argmt = args_known[argname] if argmt then arg_values = langs.content_translations[argmt.arg_values] or "" -- example "no;nada;cn;50;us;70;mpf" in local language key_values = argmt.key_values or "" -- example "no;none;cn;50;us;70;mpf" in referal english end if type(arg_values) == "string" and type(key_values) == "string" then local arg_tab = mw.text.split(arg_values, ';') -- table of argmt local key_tab = mw.text.split(key_values, ';') -- table of key -- Default values keyword = nil rank = 0 -- rank of local value and key value keyval = nil -- key value argval = nil if argmt and arg_values and argvalue then for i, key in ipairs(arg_tab) do if key == argvalue then -- Search argvalue in arg_tab rank = i keyval = key_tab[i] -- Return correponding keyval in key_tab argval = argvalue keyword = argmt.keyword end end end end return keyword, keyval, argval, rank, arg_values end -- function modes.multiple_values(argname, argvalue, args_known, args_known)
function modes.multiple_values_tests(t) -- Tests the conversion of a text into a word table local t = t -- t or if (type(t) ~= "string") then t = '\n* modes.multiple_values_tests(t) : Tests the conversion of a text into a word table' end local group_test = { -- events.test_group { argm = "region", argvalue = "inde", }, { argm = "region", argvalue = nil, }, { argm = "rights", argvalue = "mpf", }, { argm = "rights", argvalue = "non", }, { argm = "rights", argvalue = nil, }, { argm = "sex", argvalue = "femme", }, { argm = "sex", argvalue = "homme", }, { argm = "sex", argvalue = "enfant", }, } local rowGroup = {} if type(group_test) == "table" then for i, test in ipairs(group_test) do local keyword, keyval, argval, rank, arg_values = modes.multiple_values(test.argm, test.argvalue, test.args_known) table.insert( rowGroup, { ["keyword"] = keyword, ["keyval"] = keyval, ["argval"] = argval, ["rank"] = rank, ["arg_values"] = arg_values } ) end else t = t .. "error : multiple_values_tests has no table. " end local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "modes.multiple_values_tests(t) -- Tests the conversion of a text into a word table", test_group = rowGroup, form_one_case = function(case) -- Convert a case from test_group to rowGroup. return { case.keyword, case.keyval, case.argval, case.rank, case.arg_values, } end, headers = "keyword; keyval; argval; rank; values", -- Test Normalize recursiveLevel and recursive_limit headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Formats a table with lines and columns. return t end -- function modes.multiple_values_tests(t)
function modes.multiple_selection(opt, selector, to_select) -- Select items to selector containing selecting items local t, selected_txt, selector_txt, selector_tab, to_select_txt, to_select_tab, selected_tab = "", "" local cut = string.sub( opt, 1, 1 ) or ";" if type(selector) == "table" then selector_tab = selector end if type(selector) == "string" then selector_tab = mw.text.split(selector, cut, true) end if type(to_select) == "table" then to_select_tab = clone(to_select) end if type(to_select) == "string" then to_select_tab = mw.text.split(to_select, cut, true) end selected_tab = {} local k, Nsel, N, maxi, pos = 0, 0, 1, 999, nil local reject_select = false local equal = true for i, selector in ipairs(selector_tab) do -- selector authorities only following selectors if Nsel >= maxi then break end selector = mw.text.trim(selector) N = tonumber(selector) if selector == "+" then -- selector all items for key, val in pairs(to_select_tab) do Nsel = Nsel + 1 selected_tab[key] = val end elseif selector == "-" then -- minus sign rejects all reject_select = true elseif N and N < 1 then -- minus sign rejects all reject_select = true elseif N and (string.sub(selector, 1, 1) == "+") then -- selector +N more items maxi = Nsel + N elseif N then -- selector N maximum total items maxi = N else -- selector ONE item from to_select_tab if it matches selector ( not - or + or +N or N ) for key, val in pairs(to_select_tab) do local select_t, val_t = selector, val if not viewers.is_in("U", opt) then select_t = string.lower(select_t) end -- recognize lowercase and uppercase if not viewers.is_in("t", opt) then select_t = mw.text.trim(select_t) end -- recognize after trim if not viewers.is_in("U", opt) then val_t = string.lower(val_t) end -- recognize lowercase and uppercase if not viewers.is_in("t", opt) then val_t = mw.text.trim(val_t) end -- recognize after trim equal = viewers.is_in("=", opt) -- recognize only equal string if equal then equal = (selector == val) else equal = viewers.is_in(select_t, val_t) end -- if viewers.is_in(selector, val) then if equal then -- recognize if selector is equal or is inside an item from to_select_tab t = t .. viewers.ta(selector, val) selected_tab[selector] = val Nsel = Nsel + 1 to_select_tab[key] = " " -- Delete the selected item to use it only once selected_txt = selected_txt .. val .. ', ' end end end end return selected_txt, selected_tab, t end -- function modes.multiple_selection(opt, selector, to_select)
function modes.multiple_selection_tests(t) -- Reports examples of multiple selections of honors for some persons.
local memo = viewers.save_configs("modes.multiple_selection_tests") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.multiple_selection_tests(t) : Reports examples of multiple selections of honors for some persons' end
t = t .. "\n* multiple_selection options: " .. viewers.ta("=", "equal only") .. viewers.ta("t", "not trim before and after") .. viewers.ta("U", "not lowercase and uppercase")
local opt = "; "
t = t .. "\n: selector = nobel,+1,président,3,député,prix signifie : sélectionner le premier, puis 1 de plus parmi les suivants, puis 3 en tout au maximum."
local head = mw.text.split( viewers.form9user("modes_multiple_selection_test_headers") , ';')
t = t .. viewers.table_head() .. viewers.table_col(head[1]) .. viewers.table_col(head[2]) .. viewers.table_col(head[3]) .. viewers.table_col(head[4])
-- recursiveLevel, recursive_limit, recursiveLevel_err == modes.recursive_normal(recursiveLevel, recursive_limit) -- typical use tab_view
t = t .. "\n* modes.recursive_normal_tests: "
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.multiple_selection_tests(t) -- Reports examples of multiple selections of honors for some persons",
test_group = {
{ recursiveLevel_in = nil, recursive_limit_in = nil, },
{ recursiveLevel_in = -12, recursive_limit_in = 5, },
{ recursiveLevel_in = 1, recursive_limit_in = 5, },
{ recursiveLevel_in = 1, recursive_limit_in = 0, },
{ recursiveLevel_in = 2.718, recursive_limit_in = 3.1416, },
{ recursiveLevel_in = 3, recursive_limit_in = nil, },
{ recursiveLevel_in = 5, recursive_limit_in = 5, },
{ recursiveLevel_in = 6, recursive_limit_in = 5, },
{ recursiveLevel_in = 11111, recursive_limit_in = 5, "versions_module_miss_i18n_count_err" },
},
headers = "viewers_save_restore_balance_headers", -- viewers_tableView_default_headers
headers = "select; First alternative; Second alternative; errors",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
case.recursiveLevel, case.recursive_limit, case.recursiveLevel_err =
modes.recursive_normal( case.recursiveLevel_in or modes.recursive_limit or 1, recursive_limit_in or modes.recursive_limit or 3 )
local t = "\n* " .. viewers.ta("Level_in", case.recursiveLevel_in) .. viewers.ta("Limit_in", recursive_limit_in)
t = t .. viewers.ta("recursiveLevel", recursiveLevel) .. viewers.ta("recursive_limit", recursive_limit) .. viewers.ta("recursiveLevel_err", recursiveLevel_err)
return { case.recursiveLevel_in, case.recursive_limit_in, case.recursiveLevel, case.recursive_limit, case.modes_recursiveLevel_err }
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
after convert in form_one_case = function(case)"
t = t .. "
" .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "modes.recursive_normal_tests") -- Restore global configurations after eventual changes.
return t
end -- function modes.multiple_selection_tests(t)
function modes.get_args(args_known) -- Updates known arguments from datas and template base : p.args_known{}
local m, val = modes, nil
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
local prop, props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page.
local arguments_known = mw.clone(args_known)
local counts = { ["template"] = 0, ["import"] = 0, ["source"] = 0, ["datas"] = 0, ["final"] = 0, ["known"] = 0, }
local arguments = {}
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.get_args(args_known) : Updates known arguments from datas and template base' end
for key, argmt in pairs(arguments_known) do -- For all known parameters
if type(argmt) == "table" then
-- * These origins of arguments are in the increasig priority: known
, import
, datas
, template
, interact_final
.
if argmt.keyword then
argmt.val = argmt.default ; argmt.src = "known" ;
counts.known = counts.known+1 ; t = t .. viewers.ta(argmt.src, counts.known)
end
if modes.args_import[argmt.keyword] then
argmt.val = modes.args_import[argmt.keyword] ; argmt.src = "import" ;
counts[argmt.src] = counts[argmt.src]+1 ; t = t .. viewers.ta(argmt.src, counts[argmt.src])
end
if prop[argmt.keyword] then
argmt.val = prop[argmt.keyword] ; argmt.src = "datas" ;
counts[argmt.src] = counts[argmt.src]+1 ; t = t .. viewers.ta(argmt.src, counts[argmt.src])
end
if modes.args_known[argmt.keyword] then
argmt.val = modes.args_known[argmt.keyword] ; argmt.src = "final" ;
counts[argmt.src] = counts[argmt.src]+1 ; t = t .. viewers.ta(argmt.src, counts[argmt.src])
end
table.insert(arguments, argmt) -- insert in the arguments their own key
end
end
local labelcontent_memo, label_to_change, has_label = {}, {}, {}
for i, onearg in pairs(arguments) do -- To search the label and labelcontent arguments
if onearg.keyword == "labelcontent" then labelcontent_memo = onearg end
if onearg.keyword == "label" then label_to_change = onearg end
end
if label_to_change and labelcontent_memo then -- To search and change the label argument
label_to_change.val = labelcontent_memo.val
label_to_change.keyword = "label"
label_to_change.prop = "label"
label_to_change.src = "datas"
label_to_change.need = labelcontent_memo.need
end
arguments.label = arguments.label or arguments.labeluser or arguments.labelpage or arguments.labelcontent or arguments.labelbylang -- insure label.val
table.sort(arguments, function (a, b) return ( tostring(a.keyword) < tostring(b.keyword) ) end ) -- alphabetic sort of translated arguments
modes.arguments = arguments
return arguments, t -- With argmt.val and argmt.src
end -- local arguments = modes.get_args(args_known) -- Update argmt.val and argmt.src in p.args_known{}
function modes.get_default_args(args_known) -- Gets default arguments values local memo = viewers.save_configs("modes.get_default_args") -- Save global configuration before eventual changes. local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { } -- Nicolas Flamel (Q41568), alchimie Victor Hugo (Q535) très connu, Montaigne (Q41568) education, Dr Ludwik Zamenhof (Q11758) esperanto UMUM -- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", }, for key, one_arg in pairs(args_known) do if type(one_arg) == "table" then if type(one_arg.default_item == "string") then datas.prop_default = one_arg.prop .. "_default" end -- "Q34743" -- Rudyard Kipling ** end end table.sort(arguments, function (a, b) return ( tostring(a.keyword) < tostring(b.keyword) ) end ) -- alphabetic sort of translated arguments modes.arguments = arguments viewers.restore_configs(memo, "modes.get_default_args") -- Restore global configurations after eventual changes. return arguments, counts, tt -- With argmt.val and argmt.src end -- local arguments = modes.get_default_args(args_known) -- Gets default arguments values
function modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template S170710mix local mix = mix or {} modes.mix = mix -- Get basic values -- mix.args_template = args_template or mix.args_template or modes.args_template or {} mix.all_args = {} local function mix_args(args) if (type(args) ~= "table") then args = {} end for key, argmnt in pairs(args) do mix.all_args[key] = argmnt end -- get arguments named or in order. end -- actual steps to mix -- begin with least priority mix_args(modes.args_template) -- already known, or default values args_template have the lowest priority mix_args(mix.args_template) mix_args(mix.args_import) mix_args(args_template) -- direct args_template have the highest priority -- end with most priority mix.args = mix.all_args return mix end -- local mix = modes.mix_args(mix, mode_name, args_template)
function modes.mix_modes(mix, mode_name, args_template) -- Mix some modes from several origins mix = mix or {} mix.args_template = args_template or modes.args_template or mix.args_template if (type(mix.args_template) ~= "table") then default = "read" end mix.mode_name = mix.args_template.mode or mix.args_template[1] or mode_name or "read" modes.args_template = mix.args_template modes.mode_name = mix.mode_name return mix end -- local mix = modes.mix_modes(mix, mode_name, args_template)
function modes.mix_options(mix, old_group, new_group) -- Mix 2 groups of options from diverse origins S170710mix mix = mix or {} if (type(old_group) ~= "string") then old_group = "" end if (type(new_group) ~= "string") then new_group = "" end local old_group_tab = mw.text.split(old_group, " ", true) local new_group_tab = mw.text.split(new_group, " ", true) local all_group_tab = mw.clone(old_group_tab) -- do not disturb old_group_tab for i, option in ipairs(new_group_tab) do table.insert(all_group_tab, option) end -- add new with old options local no_options_tab, active_options_tab = {}, {} for i, option in ipairs(all_group_tab) do -- form 2 groups of no_options and active_options local no_t, opt_t = string.sub( option, 1, 2), (string.sub( option, 3) or "") -- no prefix and option without no if ( no_t == "no" ) then no_options_tab[option] = opt_t -- form a group of no_options, perhaps to delete an active option else active_options_tab[option] = option -- form a group of active_options, perhaps to delete end end local keep_group_tab = mw.clone(all_group_tab) -- Reject no_options to keep active_options for i, option in pairs(active_options_tab) do if ( no_options_tab[option] ) then active_options_tab[option] = nil -- form a group of active_options, perhaps to delete end end mix.active_options = table.concat(active_options_tab, " ") mix.no_options = table.concat(no_options_tab, " ") return mix end -- active_options = modes.mix_options(old_group, new_group) -- S170710mix
function modes.init_args_mode_options(mix, mode_name, args_template) -- Imports and mixes args mode and options from template and invoke -- Guideline: Any combination of options can define a mixture of options to modify options. -- This function allows any module to modify this process. -- The default process gives the priority to options from arguments. -- Each "option" can be removed by the option "nooption". Options starting with "no" are disabled. -- Init basic values local mix = mix or {} modes.mix = mix mix.mode_name = mode_name or mix.mode_name or modes.mode_name -- Steps to mix modes values -- -- Once run mix_args and mix_modes, in case a mode option would change the mode. mix = modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template mix = modes.mix_modes(mix, mode_name, args_template) -- Mix some modes from several origins S170710mix modes.options = modes.options_for_modes[modes.mode_name] -- options from mode -- -- Once repeat mix_args and mix_modes, in case the mode changes through them. mix = modes.mix_args(mix, mode_name, args_template) -- Mix arguments from options_for_modes, args_template mix = modes.mix_modes(mix, mode_name, args_template) -- Mix some modes from several origins S170710mix modes.options = modes.options_for_modes[modes.mode_name] -- options from mode mix = modes.mix_options(mix, modes.options, modes.args_template.options ) -- Mix options from template modes.options = mix.options -- -- activate init_args_mode_options modes.list_invoke = mix.list_invoke or modes.list_invoke modes.list_template = mix.list_template or modes.list_template modes.args_template = mix.args_template or modes.args_template modes.mode_template = mix.mode_template or modes.mode_template or modes.args_template.mode modes.active_options = mix.active_options or modes.active_options modes.no_options = mix.no_options or modes.no_options or table.concat(no_options_tab, " ") modes.options_template = mix.options_template or modes.options_template or modes.args_template.options modes.mode_name = mix.mode_name or modes.mode_name modes.options_for_modes = mix.options_for_modes or modes.options_for_modes modes.options = mix.options or modes.options return mix end -- modes.args_mixed = function modes.init_args_mode_options(mix, mode_name, args_template)
function modes.args_mixer(args_template) -- S170703amo -- Guideline: Any combination of templates can define a mixture of arguments to modify arguments. -- This function allows any module to modify this process. -- The default process gives the priority to templates arguments. local t = "\n* modes.args_mixer() Import and mix arguments from templates and invoke." local args_template = args_template or modes.args_template or {} t = t .. "\n* " .. viewers.ta("\n* args_template", args_template) if (type(args_template) == "table") then for arg_key, argment in pairs(args_template) do args_template[arg_key] = argment -- sought args from templates args_template.QITEM = args_template.QITEM or args_template.itemid -- temporary debug the test page t = t .. viewers.ta(arg_key, argment) if arg_key == "itemid" then t = t .. viewers.ta("QITEM", argment) end -- temporary debug the test page end end args_template.QITEM = args_template.QITEM or args_template.itemid -- temporary debug the test page viewers.TITL = tracker.initadd({ ["name"] = "TITL", limit = 2, }) -- Initialize a track TITL.add(TITL, 1, "args_mixer", args_template ) -- TITL.t -- Activate the sought args modes.args_mixed = args_template t = t .. viewers.ta("modes.args_mixed count", lua_table.count_all(modes.args_mixed) ) return modes.args_mixed end -- local t = modes.args_mixer(args_template)
function modes.modes_mixer(args_template) -- S170703amo local t = "" args_template = args_template or modes.args_template t = t .. viewers.ta("modes.args_template[1]", modes.args_template[1]) .. viewers.ta("modes.args_template.mode", modes.args_template.mode) -- Activate the sought mode modes.mode_name = modes.args_template.mode or modes.args_template[1] modes.args_mixed.mode_name = modes.mode_name t = t .. viewers.ta("sought mode_name", modes.mode_name) return t, modes.mode_name end -- local t = modes.modes_mixer(args_template)
function modes.options_mixer(args_template) -- S170703amo -- Guideline: Any combination of options can define a mixture of options to modify options. -- This function allows any module to modify this process. -- The default process gives the priority to options from arguments. -- Each option can be deleted by the nooption option. Then options cannot begin by "no" chars. -- -- First, import args, then mix modes and options. local t = "\n* modes.options_mixer() Import and mix options from template." -- modes.options = " docdata docmin docdef docmax docline docview docafter docnotice docsrc: " -- for documentation modes.options_template = modes.args_template.options or " catview nobox1 doclist docdata nodocline" modes.options_all = modes.options_template .. " " .. modes.options_invoke t = t .. viewers.ta("\n* options_template", modes.options_template ) t = t .. viewers.ta("\n* options_invoke", modes.options_invoke ) modes.options_tab = mw.text.split(modes.options_all, " ", true) local opt_pretab, opt_tab, noopt_tab, opt_list = {}, {}, {}, " " for i, option in pairs(modes.options_tab) do -- Build the subgroup table from the groupname string local no_t, opt_t = string.sub( option, 1, 2), string.sub( option, 3) if ( no_t == "no" ) then noopt_tab[option] = opt_t -- no_option to delete an active option else opt_pretab[option] = option end -- active option end local lst = "" ; for key, val in pairs(modes.options_tab) do lst = lst .. viewers.ta(key, val ) end t = t .. viewers.ta("\n* #modes.options_tab", lua_table.count_all( modes.options_tab ) ) .. viewers.ta("options_tab", lst ) local lst = "" ; for key, val in pairs(opt_pretab) do lst = lst .. viewers.ta(key, val ) end t = t .. viewers.ta("\n* #opt_pretab", lua_table.count_all( opt_pretab ) ) .. viewers.ta("opt_pretab", lst ) local lst = "" ; for key, val in pairs(noopt_tab) do lst = lst .. viewers.ta(key, val ) end t = t .. viewers.ta("\n* #noopt_tab", lua_table.count_all( noopt_tab ) ) .. viewers.ta("noopt_tab", lst ) opt_tab = mw.clone(opt_pretab) -- unknown arguments to detect are source arguments without known arguments. for option, opt_t in pairs(noopt_tab) do -- Build the subgroup table from the groupname string opt_tab[opt_t] = nil -- no_option delete an active option end -- active options are in opt_tab local lst = "" ; for key, val in pairs(opt_tab) do lst = lst .. viewers.ta(key, val ) end t = t .. viewers.ta("\n* #opt_tab = " .. lua_table.count_all( opt_tab ) ) .. viewers.ta("opt_tab whitout no", lst ) -- Activate the sought options local template_options = " " for key, val in pairs(noopt_tab) do template_options = template_options .. " " .. val end modes.template_options = template_options t = t .. viewers.ta("modes.template_options", modes.template_options) return t, modes.template_options end -- local t = modes.options_mixer(args_template)
-- For an unknown argument, seeking the name of the nearest argument among the known arguments
function modes.similar_args_search(search, list)
local dist, lengths, tlev = 9, 0
local trouve1, trouve2, trouve3 = nil, nil, nil
local min1, min2, min3 = 99, 99, 99
if (type(search) ~= "string") then search = "" end
local diffmaxi = modes.similar_args_diffmaxi( string.len(search) )
local t = ", " .. tostring(diffmaxi) .. " / " .. tostring(length) .. " "
for key, arglingual in pairs(list) do
-- Search the most similar and same length. Buscar las más similares y la misma longitud. Chercher le plus ressemblant et la même longueur.
dist, tlev = modes.levenshtein(search, arglingual)
if (dist <= min1) then
trouve3 = trouve2
min3 = min2
trouve2 = trouve1
min2 = min1
min1 = dist
trouve1 = tostring(arglingual)
end
end
t = t .. "
" .. viewers.ta("cherche", cherche) .. viewers.ta("trouve1", trouve1) .. viewers.ta("min1", min1) .. viewers.ta("trouve2", trouve2) .. viewers.ta("min2", min2) .. " " .. t
if trouve1 and min1 == 0 then t = t .. viewers.styles_color_wikidata(viewers.ta("connu", trouve1)) end
if trouve1 and min1 <= diffmaxi then t = t .. viewers.styles_color_wikidata(viewers.ta("min1 "..min1.."<="..diffmaxi, trouve1)) end
if trouve2 and min2 <= diffmaxi then t = t .. viewers.styles_color_wikidata(viewers.ta("min2 "..min2.."<="..diffmaxi, trouve2)) end
if trouve3 and min3 <= diffmaxi then t = t .. viewers.styles_color_wikidata(viewers.ta("min3 "..min3.."<="..diffmaxi, trouve3)) end
return trouve1, min1, trouve2, min2, t
end -- function modes.similar_args_search(search, list)
function modes.import_arguments(args_known, args_source, content_translations, args_wikidata) -- Import all arguments from template, or invoke, or wikidata local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { } modes.args_known = args_known local args_wikidata = args_wikidata or modes.args_wikidata or p.args_wikidata or {} -- optional value from p.args_known = { -- } modes.args_wikidata = args_wikidata local args_import = args_import or modes.args_import or {} -- optional value from p.args_known = { } modes.args_import = args_import modes.args_unknown = {} langs.init_content_page_user_lang() -- give langs.content_translations[elem.key] or langs.page_translations[elem.key] or langs.user_translations[elem.key] content_translations = content_translations or langs.content_translations versions.memo_i18n = mw.clone(versions.main_i18n or langs.main_i18n) local memo_i18n = versions.memo_i18n local err = nil modes.nowyear = tonumber(os.date("%Y") ) -- now_date = os.date("%Y-%m-%d %H:%M:%S") -- ARGS.add(viewers.ARGS, 1, "import_arguments", { ["argsknown"] = args_known, ["argssource"] = args_source, ["argswikidata"] = args_wikidata, ["nowyear"] = modes.nowyear, } ) -- ARGS.t modes.import_arguments_err = "" modes.import_arguments_track = "" langs.main_i18n = versions.memo_i18n local err, er1, t2 = "", "", "" local key, argval, argid = "kkk", "xxx", "" local arglingual, argreceived = "", "" local argm = {} -- used arguments local key_N, key_NN = 0, 0 local arg_found, rec_found, already_found = false, false, false -- if okok begin 6535 for key_known, argm in pairs(args_known) do -- initialize all arguments to "not found" before import them from p.args_known = { -- Table -- } if type(argm) == "table" then argm.found = 0 end end -- if okok end 6535 local key_known_init = nil local argm_syn = nil -- Get datas from mw.wikibase for the page and Mix datas in modes.args_import. datas.prop, datas.props = datas.get_item(args_known, QITEM) -- Get datas from mw.wikibase for the page. -- Try to read all known arguments. Intentar leer todos los argumentos conocidos. Essayer de lire tous les arguments connus. -- if okok begin 6545 1 for key_known, argm in pairs(args_known) do -- if okok begin 6547 2 if type(argm) == "table" then argm.src = nil argm.trk = " n" key_known_init = key_known -- first initialise each known argument modes.import_arguments_track = tostring(modes.import_arguments_track) .. " - " .. tostring(key_known) argm_syn = args_known[argm.keyword] -- ARGS.add(viewers.ARGS, 1, "args_known for", { key = key_known, Nargm = lua_table.level_count(argm), syn = argm.syn, } ) -- ARGS.t -- if okok begin 6556 if argm.syn == 2 then -- Name an unnamed argument, positional, by its synonym. Nommer un argument non nommé, numéroté, par son synonyme. -- Rename a named argument, by its synonym. Renommer un argument nommé, par son synonyme. -- argm_orig = key_known -- DEBUG key_known = argm.keyword -- Selects all defined arguments -- synonyms are defined with the stamp "syn = 2", then here stamp the basic argument with "syn = 1". args_known[key_known].syn = 1 argm = args_known[key_known] -- new variable argm argm.src = nil argm.trk = "s" modes.import_arguments_track = tostring(modes.import_arguments_track) .. ">" .. tostring(key_known) end -- if okok end 6556 -- initialise an argument. arg_found = false argval = nil argm.trk = argm.trk.."=" -- Import a wikidata argument. Importer un argument wikidata -- if okok begin 6575 if type(datas.props) == "table" and datas.props[key_known] then argval = datas.props[key_known] -- Gets the value from datas of the argument argm["val"] = argval -- and use it as value of the argument argm.src = "wd" argm.trk = argm.trk.."w" if argm_orig then -- args_known[argm_orig].src = "wd" -- args_known[argm_orig].trk = (args_known[argm_orig].trk or "").."w" end arg_found = true modes.import_arguments_track = modes.import_arguments_track .. "=" .. tostring(argval) .. " " end -- if okok end 6575 -- import a source argument. importer un argument source. modes.import_arguments_track = modes.import_arguments_track .. "/" .. tostring(arglingual) -- if okok begin 6591 3 if arglingual then -- The argument name has a translation in wiki language -- if okok begin 6593 4 if type(datas.props) == "table" and datas.props[key_known] then -- if okok begin 6595 5 if args_known[arglingual] and not modes.args_source[arglingual] then -- the argument come from template else from invoke else from wikidata -- if argval then -- the argument value exist and come from template else from invoke else from wikidata argval = args_source[arglingual] argm.src = "args" argm.trk = argm.trk.." a" arg_found = true local arg_values = content_translations[argm.arg_values] -- if okok begin 6603 if argm.keys_values and arg_values then -- The argument is limited to multiple values with arg_values and keys_values, and the values are defined. local pos = string.find(arg_values, argval) -- if okok begin 6607 if pos then -- The value of the argument is in the multiple values of the arguments. -- argm.src = "args" argm.trk = argm.trk.."m" -- arg_found = true if argm_orig then -- args_known[argm_orig].src = "args" -- args_known[argm_orig].trk = (args_known[argm_orig].trk or "").."d" end else events.add_err("modes_args_values_err", argm.keyword, argval, arg_values) -- argval = nil end -- if okok end 6607 else -- argm.src = "args" argm.trk = argm.trk.."c" -- arg_found = true if argm_orig then -- args_known[argm_orig].src = "args" -- args_known[argm_orig].trk = (args_known[argm_orig].trk or "").."c" end end -- if okok end 6603 modes.import_arguments_track = modes.import_arguments_track .. "=" .. tostring(argval) .. " " end -- not args_source[arglingual] is normal -- if okok end 6595 else -- internal error and category -- events.add_err("versions_module_miss_i18n_trad_err", key_known) -- Generate a category to list all modules with missing translation events.add_cat( "versions_err_module_miss_i18n_cat" ) end -- if okok end 6593 4 ??? key_N = tonumber(key_known_init) -- if okok begin 6642 if key_N and not args_known[key_N] then events.add_err("modes_too_unnamed_arguments_err", key_N, argval) events.add_cat("versions_with_usage_error_cat") end -- if okok end 6642 -- Record the argument. Guarde el argumento. Enregistrer l'argument. -- if okok begin 6649 if arg_found == true then argm.found = argm.found + 1 -- count redifined arguments argm.val = argval args_import[key_known] = argval -- received international arguments table if modes.args_unknown[arglingual] then modes.args_unknown[arglingual] = nil -- unknown arguments are source arguments without known arguments. end end -- if okok end 6649 end -- if okok end 6591 3 end -- if okok end 6547 2 ??? end -- if okok end 6545 1 all OK -- modes.import_arguments: after import itself, some surrounding checks. -- if okok begin 6664 for key_known, argm in pairs(args_known) do -- For all known arguments -- Redefined arguments. Argumentos redefinieron. Arguments redéfinis. -- synonyms are defined with the stamp "syn = 2", then here stamp the basic argument with "syn = 1". -- if okok begin 6668 if argm.keyword and args_known[argm.keyword] and args_known[argm.keyword].syn then -- if the argument is a synonym, increase the found level if argm.found and (argm.found > 2) then events.add_err("modes_value_re_defined_err", (argm["keyword"] or "**") ) --.. ">2") cats = cats .. events.add_cat("versions_with_usage_error_cat") end else if argm.found and (argm.found > 1) then events.add_err("modes_value_re_defined_err", (argm["keyword"] or "**") ) --.. ">1") cats = cats .. events.add_cat("versions_with_usage_error_cat") end end -- if okok end 6668 -- need = 0 not necessary argument -- need = 1 necessary from argument -- need = 2 necessary from argument or module interaction -- Missing Arguments. Argumentos que faltan. Arguments manquants. -- if okok begin 6685 if argm.need and (argm.need == 1) and (not argm.val) then arglingual = content_translations[key_known] if arglingual then events.add_err("modes_need_arg_value_err", arglingual) cats = cats .. events.add_cat("versions_with_usage_error_cat") end end -- if okok end 6685 end -- if okok end 6631 -- end -- arbitrary end added in main Loop pairs(args_known) -- All arguments sources have they been used? -- modes.args_unknown -- unknown arguments are source arguments without known arguments. local args_list = modes.similar_args_list(modes.args_known) -- if okok begin 6700 for key_src, val_src in pairs(modes.args_unknown) do -- For all unknown source arguments. function tableview.new( arglingual = tostring(key_src) -- look for the translated argument key_N = tonumber(arglingual) -- No error for unmamed arguments -- if okok begin 6705 if not key_N then events.add_err("modes_unknown_argument_err", arglingual, val_src) cats = cats .. events.add_cat("versions_with_usage_error_cat") -- "Error: parameter %1 is unknown in this template. Check the name or flag this gap.", -- Look for a known and similar name argument local diffmaxi = modes.similar_args_diffmaxi( string.len(arglingual) ) local trouve1, min1, trouve2, min2 = modes.similar_args_search(arglingual, args_list) if min1 and (min1 <= diffmaxi) then events.add_err("modes_nearest_argument_err", trouve1) end if min2 and (min2 <= diffmaxi) then events.add_err("modes_nearest_argument_err", trouve2) end end -- if okok end 6705 key_N = tonumber(arglingual) -- if okok begin 6722 if key_N and not args_known[key_N] then events.add_err("modes_too_unnamed_arguments_err", key_N, val_src) events.add_cat("versions_with_usage_error_cat") end -- if okok end 6722 end -- For all unknown source arguments. -- if okok end 6631 modes.nowyear = tonumber(os.date("%Y") ) -- now_date = os.date("%Y-%m-%d %H:%M:%S") modes.args_import.nowyear = modes.nowyear modes.args_import = args_import return modes.args_import end -- modes.args_import = modes.import_arguments(args_known, args_source, content_translations, args_wikidata)
function modes.args_unknown_report(t) -- Reports unknown arguments.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.args_unknown_report(t) : Reports unknown arguments' end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.args_unknown_report(t) -- Reports unknown arguments",
test_group = modes.args_unknown, -- Use default cases.
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.i, case.where, case.save, }
end,
headers = "modes_args_unknown_report_headers",
headers = "i ; where ; save",
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
return t
end -- t = t .. modes.args_unknown_report(t) -- Report unknown arguments.
-- res = res .. viewers.drop(selector, "modes_args_unknown_report_title", modes.args_unknown_report)
-- - - - ------------------ - - - - --------------------------------- -- Argts : Generate documentation. Generar documentación. Générer la documentation. -- - - - ------------------ - - - - ---------------------------------
function modes.generDoc(opt, args_known, module_name)
-- List of paramètres for the module documentation
-- Lister des paramètres pour la documentation du module
-- "docview" or ":" ajouter le panneau de documentation
-- "docmin" quelques paramètres de base
-- "docdef" seulement les paramètres définis, ayant une valeur non nulle
-- "docmax" tous les paramètres connus
-- "docnotice" generer les documentations des notices
-- "docline" mettre tous les paramètres sur une seule ligne
-- "docsrc" mettre les paramètres en couleurs selon les sources
-- modes.options = " docdata docmin docdef docmax docline docview docafter docnotice docsrc: " -- for documentation
-- modes.options = " erron noerr nobox1 nocatview " -- without normal result
-- modes.options = " debug tests en es fr " -- for debug or enforce language
-- Option nocatview means "Do not categorize and do not show categories."
local args_known = modes.args_known
local err = modes.verify_args_tables(args_known, modes.args_source)
if err then return err end
if type(module_name) ~= "string" then module_name = modes.module_name end
-- if type(module_name) ~= "string" then module_name = modes.frame:getTitle() end -- main module, example "Auteur"
if type(module_name) ~= "string" then module_name = modes.getTitle() end -- this is the title of the module invoked
local n, t, val = 0, "", ""
if type(args_known) ~= "table" then t = t.."err_args_known="..type(args_known).."
" end -- optional arguments
if type(args_known) ~= "table" then args_known = modes.args_known end -- optional arguments
local key, argknw, argval, arglingual = "", "", ""
local lst = true
local lst_doc, lst_1, lst_t = {}, {}, ""
for key, parm in pairs(args_known) do -- for all known arguments
val = ""
n = tonumber(key)
if n then key = tostring(parm["keyword"]) end -- key for unnamed arguments, in numeric sort
argknw = args_known[key]
arglingual = viewers.form9user(arglingual) -- multilingual name of the argmt in the template
if arglingual == "nil" then arglingual = key end -- if argument is translatable
val = parm -- tostring(args_import[key])
if not viewers.is_def(val) then val = "" end
lst = false
opt = opt .. " docdef " -- optional display
if modes.option("docmin", opt) and argknw and (argknw["need"] > 0) then lst = true end
if modes.option("docdef", opt) and (val ~= "") then lst = true end
if modes.option("docmax", opt) then lst = true end
if not args_known[key] then lst = false end
if key and args_known[key] and args_known[key].typ == "sys" then lst = false end
if lst then t = t .. viewers.tam( viewers.form9user(key), parm) end -- list if found and selected
end
t = "\n* " .. module_name .. " " .. t -- .. "}}" --
return t
end -- function modes.generDoc(opt, args_known, module_name)
function modes.sources_of_datas_colors()
local res = ""
if modes.docolor then -- Document the data sources by colors
local datas_sources_of_datas = viewers.form9user("datas_sources_of_datas")
-- datas_sources_of_datas = "Informations from: /Wikidata, /template or module, /other, /warning, /error",
local splitxt = mw.text.split(datas_sources_of_datas, "/", true)
res = res .. splitxt[1] .. " " .. viewers.styles_color_wikidata(splitxt[2]) .. viewers.styles_color_colargs(splitxt[3]) .. viewers.styles_color_normal(splitxt[4]) .. viewers.styles_color_warning(splitxt[5]) .. viewers.styles_color_error(splitxt[6]) .. ".
"
end
return res
end -- function modes.sources_of_datas_colors()
function modes.module_init(frame) -- Get modes.args_source with modes.args_source local frame = frame or modes.frame or mw.getCurrentFrame() modes.frame = frame modes.nowyear = tonumber(os.date("%Y") ) -- UTC now_date = os.date("%Y-%m-%dT%H:%M:%S") -- Mix arguments from Erreur de script : vous devez spécifier une fonction à appeler., then arguments from the prioritary template which replace ones from Erreur de script : vous devez spécifier une fonction à appeler.. local v2, nn, ni = 0, 0, 0 local args_tab, mode = {} local templat = frame:getParent().args -- arguments from template -- Mix invoked modified arguments from prioritary template arguments. -- Argument 1 from template become the mode in #invoke. Other i arguments must be shifted. local invoked = frame.args -- arguments from #invoke module local args_tab = mw.clone(invoked) -- less priority than template for key, val in pairs(args_tab) do -- invoked arguments can modify #invoke arguments. local key = mw.text.trim(key) local val = mw.text.trim(val) local i = tonumber(key) if i then if i == 1 then mode = val -- mode = template[1] args_tab.mode = val else args_tab[i-1] = val end -- transmit other unnamed arguments template[i], but shifted because the mode is in template[1] else args_tab[key] = val end -- transmit any named template arguments template. Even the mode, which replace template[1], behind. end local args_tab = mw.clone(templat) -- template have the priority and can itself #invoke arguments for key, val in pairs(templat) do -- template arguments can modify #invoke arguments. local key = mw.text.trim(key) local val = mw.text.trim(val) local i = tonumber(key) if i then if i == 1 then mode = val -- mode = template[1] args_tab.mode = val else args_tab[i-1] = val end -- transmit other unnamed arguments template[i], but shifted because the mode is in template[1] else args_tab[key] = val end -- transmit any named template arguments template. Even the mode, which replace template[1], behind. end modes.args_source = args_tab -- args from: modes.module_init() -- Get modes.args_source with modes.args_source -- modes.args_source = modes.argsConfigIinit(modes.args_source) -- Extract and put apart args_source from args_source -- Default values of main module version. if versions.main_versions then versions.main_versions.versionName = versions.main_versions.versionName or "Central0" versions.main_versions.versionNumber = versions.main_versions.versionNumber or "0.0.0" versions.main_versions.versionDate = versions.main_versions.versionDate or "2018-06-15" end return modes.args_source end -- modes.args_source = function modes.module_init(frame)
function modes.init_options_for_modes(frame, options_for_modes, mode_name) local res = "\n* modes.init_options_for_modes()" frame = frame or mw.getCurrentFrame() modes.frame = frame modes.options_for_modes = options_for_modes or modes.options_for_modes modes.mode_name = mode_name or modes.mode_name or "read" modes.mode_options = modes.options_from_mode(modes.mode_name, modes.options_for_modes) return res end -- function modes.init_options_for_modes(frame, options_for_modes, mode_name)
function modes.get_arg_mode(mode_name, source_key, lang, args_source) -- Select the actual mode from some sources local mode_key = "mode" local args_source = args_source or modes.args_source if type(args_source) == "table" -- and type(args_source[source_key]) == "string" then mode_name = mode_name or args_source[source_key] or "read" else modes.mode_name = mode_name or modes.mode_name or "read" end return mode_name, source_key, lang, args_source end -- function modes.get_arg_mode(mode_name, source_key, lang, args_source)
function modes.all_categories_list(t) -- Lists all categories defined from the translations keys
local memo = viewers.save_configs("modes.all_categories_list") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.all_categories_list(t) : Lists all categories defined from the translations keys' end
t = t .. viewers.form9user("modes_all_categories_list_title")
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
if (type(langs.user_lang) == "string") and type(versions.memo_i18n[langs.user_lang]) == "table" then
for key, txt in pairs(versions.memo_i18n[langs.user_lang]) do
if viewers.is_in("cat_", key) or viewers.is_in("_cat", key) then
txt = viewers.form9user(key, "**", "**", "**", "**", "**", "**")
t = t .. "
" .. viewers.ta(key, txt)
end
end
end
viewers.restore_configs(memo, "modes.all_categories_list") -- Restore global configurations after eventual changes.
return t
end -- function modes.all_categories_list(t)
function modes.all_errors_list(t) -- Lists detectable errors of this module
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.all_errors_list(t) : Lists detectable errors of this module' end
t = t .. viewers.form9user("modes_all_errors_list_title")
if (type(langs.user_lang) == "string") and type(versions.memo_i18n[langs.user_lang]) == "table" then
for key, txt in pairs(versions.memo_i18n[langs.user_lang] or modes.modes_args.userlang) do
if viewers.is_in("err_", key) or viewers.is_in("_err", key) then
txt = viewers.form9user(key, "**", "**", "**", "**", "**", "**")
t = t .. "
" .. viewers.ta(key, txt)
end
end
end
return t
end -- function modes.all_errors_list(t)
function modes.list_all_args_main(t, args_known) -- Lists of all accepted arguments
local memo = viewers.save_configs("modes.list_all_args_main") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.list_all_args_main(t, args_known) : Lists of all accepted arguments' end
local args_known = args_known or modes.args_known or p.args_known or {}
if type(args_known) ~= "table" then return (t .. "The known arguments table modes.args_known misses.") end
t = t .. viewers.ta("args N", lua_table.level_count(args_known) )
local descr, description = "", ""
args = mw.clone(args_known)
local arglst = {}
langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()
for key, elem in pairs(args) do
elem.key = tostring(key)
descr = key .. "_descr" -- key for description of an argument
if type(langs.user_translations) == "table" then
elem.description = langs.user_translations[descr] or "**missing translation**"
elem.user_lang_key = langs.user_translations[elem.key] or "**missing key**"
elem.user_lang_keyword = langs.user_translations[elem.keyword] or "**missing keyword**"
-- elem.base_id = elem.base_id
-- elem.base_base = elem.base_base
-- elem.not_type = elem.not_type
end
if type(langs.user_translations) ~= "nil" then
table.insert(arglst, elem)
end
end -- insert in the arguments their own key
table.sort(arglst, function (a, b) return tostring(a.user_lang_key) < tostring(b.user_lang_key) end ) -- alphabetic sort of translated arguments
local gr_sys, gr_config, gr_need, gr_other, gr_authority = {}, {}, {}, {}, {}
for i, elem in ipairs(arglst) do -- group arguments in some groups
if elem.need == 1 or elem.need == 2 then table.insert(gr_need, elem)
elseif elem.typ == "sys" then table.insert(gr_sys, elem)
elseif elem.typ == "config" then table.insert(gr_config, elem)
elseif elem.base_base then table.insert(gr_authority, elem)
else table.insert(gr_other, elem) end
end
local needed = viewers.styles_small_caps(viewers.form9user("modes_needed_to_verify"))
local function list_group( group, needed )
needed = needed or ""
local t = ""
for key, elem in pairs(group or {}) do
if elem.syn
then t = t .. "
* " .. tostring(elem.user_lang_key) .. " => " .. elem.user_lang_key .. " : " .. needed .. " " .. tostring(elem.description) -- .. elem.lev_arg_txt
else t = t .. "
* " .. tostring(elem.user_lang_key) .. " : " .. needed .. " " .. tostring(elem.description) end
end
return t
end
t = t .. "
* " .. viewers.form9user("modes_list_needed_args") .. " " .. list_group( gr_need, needed )
t = t .. "
* " .. viewers.form9user("modes_list_all_other_args") .. " " .. list_group( gr_other )
t = t .. "
* " .. viewers.form9user("list_all_authorities") .. " " .. list_group( gr_authority )
t = t .. "
* " .. viewers.form9user("modes_list_all_config_arguments") .. " " .. list_group( gr_config )
t = t .. "
* " .. viewers.form9user("modes_list_all_system_arguments") .. " " .. list_group( gr_sys )
viewers.restore_configs(memo, "modes.list_all_args_main") -- Restore global configurations after eventual changes.
return t
end -- function modes.list_all_args_main(t, args_known) -- modes_list_all_args_main_title for main
function modes.recursive_normal( recursiveLevel_in, recursive_limit_in, modes_recursiveLevel_err ) -- Normalizes the recursive level and the recursive limit -- recursiveLevel, recursive_limit, recursiveLevel_err == modes.recursive_normal(recursiveLevel, recursive_limit) -- typical use -- default modes.recursive_limit local recursiveLevel, recursive_limit = recursiveLevel_in, recursive_limit_in local recursiveLevel_err = recursiveLevel_err or"" if type(modes_recursiveLevel_err) ~= "string" then modes_recursiveLevel_err = "modes_recursiveLevel_err" end if type(modes.recursive_limit) ~= "number" then modes.recursive_limit = 11111 end if modes.recursive_limit < 1 then modes.recursive_limit = 11111 end if type(recursive_limit) ~= "number" then recursive_limit = modes.recursive_limit end -- If recursive_limit is defined, it can be greater or lesser than modes.recursive_limit recursive_limit = math.floor(recursive_limit) + 1 if recursive_limit < 1 then recursive_limit = modes.recursive_limit end -- default recursiveLevel if type(recursiveLevel) ~= "number" then recursiveLevel = 1 end recursiveLevel = math.floor( recursiveLevel ) + 1 if recursiveLevel < 1 then recursiveLevel = 1 end -- if recursiveLevel > recursive_limit then recursiveLevel_err = viewers.form9user( modes_recursiveLevel_err, recursiveLevel, recursive_limit) recursiveLevel_err = viewers.styles_color_error( tostring(recursiveLevel_err) ) end return recursiveLevel, recursive_limit, recursiveLevel_err end -- function modes.recursive_normal( recursiveLevel_in, recursive_limit_in, modes_recursiveLevel_err )
function modes.recursive_normal_tests(t) -- Tests the recursive level and the recursive limit
local memo = viewers.save_configs("modes.recursive_normal_tests") -- Save global configuration before eventual changes.
-- recursiveLevel, recursive_limit, recursiveLevel_err == modes.recursive_normal(recursiveLevel, recursive_limit) -- typical use tab_view
local t = t -- t or
if (type(t) ~= "string") then t = '\n* modes.recursive_normal_tests(t) : Tests the recursive level and the recursive limit' end
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "modes.recursive_normal_tests(t) -- Tests the recursive level and the recursive limit",
test_group = {
{ recursiveLevel_in = nil, recursive_limit_in = nil, },
{ recursiveLevel_in = -12, recursive_limit_in = 5, },
{ recursiveLevel_in = 1, recursive_limit_in = 5, },
{ recursiveLevel_in = 1, recursive_limit_in = 0, },
{ recursiveLevel_in = 2.718, recursive_limit_in = 3.1416, },
{ recursiveLevel_in = 3, recursive_limit_in = nil, },
{ recursiveLevel_in = 5, recursive_limit_in = 5, },
{ recursiveLevel_in = 6, recursive_limit_in = 5, },
{ recursiveLevel_in = 11111, recursive_limit_in = 5, "versions_module_miss_i18n_count_err" },
},
headers = "Level_in; Limit_in; recursiveLevel; recursive_limit; recursiveLevel_err", -- Test Normalize recursiveLevel and recursive_limit
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
case.recursiveLevel, case.recursive_limit, case.recursiveLevel_err =
modes.recursive_normal( case.recursiveLevel_in or modes.recursive_limit or 1, case.recursive_limit_in or modes.recursive_limit or 3 )
return { case.recursiveLevel_in, case.recursive_limit_in, case.recursiveLevel, case.recursive_limit, case.modes_recursiveLevel_err }
-- headers = "Level_in; Limit_in; recursiveLevel; recursive_limit; recursiveLevel_err", -- viewers_tableView_default_headers
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
after convert in form_one_case = function(case)"
t = t .. "
" .. tableview.new(tab_view) -- Form a table view with lines and columns.
viewers.restore_configs(memo, "modes.recursive_normal_tests") -- Restore global configurations after eventual changes.
return t
end -- function modes.recursive_normal_tests(recursiveLevel, recursive_limit)
function modes.namespaces_page_list(t) -- Lists various froms the namespace for the actual page. local t = t -- t or if (type(t) ~= "string") then t = '\n* modes.namespaces_page_list(t) : Lists various froms the namespace for the actual page' end local mwtitle = mw.title.getCurrentTitle() t = t .. viewers.ta("mwtitle", mwtitle) local nsText = mwtitle.nsText t = t .. viewers.ta("nsText", nsText) local baseText = mwtitle.baseText -- namespace for the page t = t .. viewers.ta("baseText", baseText) local url = tostring(mwtitle:canonicalUrl( )) t = t .. viewers.ta("url", url) t = t .. "\n* Module namespace: " local ns = mw.site.namespaces if ns and ns[828] then t = t .. viewers.ta("id828", ns[828].id) t = t .. viewers.ta("canonicalName828", ns[828].canonicalName) t = t .. viewers.ta("name828", ns[828].name) t = t .. viewers.ta("displayName828", ns[828].displayName) end t = t .. "\n* All namespaces (from 0 to 2000): " local ns = "" for ins = 0, 2000 do if mw.site.namespaces[ins] then ns = mw.site.namespaces[ins].canonicalName t = t .. viewers.ta(ns, ins) end end t = t .. "\n* mw.title.getCurrentTitle(): " local getCurrentTitle = mw.title.getCurrentTitle() for key, val in pairs(getCurrentTitle) do -- Synthesis and descriptions of all status t = t .. viewers.ta( viewers.value(key), viewers.value(val) ) end return t end -- function modes.namespaces_page_list()
function modes.init_modes_translate_events(frame, Central_version, mode_name, args_known, options_for_modes, QITEM) -- After versions.init(), initialize modes and their options, known arguments, translations, and default item. local res = "" modes.frame = frame langs.Central_version = Central_version -- To adapt the version of Module:Centralizer in any translated text. modes.args_known = args_known or modes.args_known modes.module_init(frame) -- Get modes.args_source with modes.args_source modes.mode_name = mode_name or modes.mode_name or "read" modes.init_options_for_modes(frame, options_for_modes, mode_name) -- Needed to init categories and errors local mode_name, source_key, try_lang = modes.get_arg_mode(mode_name, source_key, try_lang, args_source) langs.init_content_page_user_lang(modes.args_source.contentlang, modes.args_source.pagelang, modes.args_source.userlang, "modes.init") local recursiveLevel, recursive_limit, recursiveLevel_err = modes.recursive_normal(recursiveLevel, modes.recursive_limit) return res end -- function modes.init_modes_translate_events(frame, Central_version, mode_name, args_known, options_for_modes, QITEM)
-- p_template_drop_box_name = 'Cuadro desplegable', -- Equivalent templates exist in other wikis -- p_template_drop_box_name = 'Boîte déroulante', -- Modèle:Boîte déroulante for drop_box.form -- p_template_drop_box_name = 'Drop-down box', -- Template: Drop-down box for drop_box.form -- p_template_drop_box_name = 'Cuadro desplegable', -- Modelo: cuadro desplegable :Boîte déroulante for drop_box.form
-- cut_libraries
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- The Library:versions installs other libraries, supports versions, then binds modules, libraries and i18n translations. -- This library supports modules to: function versions. -- * Collect and bind modules and sub-modules depending from their p.version{} -- * Collect and bind translations from modules or libraries itself, and their /I18N sub-modules -- * Formats parametrable strings_c -- * Add a language needs only to add its own i18n subtable, like i18n.en = {} -- * Manage alternate versions of sub-modules sought in main, like Module:Sub, Module:Sub.2.1, Module:SubPlus. -- 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. -- Central Libraries, like modules, contain their own p.version{} identifications and i18n translations in Module:Library/library_name/I18N. -- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- - - - ------------------ - - - - ------------------ - - - - -----------------------------
-- versions = {} -- The Library:versions installs other libraries, bind modules and libraries, bind i18n translations, manage versions. -- versions = {} -- The Library:versions must stay in _G global space, to not change in init phase.
-- versions = {} -- already declared by Scribunto, see central_library.new() -- Record a library in package.loaded
-- The Module:Centralizer/I18N translations for lua_table library update and complete Module:Centralizer translations. versions.i18n = {} -- Translations for versions library versions.i18n.de = { -- Principaux textes, erreurs et catégories des outils versions_module_with_error_err = "Modul mit Fehler", versions_with_internal_error = "Modul mit internem Fehler", versions_with_internal_error_cat = "Modul mit internem Fehler", versions_with_usage_error = "Modul mit Bedienungsfehler", versions_with_usage_error_cat = "Modul mit Bedienungsfehler", versions_err_module_miss_i18n_i_cat = "Modul fehlende Übersetzung i18n", versions_module_miss_i18n_mini_err = "Erreur interne : La table i18n n'a que %1 traductions.", versions_running_times_title = "versions.running_times() Temps d'exécution et références pour les Lua-codeurs.", versions_luatables_counts = "%1 variables, %3 sous-tables, %2 fonctions", versions_table_dont_exists = "La table %1 n'existe pas.", versions_table_listlimit_levelmaxi = "Limite de niveau recursive_limit = %1 ", versions_table_listlimit_max_n = "Limite de longueur max_n = %1 ", versions_with_usage_error_cat = "Module avec erreur d'utilisation", versions_module_with_error_err = "Module avec erreur", versions_with_internal_error_cat = "Module avec erreur interne",
-- Gestion des versions versions_versions_no_select_altern_err = "Erreur de versions : pas de sélection dans l'alternative %1 du module %2.", versions_versions_too_select_altern_err = "Erreur de versions : %1 sélections dans l'alternative %2 du module %3.", versions_versions_select_not_used_err = "Erreur de versions : le sélecteur %1 n'est pas dans les alternatives %2 du module %3.", versions_versions_missing_module_err = "Erreur de versions : module absent pour la version %1 du module %2.", versions_main_module_missing_err = "Le module principal est introuvable.", versions_select_unknown_module_err = "Internal error: Le Module:%1 manquant est remplacé par le module normal Module:%2.", versions_I18N_module_no_base_err = "Le module de traductions %1 n'a pas de version de base.", versions_no_versions_module_err = "Le module %1 n'est pas dans le système des versions.", versions_all_versions_tests = "Versions avertissements : %1, normaux : %2, liste : %3.", versions_all_versions_check = "Versions: manquantes: %1, inconnues: %2, normales: %3, en excès: %4, toutes selectionées : %5.", versions_missing_versions_err = "Le module %1 manque dans le module principal %2.", versions_replaced_versions_err = "Le module %1 remplace le sous-module absent dans le module principal %2.", versions_unknownversions_err = "Le module %1 est inconnu dans le module principal %2.", versions_module_miss_i18n_txt_err = "Erreur interne : Le texte %1 manque de traduction en langue %2, et/ou d'autres.", versions_module_miss_i18n_count_err = "Erreur interne : Il y a %1 manques parmi %2 traductions.", versions_module_miss_i18n_none_err = "OK, aucune traduction manquante.", versions_module_miss_i18n_trad_err = "Erreur interne : manque de traduction pour l'argument i18n.%1.%2.",
-- Titres des tests versions_all_G_and_loaded_list_title = "versions.all_G_and_loaded_list() Objects dans l'espace global _G", versions_central_changes_headers = "clé; valeur; compte; niveau", versions_support_desk_title = "Informations de soutien: en version %1", versions_versions_management_report = "versions.versions_management_report() Rapport de gestion des versions", -- versions_bind_modules_tests_title = "versions.bind_modules_test() Test de la gestion des versions des modules", versions_verif_bind_modules_report = "Liaison des modules et contrôle des versions", versions_bind_modules_test_headers = "Versions demandées; Versions utilisées; Versions connues; ACTUEL : Erreurs dans le module actif; SIMULATION : Erreurs dans le module actif", versions_sort_central_modules_title = "versions.sort_central_modules_report() Liste triée des modules et bibliothèques centraux.", versions_sort_central_modules_headers = "Titre; Version; Date; Traductions / Langues", versions_sort_central_modules_counts = "ceci: + %2/%3 T/L, ", versions_versions_management_title = "versions.versions_support_test() Tests du support de versions.", versions_versions_management_headers = "sought; versions; process; comments", versions_add_deprecated_err = "Fonction obsolète %1(...). Remplacez-la par %2(...) dans le module %3.", versions_deprecated_function_tests = "versions.deprecated_function() Test: Fonction obsolète. Remplacez-la dans le module.", } -- versions.i18n.de versions.i18n.en = { -- Main string, errors and categories of tools versions_module_with_error_err = "Module with error", versions_with_internal_error = "Module with internal error", versions_with_internal_error_cat = "Module with internal error", versions_with_usage_error = "Module with usage error", versions_with_usage_error_cat = "Module with usage error", versions_running_times_title = "versions.running_times() Running times and references for Lua-coders.", versions_luatables_counts = "%1 variables, %3 sub-tables, %2 functions", versions_table_dont_exists = "The table %1 does not exist.", versions_table_listlimit_levelmaxi = "Level limit recursive_limit = %1 ", versions_table_listlimit_max_n = "Length limit max_n = %1 ", -- Versions management versions_versions_no_select_altern_err = "Versions error: no selection in the alternative %1 of the module %2.", versions_versions_too_select_altern_err = "Versions error: %1 selections in the alternative %2 of the module %3.", versions_versions_select_not_used_err = "Versions error: %1 selector is not in alternative %2 of the module %3.", versions_versions_missing_module_err = "Versions error: missing module for the version %1 of the module %2.", versions_main_module_missing_err = "The main module is not found.", versions_select_unknown_module_err = "Internal error: The missing Module:%1 is replaced by the normal Module:%2.", versions_I18N_module_no_base_err = "The %1 translations module has no basic version.", versions_no_versions_module_err = "The module %1 is not in the system of versions.", versions_all_versions_tests = "Versions warning: %1, normal: %2, listall: %3.", versions_all_versions_check = "Versions: missings: %1, unknowns: %2, normals: %3, excess: %4, all selected: %5.", versions_missing_versions_err = "The module %1 misses in the main module %2.", versions_replaced_versions_err = "The module %1 replaces the missing sub-module in the main module %2.", versions_unknownversions_err = "The module %1 is unknown in the main module %2.", versions_module_miss_i18n_txt_err = "Internal Error: The text %1 lack of translation in %2 language, and/or others.", versions_module_miss_i18n_count_err = "Internal Error: There are %1 missings in %2 translations.", versions_module_miss_i18n_none_err = "OK, none missing translations.", versions_module_miss_i18n_trad_err = "Internal Error: Module missing i18n translation for the argument i18n.%1.%2.", versions_err_module_miss_i18n_cat = "Module missing i18n translation", versions_err_module_miss_i18n_cat = "Module with internal error", versions_module_miss_i18n_mini_err = "Error: I18n table has only 1% translations.",
-- Titles of tests versions_all_G_and_loaded_list_title = "versions.all_G_and_loaded_list() Objects in _G global space", versions_central_changes_headers = "key; val; count; level", versions_support_desk_title = "Support information: in version %1", versions_versions_management_report = "versions.versions_management_report() Versions management report", -- versions_bind_modules_tests_title = "versions.bind_modules_test() Test for management of modules versions", versions_verif_bind_modules_report = "Binding of modules and versions control", versions_bind_modules_test_headers = "Sought versions; Used versions; Known versions; ACTUAL: Errors in the active module; SIMULATION: Errors in the active module", versions_sort_central_modules_title = "versions.sort_central_modules_report() Sorted list of central modules and libraries.", versions_sort_central_modules_headers = "Title; Version; Date; Translations / Languages", versions_sort_central_modules_counts = "this: + %2/%3 T/L, ", versions_versions_management_title = "versions.versions_support_test() Tests of versions management.", versions_versions_management_headers = "sought; versions; process; comments", versions_add_deprecated_err = "Deprecated function %1(...). Replace it by %2(...) in the module %3.", versions_deprecated_function_tests = "versions.deprecated_function() Test: Deprecated function. Replace it in the module.", } -- versions.i18n.en versions.i18n.es = { -- Textos principales, errores y categorías de instrumentos versions_module_with_error_err = "Módulo con error", versions_with_internal_error = "Módulo con error interno", versions_with_internal_error_cat = "Módulo con error interno", versions_with_usage_error = "Módulo con error del uso", versions_with_usage_error_cat = "Módulo con error del uso", versions_err_module_miss_i18n_i_cat = "Módulo traducción i18n que falta", versions_running_times_title = "versions.running_times() Tiempos de ejecución y referencias para los codificadores Lua.", versions_luatables_counts = "%1 variables, %3 subtablas, %2 funciones", versions_table_dont_exists = "La tabla %1 no existe.", versions_table_listlimit_levelmaxi = "Límite de nivel recursive_limit = %1", versions_table_listlimit_max_n = "Límite de longitud max_n = %1", versions_with_usage_error_cat = "Módulo con error del uso", versions_module_with_error_err = "Módulo con error", versions_with_internal_error_cat = "Módulo con interno error",
-- Gestión de versiones versions_versions_no_select_altern_err = "Error de versiones: no hay selección en alternativa %1 del módulo %2.", versions_versions_too_select_altern_err = "Error de versiones: %1 selecciones en la alternativa %2 del módulo %3.", versions_versions_select_not_used_err = "Error de versiones: selector %1 no es en alternativas %2 del módulo %3.", versions_versions_missing_module_err = "Error de versiones: módulo ausente para la versión %1 del módulo %2.", versions_main_module_missing_err = "El módulo principal no es encontrado.", versions_select_unknown_module_err = "Internal error: El Módulo:%1 faltante se reemplaza por lo normal Module:%2.", versions_I18N_module_no_base_err = "El módulo de traducciones %1 no tiene ninguna versión básica.", versions_no_versions_module_err = "El %1 módulo no está en el sistema de versiones.", versions_all_versions_tests = "Versiones aviso: %1, normal: %2, lista: %3.", versions_all_versions_check = "Versiones: falta: %1, incógnitas: %2, normales: %3, en exceso: %4, selecciona todo: %5.", versions_missing_versions_err = "El módulo %1 no disponible en el módulo principal %2.", versions_replaced_versions_err = "El módulo %1 reemplaza el sub-módulo ausente en el módulo principal %2.", versions_unknownversions_err = "El módulo %1 es desconocido en el módulo principal %2.", versions_module_miss_i18n_txt_err = "Error Interno: El texto %1 falta de traducción en %2 lengua, y / o otras.", versions_module_miss_i18n_count_err = "Error interno: Hay %1 que falta en %2 traducciones.", versions_module_miss_i18n_none_err = "OK, ninguno traducciones que faltan.", versions_module_miss_i18n_trad_err = "Error interno: translation faltan en Módulo i18n para el argumento i18n.%1.%2.", versions_module_miss_i18n_mini_err = "Error: la tabla i18n tiene solamente 1% traducciones.",
-- Titres des pruebas versions_all_G_and_loaded_list_title = "versions.all_G_and_loaded_list() Objects en el espacio global _G", versions_central_changes_headers = "llave; valor; contar; nivel", versions_support_desk_title = "Información de soporte: en versión %1", versions_versions_management_report = "versions.versions_management_report() Informe de gestión de versiones", -- versions_bind_modules_tests_title = "versions.bind_modules_test() Test for management of modules versions", versions_verif_bind_modules_report = "Binding of modules and versions control", versions_bind_modules_test_headers = "Sought versions; Used versions; Known versions; ACTUAL: Errors in the active module; SIMULATION: Errors in the active module", versions_sort_central_modules_title = "versions.sort_central_modules_report() Lista ordenada de módulos y bibliotecas centrales.", versions_sort_central_modules_headers = "Título; Versión; Fecha; Traducciones / Idiomas", versions_sort_central_modules_counts = "esta + %2/%3 T/I, ", versions_versions_management_title = "versions.versions_support_test() Pruebas de gestión de versiones.", versions_versions_management_headers = "sought; versions; process; comments", versions_add_deprecated_err = "Función obsoleta %1(...). Sustitúyala por %2(...) en el módulo %3.", versions_deprecated_function_tests = "versions.deprecated_function() Prueba: Función obsoleta. Sustitúyala en el módulo.", } -- versions.i18n.es versions.i18n.fr = { -- Principaux textes, erreurs et catégories des outils versions_module_with_error_err = "Module avec erreur", versions_with_internal_error = "Module avec erreur interne", versions_with_internal_error_cat = "Module avec erreur interne", versions_with_usage_error = "Module avec erreur d'utilisation", versions_with_usage_error_cat = "Module avec erreur d'utilisation", versions_err_module_miss_i18n_i_cat = "Module manquant de traduction i18n", versions_module_miss_i18n_mini_err = "Erreur interne : La table i18n n'a que %1 traductions.", versions_running_times_title = "versions.running_times() Temps d'exécution et références pour les Lua-codeurs.", versions_luatables_counts = "%1 variables, %3 sous-tables, %2 fonctions", versions_table_dont_exists = "La table %1 n'existe pas.", versions_table_listlimit_levelmaxi = "Limite de niveau recursive_limit = %1 ", versions_table_listlimit_max_n = "Limite de longueur max_n = %1 ", versions_with_usage_error_cat = "Module avec erreur d'utilisation", versions_module_with_error_err = "Module avec erreur", versions_with_internal_error_cat = "Module avec erreur interne",
-- Gestion des versions versions_versions_no_select_altern_err = "Erreur de versions : pas de sélection dans l'alternative %1 du module %2.", versions_versions_too_select_altern_err = "Erreur de versions : %1 sélections dans l'alternative %2 du module %3.", versions_versions_select_not_used_err = "Erreur de versions : le sélecteur %1 n'est pas dans les alternatives %2 du module %3.", versions_versions_missing_module_err = "Erreur de versions : module absent pour la version %1 du module %2.", versions_main_module_missing_err = "Le module principal est introuvable.", versions_select_unknown_module_err = "Internal error: Le Module:%1 manquant est remplacé par le module normal Module:%2.", versions_I18N_module_no_base_err = "Le module de traductions %1 n'a pas de version de base.", versions_no_versions_module_err = "Le module %1 n'est pas dans le système des versions.", versions_all_versions_tests = "Versions avertissements : %1, normaux : %2, liste : %3.", versions_all_versions_check = "Versions: manquantes: %1, inconnues: %2, normales: %3, en excès: %4, toutes selectionées : %5.", versions_missing_versions_err = "Le module %1 manque dans le module principal %2.", versions_replaced_versions_err = "Le module %1 remplace le sous-module absent dans le module principal %2.", versions_unknownversions_err = "Le module %1 est inconnu dans le module principal %2.", versions_module_miss_i18n_txt_err = "Erreur interne : Le texte %1 manque de traduction en langue %2, et/ou d'autres.", versions_module_miss_i18n_count_err = "Erreur interne : Il y a %1 manques parmi %2 traductions.", versions_module_miss_i18n_none_err = "OK, aucune traduction manquante.", versions_module_miss_i18n_trad_err = "Erreur interne : manque de traduction pour l'argument i18n.%1.%2.",
-- Titres des tests versions_all_G_and_loaded_list_title = "versions.all_G_and_loaded_list() Objects dans l'espace global _G", versions_central_changes_headers = "clé; valeur; compte; niveau", versions_support_desk_title = "Informations de soutien: en version %1", versions_versions_management_report = "versions.versions_management_report() Rapport de gestion des versions", -- versions_bind_modules_tests_title = "versions.bind_modules_test() Test de la gestion des versions des modules", versions_verif_bind_modules_report = "Liaison des modules et contrôle des versions", versions_bind_modules_test_headers = "Versions demandées; Versions utilisées; Versions connues; ACTUEL : Erreurs dans le module actif; SIMULATION : Erreurs dans le module actif", versions_sort_central_modules_title = "versions.sort_central_modules_report() Liste triée des modules et bibliothèques centraux.", versions_sort_central_modules_headers = "Titre; Version; Date; Traductions / Langues", versions_sort_central_modules_counts = "ceci: + %2/%3 T/L, ", versions_versions_management_title = "versions.versions_support_test() Tests du support de versions.", versions_versions_management_headers = "sought; versions; process; comments", versions_add_deprecated_err = "Fonction obsolète %1(...). Remplacez-la par %2(...) dans le module %3.", versions_deprecated_function_tests = "versions.deprecated_function() Test: Fonction obsolète. Remplacez-la dans le module.", } -- versions.i18n.fr
versions.ModuleNS = mw.site.namespaces.Module.name .. ":" versions.loaded_modules_and_libraries = versions.loaded_modules_and_libraries or {}
function versions.get_one_module_or_library(title, given_module) -- Get a module or a library, then form and record its descriptor.xx -- local get, module = versions.get_one_module_or_library("Module:Centralizer") -- basic example of use local get, module, required, loaded = {} if type(title) ~= "string" then get.title = "abnormal title : " .. tostring(title) get.is_nil = true return get end -- If not loaded, return only an empty get if (type(given_module) == "table") then module = given_module elseif (type(given_module) == "function") then module = given_module() else -- to require a new module loaded = versions.pcallRequire(title) -- require() must not fail and block the page if the module do not exists. if (type(loaded) == "table") or (type(loaded) == "function") then module = loaded -- The module is well loaded in package.loaded else return get end -- If not loaded, return only get.isTitled and get.title end get.title = title -- like Module:Author, or the versioning library get.module = module -- like {...} get.is_nil = not module -- like true or false get.is_loaded = true and package.loaded[title] -- true if the module is in package.loaded get.is_function = (type(module) == "function") -- true if the module is a function get.is_table = (type(module) == "table") -- true if the module is a table get.i18n = module.i18n -- i18n table of the module get.version = module.version -- table including module.version.known and module.version.sought get.is_library = (type(module)=="table") and not (type(module)=="function") and not (string.find(title, versions.ModuleNS, 1, true) ) get.hasi18n = (type(module) == "table") and (type(get.i18n) == "table") -- true if the object has a i18n translations table get.versionName = string.gsub(get.title or "", versions.ModuleNS, "") -- without Module: like versioning or Author get.versionTitle = versions.ModuleNS .. get.versionName -- normalize title like Module:Author get.is_module = string.find(get.title, versions.ModuleNS) -- true if the object is like Module:Author get.isI18N = true and string.find(get.title, "/I18N") -- true if the title contains /I18N like Module:Author/I18N get.withoutI18N = string.gsub(get.versionName, "/I18N", "") -- version without /I18N like versioning or Module:Author get.versionI18N = get.withoutI18N .. "/I18N" -- version with /I18N like Module:Author/I18N get.nowstamp = os.date("%Y%m%d%H%M%S") -- like YYYYMMDDhhmmss from module -- Special for ISmodule, ISlibrary, ISfunction if get.is_library then get.revistamp = get.nowstamp get.TitleI18N = versions.ModuleNS .. "Library/" .. get.withoutI18N .. "/I18N" -- like Module:Library/versioning/I18N get.pagename = TitleI18N -- Locate translations like Module:Library/versioning/I18N get.i18nRoot = get.versionName -- Where locate translations are like versioning elseif get.is_module then get.revistamp = mw.getCurrentFrame():preprocess( "" ) get.pagename = "Module:" .. get.versionName -- Locate translations like Module:Centralizer/I18N get.i18nRoot = get.pagename -- Where locate translations are like Module:Author get.TitleI18N = versions.ModuleNS .. get.withoutI18N .. "/I18N" -- like Module:Centralizer/I18N else get.revistamp = mw.getCurrentFrame():preprocess( "" ) end get.versionName = string.gsub(get.title or "", versions.ModuleNS, "") -- full version name with perhaps /I18N get.simplename = string.gsub(get.versionName, "/I18N", "") -- delete "/I18N" if any get.viewI18N = get.simplename if type(module) == "function" then get.is_function = true -- ISfunction get.is_module = false get.is_library = false get.functionName = get.simplename -- like tostring get.pagename = "function:" .. get.simplename -- like function:tostring elseif string.find(get.title, versions.ModuleNS) then -- If the module title begin with "Module:" get.is_function = false get.is_module = true -- ISmodule get.is_library = false get.moduleName = get.title -- complete the title with "Module:" like Module:Centralizer get.subI18N = get.title .. "/I18N" -- eventual sub-module "/I18N" like Module:Centralizer/I18N get.pagename = versions.ModuleNS .. get.simplename -- like Module:Centralizer if get.isI18N then get.pagename = get.pagename .. "/I18N" end -- like Module:Centralizer/I18N if get.isI18N then get.viewI18N = get.simplename .. "/I18N" end -- like Central/I18N else -- If the module is a library get.is_function = false get.is_module = false get.is_library = true -- ISlibrary get.libraryName = get.title -- standard library name like versioning get.versionName = get.libraryName -- like versioning get.pagename = versions.ModuleNS .. "Library/" .. get.title -- like Module:Library/versioning get.subI18N = get.pagename .. "/I18N" -- /I18N sub-module like Module:Library/versioning/I18N if get.isI18N then get.pagename = get.subI18N end -- like Module:Library/versioning/I18N if get.isI18N then get.viewI18N = get.simplename .. "/I18N" end -- like versioning/I18N end if get.isI18N and (type(get.module) == "table") and (type(get.module.i18n) == "table") then get.sub_i18n = get.module.i18n end -- stamp, date and time if not get.revistamp then get.revistamp = os.date("%Y%m%d %H%M%S") end local function days(stamp) -- approximate the number of days from 0000-01-01 local day = 0 if (type(stamp) == "string") and (string.len(stamp) > 7) then day = tonumber(string.sub(stamp,1,4)) * 365 + tonumber(string.sub(stamp,5,6)) * 30 + tonumber(string.sub(stamp,7,8)) end return day end if get.revistamp then get.days_revis = days(get.revistamp) get.days_now = days(get.nowstamp) get.delay = get.days_now - get.days_revis get.revistime = string.sub(get.revistamp,1,4) .. "-" .. string.sub(get.revistamp,5,6) .. "-" .. string.sub(get.revistamp,7,8) .. " " .. string.sub(get.revistamp,-6,-5) .. ":" .. string.sub(get.revistamp,-4,-3) get.shortdays = string.sub(get.revistamp or "", 3, 8) get.shorttime = string.sub(get.revistime or "", -9, -1) if get.delay < 25 -- time4 then get.shortVersion = "v" .. get.shorttime -- short version in "vDD hh:mm" until around 25 days else get.shortVersion = "v" .. get.shortdays -- later in date vYYMMDD end get.versionDate = get.revistime get.versionNumber = get.shortVersion get.versionName = string.gsub(get.title or "", versions.ModuleNS, "") -- full version name with perhaps /I18N get.versionDate = get.revistime if type(get.module.version) == "table" then -- For central modules or libraries only: get.module.versionName = get.versionName -- Record in each module to later IDENTIFY any module. See task T119978, "own module name" get.module.versionDate = get.versionDate -- Record in each module to later DATE any module. See task T119978, "own module name" end end if get.version then get.sought = get.version.sought or get.version.selector or "" get.known = get.version.known or get.version.all_versions or "" -- local str = string.gsub(get.sought, " ", ";") get.sought_tab = mw.text.split(str, ";", true) get.sought_count = lua_table.level_count(get.sought_tab) -- local str = string.gsub(get.known, "*", ";") get.known_tab = mw.text.split(str, ";", true) get.known_count = lua_table.level_count(get.known_tab) end -- Record the get descriptor with others versions.loaded_modules_and_libraries = versions.loaded_modules_and_libraries or {} if get.i18n then table.insert(versions.loaded_modules_and_libraries, get) end -- versions.bind_main_and_sub_modules_get = versions.bind_main_and_sub_modules_get or {} versions.bind_main_and_sub_modules_get[get.title] = get return get, module end -- local get, module = versions.get_one_module_or_library(title, given_module)
function versions.bind_all_i18n() -- Bind all i18n translations from all sub-modules in reverse order. -- Translate all translations in the exact reverse order, using the memorised binding order. -- Then upper modules happens later and can adapt translations. local t = "\n* versions.bind_all_i18n() " for i = lua_table.level_count(versions.central_libraries_sort), 1, -1 do -- in reverse order sub_module_name = versions.central_libraries_sort[i] local get = versions.bind_main_and_sub_modules_get[sub_module_name] -- Use the get descriptor of the sub_module. -- Add i18n translations from the sub-module itself: if (type(get.title) == "string") and (type(get.i18n) == "table") then versions.add_one_i18n("", get.title, get.i18n) -- Add i18n translations with previews one's. t = t .. "\n*" .. viewers.ta("title", get.title) t = t .. viewers.ta("#i18n", lua_table.level_count(get.i18n) ) end -- Add i18n translations from an eventual /I18N sub-module: if (type(get.subI18N) == "string") then local get, module = versions.get_one_module_or_library(get.subI18N) if (type(get.title) == "string") and (type(get.i18n) == "table") then versions.add_one_i18n("", get.title, get.i18n) -- Add i18n translations with previews one's. t = t .. "\n*" .. viewers.ta("title", get.title) t = t .. viewers.ta("#i18n", lua_table.level_count(get.i18n) ) end end end return t end -- t = versions.bind_all_i18n() -- Bind all sub-modules of the main module.
function versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n. -- The main module call this function to load needed sub-modules and translations. local t = t -- t or if type(t) ~= "string" then t = '\n* versions.bind_the_main_module() : Bind the main module, all sub-modules and all their i18n' end local main_module = versions.get_one_module_or_library(title) -- Get the main module. -- Table to collect loaded sub-modules names in binding order and i18n translations in reverse order. versions.central_libraries_sort = versions.central_libraries_sort or {} versions.bind_main_and_sub_modules_get = versions.bind_main_and_sub_modules_get or {} -- -- After get the main module, get the versions for their management. -- The main module can use or not the versions management. versions.main_module = main_module if type(main_module) == "table" and type(main_module.version) == "string" then -- For main modules using versions management versions.main_versions = main_module.version end local main_versions = versions.main_versions -- nil if the main module do not uses the versions management. -- if not versions.main_module then -- The main module is not found. t = t .. viewers.styles_color_error( viewers.form9user("versions_main_module_missing_err") ) end return t end -- function versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n.
function versions.bind_all_sub_modules_test() -- Test : Bind all sub-modules of the main module. versions.bind_all_sub_modules_track = "TEST" local memo = viewers.save_configs("versions.bind_all_sub_modules_test") -- Save global configuration before eventual changes. local sub_modules = versions.sub_modules local iftest = true local t = t -- t or if (type(t) ~= "string") then t = '\n* versions.bind_all_sub_modules_test() : Test : Bind all sub-modules of the main module' end t = t .. "\n* bind_all_sub_modules_test sub_modules.sub_tries :" .. lua_table.rough_view(sub_modules.sub_tries) local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "versions.bind_all_sub_modules() Test : Bind all sub-modules of the main module", test_group = sub_modules.sub_tries, form_one_case = function(case) -- Convert a case from test_group to rowGroup. return { case.insub, case.sub, case.sought, case.known, case.errors or "", } end, headers = " insub; sub; sought; known; errors ", headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "versions.bind_all_sub_modules_test") -- Restore global configurations after eventual changes. return t end -- t = versions.bind_all_sub_modules_test()
versions.bind_all_sub_modules_track = "SOURCE" versions.sub_modules = {} versions.sub_modules.sub_tries = { -- TEST: Bind all sub-modules of the main module. -- Normal cases: all known = "Box1, Box3 * Group;Group2;Group4 * Item;Item5;Item7" Main = { versionName = "Main", sought = "Box1;Group2;Item5", known = "Box1;Box3 * Group;Group2;Group4 * Item5;Item7", }, Box1 = { versionName = "Box1", sought = "Group2;Item5", known = "Group;Group2;Group4 * Item5;Item7", }, Box3 = { versionName = "Box3", sought = "Group2;Item", known = "Group2;Group4 * Item;Item5", }, Group2 = { versionName = "Group2", sought = "Item", known = "Item;Item5,Item7", }, Group4 = { versionName = "Group4", sought = "Item5", known = "Item;Item5,Item7", }, -- Errors cases: Box1_ms = { versionName = "Box1", sought = "Group2", known = "Group;Group2;Group4 * Item5;Item7", }, -- missing sought Box3_es = { versionName = "Box3", sought = "Group2;ItemERR", known = "Group2;Group4 * Item;Item5", }, -- erroneous sought Group2_mk = { versionName = "Group2", sought = "Item", known = "Item5,Item7", }, -- missing known Group4_ek = { versionName = "Group4", sought = "Item5", known = "Item;ItemERR,Item7", }, -- erroneous known Box3_ks = { versionName = "Box3", sought = "Group2;ItemERR", known = "Group2;Group4 * Item;Item5", }, -- known repairs erroneous sought }
-- MdCentral continue local t = proto pour memo code 20190825 2219 ().lua used ERR -- MdCentral (4e copie) memo recent pour demain 20190826 2359 .lua used used ERR -- MdCentral continue local t = t -- t for more stable code 20190825 2219.lua used ERR -- versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n. used ERR -- MdCentral (3e copie).lua
function versions.bind_all_sub_modules(sub_modules, iftest) -- Bind all sub-modules of the main module.
local t = "\n* versions.bind_all_sub_modules() Bind all sub-modules of the main module."
t = t .. "\n* versions.bind_all_sub_modules_track : " .. versions.bind_all_sub_modules_track
-- Method: Record in a stack the sought sub-modules for the main_module.
-- For each try of sub-module, add it in stack. That extend the stack along the procces.
-- For each error, when found, add it the errors stack. At the end prioritize them and display only the most significant.
-- To report that display sought known and used sub-modules like in the stack, in colors to show typical errors.
-- To test these process, try normal and erroneous cases.
-- These process are like a small expert system.
-- The main module call this function to load needed sub-modules and translations.
-- Later run versions.bind_reverse_i18n_translations() -- Bind all i18n translations in reverse order, from modules and their /I18N sub-modules
local args_known = args_known or modes.args_known or p.args_known or {}
local sub_modules = sub_modules
local iftest = iftest or false
local actual_init, sub_modules_stack
local main_module, main_versions, ModuleNS
local sub_tries, i_tries, sub_used, i_used
local sought, known = "", ""
-- Select and activate the right scenario, actual or for test.
if iftest then -- TEST: Bind all sub-modules of the main module.
versions.bind_all_sub_modules_track = "TEST"
sub_modules.ModuleNS = "Module:"
if (type(sub_modules) ~= "table") and (type(versions.sub_modules) == "table") then sub_modules = versions.sub_modules end
sub_modules = mw.clone(sub_modules)
sub_tries = sub_modules.sub_tries or {}
sub_modules.sub_used = {}
i_tries = sub_modules.i_tries or {}
sub_modules.i_used = {}
main_versions = sub_tries.Main -- from main test, with versions.versionName = "Main" as example
else -- ACTUAL: Bind all sub-modules of the main module.
versions.bind_all_sub_modules_track = "ACTUAL"
main_module = versions.main_module
main_versions = versions.main_versions
sub_modules = {}
sub_modules.ModuleNS = mw.site.namespaces.Module.name .. ":"
sub_modules.sub_tries = {}
sub_modules.sub_used = {}
sub_modules.i_tries = {}
sub_modules.i_used = {}
sub_tries = sub_modules.sub_tries or {}
sub_tries.Main = main_module.version -- from main actual, with versions.versionName = "Central-s-fr" as example
if (type(main_module.version) ~= "table") then -- Start the version management binding for the main module.
-- ACTUAL: Bind all sub-modules of the main module.
main_versions = sub_tries.Main
end
if (type(main_module.version) == "table") then -- Start the version management binding for the main module.
-- ACTUAL: Bind all sub-modules of the main module.
sub_tries.Main = main_module.version -- with versions.versionName = "Central-s-fr" as example
end
end
-- Get initial sought and known sub_modules
local function viewers_sub_to_i_sub(sub) -- Formats a sequence table from a keyed table.
local tosub = {}
for key, elem in pairs(sub) do
elem[insub] = key
table.insert(tosub, elem)
end
return tosub
end
t = t .. "\n* bind_sub_modules() start: "
local sought_t = string.gsub(sought or "", " ", ";") -- ";" .. .. ";"
local sought_tab = mw.text.split(sought_t, ";", true)
local sought_maxn = table.maxn(sought_tab)
local known_maxn = table.maxn(args_known) -- local known_maxn = #known_tab
local used = ";"
local main_versions = {}
-- if 'main_versions' (a nil value). replace main_versions by from 20171224 infos p.["infos"]["versions"]["libname"]
t = t .. "\n* list versioning sought.bind_sub_modules : "
if (type(p["infos"]) == "table") and (type(p["infos"]["versions"]) == "table") then main_versions = p["infos"]["versions"] end
-- .. viewers.ta("main_versions.versionName", main_versions.versionName) --
-- .. viewers.ta("main_versions.sought", main_versions.sought) .. viewers.ta("sought_maxn", sought_maxn)
-- .. "
" .. viewers.ta("main_versions.known", main_versions.known) .. viewers.ta("known_maxn", known_maxn)
local sub_tries = {} -- Duplicate sub_tries to not disturb original sub_modules.sub_tries
for key, elem in pairs(sub_modules.sub_tries) do -- alternatives = known_tab[i]
local try = mw.clone(elem) -- Duplicate sub_tries to not disturb original sub_modules.sub_tries
sub_tries[key] = try
end
local normal, altern, alternatives, kind, altern_tab
local elem, module, normal, alias, name_I18N, version
for i, try in pairs(args_known) do -- alternatives = known_tab[i]
local sought_t = string.gsub(try.sought or "", " ", ";") -- ";" .. .. ";"
local known_tab = mw.text.split(try.known or "", "*", true)
local known_maxn = table.maxn(args_known) -- local known_maxn = #known_tab
try.errors = ""
alternatives = try.known
if v == 1 then -- Permit to select normal version in case of none others match.
normal = altern
kind = "normal"
end
if type(alternatives) == "string" then
alternatives = ";" .. mw.text.trim(alternatives) .. ";" -- normalize versions between ";"
else
alternatives = ";"
end
local altern_tab = mw.text.split(alternatives, "*", true) -- see _Example
for i, alternate in ipairs(altern_tab) do
local sought_tab = mw.text.split(sought_t, ";", true)
local sought_maxn = table.maxn(sought_tab)
normal = "" ; version = ""
for v, altern in ipairs(sought_tab) do
altern = tostring(altern)
altern = mw.text.trim(altern)
if v == 1 then -- Permit to select normal version in case of none others match.
normal = altern
kind = "normal"
end
-- Try others alternate versions
local try = { insub = normal, versionName = altern, ["sought"] = sought, ["known"] = known, }
try.errors = ""
local insert_try = false
if v == 1 and string.find(";" .. sought .. ";", ";" .. altern .. ";", 1, true) then
-- sub_modules.sub_used = {} -- Bind all sub-modules used in the main module.
end
if v > 1 then -- and viewers.is_in_sp(altern, sought, ";")
version = altern
kind = "version"
end
if not viewers.is_in_sp(altern, sought, ";") then
try.errors = try.errors .. "; altern_is_not_in_sought"
end
if viewers.is_in_sp("WantedError", known, ";") then
-- { insub = "Box2", versionName = "Group4", sought = "Item4;Item", known = "Item2;WantedError;Item3", }, -- Example of test case
try.errors = (try.errors or "") .. "altern_is_WantedError"
try.known = "Item2;Item3" -- PREVENT A RECURSIVE LOOP IN STACK
end
if try.versionName == "Box3" then
try.versionName = "Box345" -- PREVENT A RECURSIVE LOOP IN STACK
try.errors = try.errors .. "; altern_is_Box3"
end
if try.insub == "Group2" then
try.errors = try.errors .. "; altern_is_WantedError"
end
if viewers.is_in_sp(altern, known, ";") then -- Try another sub_module
local new_try = nil
if iftest then -- In test of versions management
if (type(sub_tries[altern]) == "table") then new_try = sub_tries[altern] end
else -- In normal run of versions management
-- Get a module or a library, then form and record a descriptor of it.
local get, module = versions.get_one_module_or_library( sub_modules.ModuleNS .. altern )
if (type(get.module) == "table") and (type(get.moduleName) == "string") then -- Verify main module and versions management ability.
new_try = { insub = altern, versionName = get.moduleName, ["sought"] = get.module.version.sought, ["known"] = get.module.version.known, errors = "" }
insert_try = true
end
end
if new_try and lua_table.level_count(sub_tries) < 111 then -- Limit the number of sub_modules to 111
sub_modules.sub_tries[altern] = new_try
sub_modules.i_tries = viewers_sub_to_i_sub(sub_modules.sub_tries) -- Formats a sequence table from a keyed table.
sub_modules.sub_used[altern] = new_try
sub_modules.i_used = viewers_sub_to_i_sub(sub_modules.sub_tries) -- Formats a sequence table from a keyed table.
sought = sought .. ";" .. new_try.sought -- this sub_modules extend sought for inner sub_modules
known = known .. " * " .. new_try.known -- this sub_modules extend known for inner sub_modules
else
try.errors = try.errors .. "; Limit the number of sub_modules to 111"
end
end
end
end
end -- for i = known_maxn, 1, -1 do -- alternatives = known_tab[i]
--
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "versions.bind_all_sub_modules(sub_modules, iftest) -- Bind all sub-modules of the main module",
test_group = sub_modules.sub_tries,
headers = " insub; sub; sought; known; errors ",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
return { case.insub, case.sub, case.sought, case.known, case.errors or "", }
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
if iftest then versions.bind_all_sub_modules_test_report = t -- TEST: Bind all sub-modules of the main module.
else versions.bind_all_sub_modules_actual_report = t end -- TEST: Bind all sub-modules of the main module.
return t, sub_modules.sub_used
end -- t, sub_modules = versions.bind_all_sub_modules(sub_modules, iftest)
versions.bindable_libraries = { -- New libraries to record in package.loaded[] ["activity"] = "The activity library supports Lua-coders sub-tasks for central modules in international interactions.", ["datas"] = "The datas library formats some viewers for tables(in lines and columns), luatables...", ["drop_box"] = "The drop_box library formats Drop-boxes as objects, inside the viewers library", ["events"] = "The events library formats events like errors, warnings and categories.", ["langs"] = "The langs library supports i18n translations.", ["lua_table"] = "The lua_table library enhances the previous table library, to avoid ambiguities. To enhance, we could write here : lua_table = table.", ["modes"] = "The modes library supports modes and their options, like p.read(frame).", ["tableview"] = "The tableview library formats tableviews as objects, inside the viewers library", ["tracker"] = "The tracker library implements parametrable track objects to debug the Lua code, inside the activity library.", ["versions"] = "The versions library installs all central libraries, bind modules, libraries and i18n translations. Also support versions management.", ["viewers"] = "The viewers library formats some viewers for tables(in lines and columns), Drop-boxes, luatables...", ["mathroman"] = "The mathroman library converts roman numbers and detect errors. It is here as an example of very small central library.", }
function versions.add_one_i18n(t, module_name, module_tab) -- Adds with others an i18n translations table and list all differences of translations. local t = t -- t or if (type(t) ~= "string") then t = '\n* versions.add_one_i18n(t, module_name, module_tab) : Adds with others an i18n translations table and list all differences of translations' end local main_i18n = langs.main_i18n or versions.main_i18n or versions.memo_i18n local i18n, lang_N, text_N = {} ,0, 0 local translations_differences = {} function versions.detect_transDiff(trans1, trans2) -- Collect all differences of translations if trans1.dtrans and trans2.dtrans and (trans1.dlang == trans2.dlang) and (trans1.dkey == trans2.dkey) and (trans1.dtrans ~= trans2.dtrans) then table.insert(translations_differences, { ["trans1"] = trans1, ["trans2"] = trans2 }) -- build a table with only languages codes end -- Only fast collect to treat later if needed. end if type(module_tab) == "table" and type(module_tab.i18n) == "table" then -- and type(module_tab.i18n) == "table" then i18n = module_tab.i18n or {} -- i18n lang_N, text_N = 0, 0 for lang, trans in pairs(i18n) do -- For all languages of the mixed module or library if main_i18n[lang] then -- the language already exists, add or replace imported fields lang_N = lang_N + 1 if type(trans) == "table" then -- if the language to add is really in a table for key, val in pairs(trans) do -- For all imported fields versions.detect_transDiff( -- Collect all differences of translations { dlang = lang, dkey = key, dfile = "previous", dtrans = main_i18n[lang][key] }, { dlang = lang, dkey = key, dfile = module_name, dtrans = val} ) main_i18n[lang][key] = val -- add or replace a field and its translation text_N = text_N + 1 end end t = t .. viewers.form9user(", lang:%1:%2:%3 ", lang, lang_N, text_N) -- t = t .. viewers.form9tests(", lang:%1:%2:%3 ", lang, lang_N, text_N) else -- add the table and all is fields if it is not already in langs.main_i18n if mw.language.isKnownLanguageTag(lang) then -- only for languages known in wikis lang_N = lang_N + 1 main_i18n[lang] = mw.clone(trans) text_N = text_N + lua_table.level_count(trans) t = t .. viewers.form9user(", lang:%1:%2:%3 ", lang, lang_N, text_N) -- t = t .. viewers.form9tests(", lang:%1:%2:%3 ", lang, lang_N, text_N) end end end end t = t .. viewers.ta("lang_N", lang_N) .. viewers.ta("lang_N", text_N) return t, lang_N, text_N end -- function versions.add_one_i18n(t, module_name, module_tab)
function versions.pcallRequire(version) -- require() must not fail and block the page. if type(version) == "string" then version = string.gsub( version, versions.ModuleNS, "" ) -- normalize for always one "Module:" local bug = "Erreur Lua dans Module:Centralizer-s-fr à la ligne 5778 : attempt to call field 'gsub' (a nil value)." version = versions.ModuleNS .. version -- example Module:Centralizer/I18N end local success, module = pcall( require, version ) -- pcall or xpcall can run any function without blocking page. if not success then module = nil end return module end
function versions.setup_central_libraries(bindable_libraries, opt) -- Install central bindable libraries in package.loaded -- Record centralisable libraries if they are not included in standard mw.Extension:Scribunto -- RunOnce : Do not repeat this function to not disturb subsequent processes. local bindable_libraries = bindable_libraries or versions.bindable_libraries versions.central_libraries_sort = versions.central_libraries_sort or {} local sorted_bind_libraries = versions.central_libraries_sort -- Record central libraries from _G space to package.loaded, using setup. local sorted_bind_libraries = {} activity = central_library.new("activity", activity) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, activity) -- Record all libraries args = central_library.new("args", args) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, args) -- Record all libraries central_library = central_library.new("central_library", central_library) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, central_library) -- Record all libraries datas = central_library.new("datas", datas) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, datas) -- Record all libraries drop_box = central_library.new("drop_box", drop_box) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, drop_box) -- Record all libraries events = central_library.new("events", events) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, events) -- Record all libraries langs = central_library.new("langs", langs) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, langs) -- Record all libraries lua_table = central_library.new("lua_table", lua_table) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, lua_table) -- Record all libraries mathroman = central_library.new("mathroman", mathroman) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, mathroman) -- Record all libraries modes = central_library.new("modes", modes) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, modes) -- Record all libraries tableview = central_library.new("tableview", tableview) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, tableview) -- Record all libraries tracker = central_library.new("tracker", tracker) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, tracker) -- Record all libraries versions = central_library.new("versions", versions) -- Lock in _G and package.loaded table.insert(sorted_bind_libraries, versions) -- Record all libraries viewers = central_library.new("viewers", viewers) -- Lock in _G and package.loaded local libname_libraries = {} for i, obj in pairs(sorted_bind_libraries) do -- Record the get descriptor with others obj.libname = obj.libname or obj.name -- or obj.infos.libname if (type(obj) == "table") and (type(obj.infos) == "table") and (type(obj.infos.libname) == "string") then obj.libname = obj.infos.libname table.insert(libname_libraries, obj) end end table.sort(libname_libraries, function (a, b) return ( a["libname"] < b["libname"] ) end ) versions.sorted_bind_libraries = libname_libraries versions.sorted_bind_libraries_t = viewers.ta("\n* #versions.sorted_bind_libraries", lua_table.level_count(versions.sorted_bind_libraries) ) local title, description = "", "" local object, library, get = {}, {}, {}, {}, {} for i, object in ipairs(libname_libraries) do -- Record the get descriptor with others -- object = package.loaded[name] if (type(object) == "table") and (type(object.i18n) == "table") then library = object title = library["libname"] get = versions.get_one_module_or_library(title, library) -- Get a module or a library, then form and record its descriptor. library.description = library["describ_version"] end end -- Check and sort new libraries by name local sorted_libraries = {} local central_libraries = {} for libname, lib in pairs(package.loaded) do lib.libname = libname lib.infos = lib.infos or {} lib.infos.libname = lib.libname table.insert( sorted_libraries, { lib } ) if (type(lib) == "table") and (type(lib.i18n) == "table") and (type(libname) == "string") then table.insert( central_libraries, { lib } ) end end table.sort(sorted_libraries, function (a, b) return (a.libname or "m") < (b.libname or "m") end ) -- alphabetic sort of objects keys versions.central_libraries = central_libraries local t = "\n* setup_central_libraries : " for i, lib in pairs(central_libraries) do t = t .. viewers.ta( tostring(i), tostring(lib.libname) ) end versions.sorted_libraries_list = t versions.sorted_libraries = sorted_libraries end -- function versions.setup_central_libraries(bindable_libraries, opt)
-- - - - ------------------ - - - - ------------------ - - - - ----------------------------- -- Guideline for modules, arguments, options and default values 20180908. -- In all cases the main module protects all original tables, including for itself. -- Permit modules without versions for many existing modules. Modules are also simply tables for data-modules or PageData in Json. -- 3 central functions bind sub-modules, translations and arguments in 3 new tables. -- All arguments can have options and default values, like "prop_default" for "prop" to use it in case of tests or missing value. -- Arguments and there options come from submodules and the main module changes them. -- TODO : They have default values, like "prop_default" for "prop" to use it in case of tests or missing value. -- TODO : arguments can come from any submodules, in any order. The main module must redefine them for any cases.
-- function versions.bind_arguments(main_versions, loaded_pack) -- The main module must redefine arguments for any cases.TODO 20180908 function versions.bind_arguments(main_versions, loaded_pack) -- Binds arguments with the main version and loaded_pack local main_versions = main_versions or versions.main_versions local t = t -- t or if (type(t) ~= "string") then t = '\n* versions.bind_arguments(main_versions, loaded_pack) : Binds arguments with the main version and loaded_pack' end local loaded_pack = loaded_pack or versions.loaded_modules_track() local args_known = args_known or modes.args_known or p.args_known or {} local args_changes = {} for i, get in pairs(loaded_pack) do -- for all known sub-modules if (type(get.is_table) == "table") then -- For all types of modules for one_arg, args in pairs(args_known) do -- for all arguments in one module for i, get in pairs(one_arg) do -- for all properties of an argument one_arg.module = one_arg.module or "no module" one_arg.arg = one_arg.arg or "no arg" one_arg.change = one_arg.change or "no change" one_arg.results = one_arg.results or "no results" one_arg.errors = one_arg.errors or "no errors" -- if (type(one_arg) == "table") then table.insert(args_changes, one_arg) end -- return { case.module, case.arg, case.change, case.results, case.errors } -- example of case to view -- ["birthyear"] = { ["typ"] = "dat", ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", }, in Centralizer end table.insert(args_changes, one_arg) end end end versions.args_changes = args_changes -- argschanges Library:modes Group return args_changes, t -- argschanges Library:modes Group end -- t = t .. versions.bind_arguments(main_versions, loaded_pack)
function versions.bind_arguments_tests(t, loaded_pack) -- Tests the binding of arguments with the main version and loaded_pack local memo = viewers.save_configs("versions.bind_arguments_tests") -- Save global configuration before eventual changes. -- The test case is a module with sub_modules and libraries, which can have arguments. -- Central has 1 sub-module and 10 libraries : -- All these need structured with stable [ args, sub-modes , i18n ] -- Central : with args + 1 sub-modes + libraries with args -- math_roman : with args + tests cases and authority bases -- datas : with args = props + tests cases local t = t -- t or if (type(t) ~= "string") then t = '\n* versions.bind_arguments_tests(t, loaded_pack) : Tests the binding of arguments with the main version and loaded_pack' end local result_cases = result_cases or versions.args_changes or {} local tests_cases = { ["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", }, ["firstname"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "firstname", ["prop"] = "P735", }, } local tab_view = { -- Group datas and options for a table view with lines and columns. title_memo = "versions.bind_arguments_tests(t, loaded_pack) -- Tests the binding of arguments with the main version and loaded_pack", test_group = tests_cases, tests_title = "versions.bind_arguments() Tests of redefine arguments for any cases. **", headers = "module; arg; change; results; errors", -- "OK or error/s" form_one_case = function(case) -- Convert a case from test_group to rowGroup. return { case.arg, case.module, case.change, case.results, case.errors or "", } end, headers_class = "wikitable alternative center sortable", rowGroup = {}, -- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function( } -- Runs tests cases and formats a table view with lines and columns.s t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns. viewers.restore_configs(memo, "versions.bind_arguments_tests") -- Restore global configurations after eventual changes. return t end -- t = t .. versions.bind_arguments_tests(t, loaded_pack)
function versions.bind_reverse_i18n_translations(main_versions, loaded_pack) -- Bind all i18n translations from libraries, modules, sub-modules and their /I18N translations sub-modules. -- Bind all translations in the exact reverse order of sub-modules binding. Then upper modules can adapt translations. local main_versions = main_versions or versions.main_versions local t = "\n* versions.bind_reverse_i18n_translations()" for i, get in pairs(versions.loaded_modules_and_libraries) do if (type(get.title) == "string") and (type(get.module) == "table") then versions.add_one_i18n("", get.title, get.module) -- Add with previews an i18n translations table t = t .. "\n*" .. viewers.ta("title", get.title) t = t .. viewers.ta("#i18n", lua_table.level_count(get.i18n) ) end -- Bind i18n sub-modules, for each its internal i18n then its /I18N sub-module. if (type(get.subI18N) == "string") and (type(get.module) == "table") then versions.add_one_i18n("", get.subI18N, get.module) -- Add with previews an i18n translations table t = t .. viewers.ta("#i18n", lua_table.level_count(get.i18n) ) end end return t end -- t = versions.bind_reverse_i18n_translations(main_versions, loaded_pack)
function versions.tab_elem_report(tab, key) -- simple text report of versions elements local mode = mode or 1 local t = "" if (type(tab) == "table") and (type(key) == "number") then for i, elem in ipairs(tab) do t = t .. "\n* " .. viewers.ta("i", i) .. viewers.ta("title", elem.title) t = t .. viewers.ta("versionName", elem.versionName) .. viewers.ta("versionNumber", elem.versionNumber) t = t .. viewers.ta("versionDate", elem.versionDate) .. viewers.ta("i18n_varstabs", elem.i18n_varstabs) end end if (type(tab) == "table") and (type(key) == "string") then for k, elem in pairs(tab) do if not tonumber(key) then t = t .. "\n* " .. viewers.ta(key, k) t = t .. viewers.ta("versionName", elem.versionName) .. viewers.ta("versionNumber", elem.versionNumber) t = t .. viewers.ta("versionDate", elem.versionDate) .. viewers.ta("i18n_varstabs", elem.i18n_varstabs) end end end return t end -- function versions.tab_elem_report(tab, key)
versions.deprecated_functionGroup = versions.deprecated_functionGroup or {} function versions.deprecated_function(old, new, kind, use, main_version) -- Deprecated function. Replace it in the module. local res = "" if type(langs.user_lang) == "string" then res = events.add_err("versions_add_deprecated_err", old, new, Central.version.versionName) events.add_cat("modes_no_source_arguments_cat") end versions.deprecated_functionGroup = versions.deprecated_functionGroup or {} versions.deprecated_functionGroup[old] = { ["old"] = old, ["new"] = new, ["kind"] = (kind or "kind"), ["use"] = "run", ["central_version"] = Central.version.versionName, } return res end -- versions.deprecated_function("old", "versions.deprecated_function", "kind", "code", Central.version.versionName) -- Deprecated function. Replace it in the module.
function versions.sort_central_modules_report(t) -- Reports the list of central modules and libraries, and there number of contributions to the translations table.
local memo = viewers.save_configs("versions.sort_central_modules_report") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* versions.sort_central_modules_report(t) : Reports the list of central modules and libraries, and there number of contributions to the translations table' end
local loaded_sorted = {}
for key, elem in pairs(versions.loaded_modules_and_libraries) do
if elem.hasi18n and elem.is_library then table.insert(loaded_sorted, elem) end
if elem.hasi18n and elem.is_module then table.insert(loaded_sorted, elem) end
-- if versions.loaded_modules_and_libraries[elem.subI18N] then elem.has_I18N = true end
end
-- loaded_modules_and_libraries
local loaded_pack, loaded_txt, modu = versions.loaded_modules_and_libraries
versions.loaded_modules_track = "\n* versions.loaded_modules_track : " .. viewers.ta("#versions.loaded_modules_and_libraries", lua_table.level_count(versions.loaded_modules_and_libraries) )
t = t .. versions.loaded_modules_track
table.sort(versions.loaded_modules_and_libraries, function (a, b) return ( a.pagename < b.pagename ) end )
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "versions.sort_central_modules_report(t) -- Reports the list of central modules and libraries, and there number of contributions to the translations table",
test_group = versions.loaded_modules_and_libraries, -- versions.loaded_modules_and_libraries,
headers = "versions_sort_central_modules_headers", -- "Title; Version; Date; Translations / Languages",
form_elem_detail = "versions_sort_central_modules_counts", -- "this + %2/%3 T/L, "
form_one_case = function(get) -- Convert a case from test_group to rowGroup.
local subI18N = ""
get.counts = get.counts or "get.counts"
if get.i18n then -- get.i18n
local vers18 = get.versionName --; if not get.isI18N then vers18 = "" end
if get.is_module then get.pagename = "Module:" .. get.versionName end -- Locate translations example in Module:Centralizer/I18N
if get.is_library then get.pagename = "Library:" .. get.versionName end -- Locate translations example in Module:Library/versioning/I18N
local tabname = get.i18nRoot .. ".i18n"
local t, strings_c, tables_c, strs_on_tabs, subnames = langs.i18n_sub_counts(tabname, "versions_sort_central_modules_counts", "user")
get.counts = viewers.form9user("this: + %1/%2 T/L, ", strings_c, tables_c)
-- get.counts = get.counts .. viewers.form9user("versions_sort_central_modules_counts", strings_c, tables_c)
if get.has_I18N then get.counts = get.counts .. "
+ i18n in: " .. get.viewI18N .. "" end -- version_I18N
return { get.viewI18N, get.shortVersion, get.versionDate, get.counts } -- get.pagename,
-- "Title; Version; Date; Translations / Languages",
end
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "versions.sort_central_modules_report") -- Restore global configurations after eventual changes.
return t
end -- function versions.sort_central_modules_report(t)
-- function versions.init(frame, mode_name, args_known, options_for_modes, QITEM) function versions.init(frame, Central_version, mode_name, args_known, options_for_modes, QITEM) -- Initializes translations, bind_libraries, bind_sub_modules, get arguments, modes, options. -- Imports arguments from wikidata, module and template with increasing priorities. local res, t = "", "" versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n. langs.main_i18n_complete = false -- Mask any views to avoid failures until enough init. Central_version = Central_version or langs.Module_Central_version -- or p.Module_Central_version versions.setup_central_libraries(versions.bindable_libraries) -- Actual installation of central bindable libraries in package.loaded versions.bind_all_sub_modules() -- Bind all sub-modules of the main module. res = res .. modes.init_modes_translate_events(frame, Central_version, mode_name, args_known, options_for_modes, QITEM) if type(langs) == "table" then langs.main_i18n = langs.main_i18n or versions.main_i18n or {} end -- Same pointers insure later same contents. -- Bind all i18n translations from libraries, modules and their /I18N translations sub-modules local loaded_pack = versions.loaded_modules_and_libraries versions.bind_reverse_i18n_translations(main_versions, loaded_pack) -- Bind all i18n translations from modules and their /I18N translations sub-modules -- ARGS = tracker.initadd({ ["name"] = "ARGS", limit = 2, }) -- Initialize a track and its track lines. -- ARGS.add(ARGS, 1, "versions.init before import_arguments") -- ARGS.t -- res = res .. langs.init_content_page_user_lang() -- content_lang, page_lang, user_lang, "versions.init") local mix = modes.init_args_mode_options(mix, mode_name, args_template) -- Import and mix args mode and options -- S170710mix -- ["QITEM"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", }, local args_known = args_known or modes.args_known or p.args_known or {} 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.prop_default = one_arg.default_item end -- "Q34743" -- Rudyard Kipling ** end end local mix = mix or {} modes.mix = mix -- To easy get, track and test the init_args_mode_options process local mix = modes.init_args_mode_options(mix, mode_name, args_template) -- S170703amo MAMO.t -- res = res .. langs.init_content_page_user_lang() -- content_lang, page_lang, user_lang, "versions.init") langs.main_i18n_complete = true -- Unmask all views after enough init. res = res .. versions.detect_MediaWiki_changes() return res end -- res = res .. versions.init(frame, Central_version, mode_name, args_known, options_for_modes, QITEM)
function versions.versions_support_test(t) -- Tests various combinations of modules and sub modules
local memo = viewers.save_configs("versions.versions_support_test") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* versions.versions_support_test(t) : Tests various combinations of modules and sub modules' end
t = t .. "\n* The selector = Box3, Group, Item1 means: check these modules versions among those available."
local loaded_tests = { -- loaded_tests
-- Cases to look for the main module
{ ["key"] = "Box", ["versionName"] = "Box", ["versionDate"] = "2015-12-02 02:02",
["request"] = "normal modules", ["comment"] = 'normal module for Box, with alias like : local Box = require("Box")
',
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box", ["known"] = "Box", ["loaded_list"] = ";Box;", }, },
--
{ ["key"] = "Box/I18N", ["versionName"] = "Box", ["versionDate"] = "2016-05-07 18:36",
["request"] = "normal with /I18N", ["comment"] = "I18N translations for Box",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box", ["known"] = "Box", ["loaded_list"] = ";Box;Box/I18N;", }, },
--
{ ["key"] = "Box3", ["versionName"] = "Box2", ["versionDate"] = "2016-05-07 11:11",
["request"] = "normal replace known alternate", ["comment"] = "alternate version module for Box",
["i18n"] = { ["en"] = { ["a"] = "a" } , ["sought"] = "Box2", ["known"] = "Box;Box2", ["loaded_list"] = ";Box;Box/I18N;Box2;Box2/I18N;", }, },
--
{ ["key"] = "Box2/I18N", ["versionName"] = "Box2", ["versionDate"] = "2016-05-07 19:19",
["request"] = "missing actual module", ["comment"] = "I18N translations without basic module. Formats an alert.",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box", ["known"] = "Box2;Box3", ["loaded_list"] = ";Box3;Box3/I18N;Box2;Box2/I18N;", }, },
-- Cases to look for sub-modules
{ ["key"] = "Group", ["versionName"] = "Box", ["I18N"] = "Group/I18N", ["versionDate"] = "2016-05-07 11:11",
["request"] = "normal sub-module", ["comment"] = "normal module for Group",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Group", ["known"] = "Group", ["loaded_list"] = ";Group;Group/I18N;", }, },
--
{ ["key"] = "Group4", ["versionName"] = "Box", ["versionDate"] = "2015-12-11 11:11",
["request"] = "unknown sought version", ["comment"] = "Mask this to test missing sought version",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box;Group", ["known"] = "Box", ["loaded_list"] = ";Box;", }, },
--
{ ["key"] = "Group/I18N", ["versionName"] = "Box", ["versionDate"] = "2016-05-07 22:2",
["request"] = "sub-module not exists", ["comment"] = "I18N translations for the normal module Group",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box;Group", ["known"] = "Box * Group", ["loaded_list"] = ";Box;", }, },
-- Cases to look for /I18N sub-modules
{ ["key"] = "Group2", ["versionName"] = "Box3", ["versionDate"] = "2016-05-07 05:05",
["request"] = "normal sub-module with normal /18N", ["comment"] = "normal alternate sub-module Group for Group2",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box;Group2", ["known"] = "Box;Box2 * Group;Group2", ["loaded_list"] = ";Group;Group/I18N;Group2;Group2/I18N;Box;Box/I18N;Box2;Box2/I18N;", }, },
--
{ ["key"] = "Group2", ["versionName"] = "Box3", ["versionDate"] = "2016-05-07 05:05",
["request"] = "unknown module for /18N sub-module", ["comment"] = "normal alternate sub-module Group for Group2",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box;Group2", ["known"] = "Box;Box2 * Group;Group2", ["loaded_list"] = ";Group;Group/I18N;Group2;Group2/I18N;Box;Box/I18N;Box2;Box2/I18N;", }, },
--
{ ["key"] = "Group2", ["versionName"] = "Box3", ["versionDate"] = "2016-05-07 05:05",
["request"] = "missing module Box for /18N sub-module", ["comment"] = "normal alternate sub-module Group for Group2",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Box;Group2", ["known"] = "Box;Box2 * Group;Group2", ["loaded_list"] = ";Group;Group/I18N;Group2;Group2/I18N;Box/I18N;Box2;Box2/I18N;", }, },
--
{ ["key"] = "Jocker", ["versionName"] = "Jocker", ["versionDate"] = "2015-12-21 11:33",
["request"] = "not central module, without i18n", ["comment"] = "Any module can have no i18n table.",
["sought"] = "Box", ["known"] = "Box", ["loaded_list"] = ";Box;", },
--
{ ["key"] = "Jocker", ["versionName"] = "Jocker", ["versionDate"] = "2015-12-21 11:33",
["request"] = "unknown and not sought actual module", ["comment"] = "Any module can be outside of the central system.",
["i18n"] = { ["en"] = { ["a"] = "a" }, ["sought"] = "Jocker.2", ["known"] = "Jocker.2", ["loaded_list"] = ";Box;", }, },
}
t = t .. "\n* loaded_vers : Table of all loaded modules, or simulation."
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "versions.versions_support_test(t) -- Tests various combinations of modules and sub modules",
test_group = loaded_tests,
headers = "versions_versions_management_headers", -- "sought; versions; process; comments",
form_one_case = function(vers_test) -- Convert a case from test_group to rowGroup.
local vers = vers_test
local x, vers_err = versions.versions_management_report(vers) -- Detect versions management errors and warnings after bind_sub_modules
vers.sought = viewers.simple_list(vers.sought)
local vers_sought = ";" .. string.gsub( (vers.sought or "-s-"), ";", ",
" ) .. ";" -- names in column
local vers_used = viewers.simple_list(vers.sub_used)
vers_used = ";" ..string.gsub( (vers_used or "-u-"), ";", ",
" ) .. ";" -- names in column
local vers_known = ";" .. string.gsub( (vers.known or ""), ";", "; " ) .. ";" -- add spaces
local vers_loaded_list = ";" .. (vers.versionName or "versionName") .. ";"
.. (vers.sought or "sought") .. ";" .. (vers.known or "known") .. ";"
vers_loaded_list = vers.loaded_list or vers_loaded_list or "empty loaded list"
vers_loaded_list = viewers.simple_list(vers_loaded_list)
vers_loaded_list = ";" .. string.gsub(vers_loaded_list, ";", "; " ) .. ";" -- add spaces
local vers_results = "" .. (vers.request or "vers.request") .. ""
.. "
sought: " .. (vers.sought or "") .. " in the main module: " .. vers.versionName .. ""
.. "
" .. (vers_err or "")
.. "
known: " .. (vers_known or "")
.. "
loaded list: " .. vers_loaded_list
-- .. "
comment: " .. (vers.comment or "")
local case = { vers_sought, vers_used, vers_results, vers.comment }
return case
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "\n* " .. viewers.ta("Number of versions simulated:", lua_table.level_count(loaded_tests) )
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "versions.versions_support_test") -- Restore global configurations after eventual changes.
return t
end -- function versions.versions_support_test(t)
function versions.versions_management_report(versions) -- Detect versions management errors and warnings after bind_sub_modules
-- Todo : Use colors to easier look at errors on sough/known in versions_management_report()
local memo = viewers.save_configs("versions.versions_management_report") -- Save global configuration before eventual changes.
local t = "\n* versions.versions_management_report(): Versions management details: "
local versions, errs, cats = versions, "", ""
t = t .. "\n* To debug later to_debug_on_20170531 Rical "
if 1 then
viewers.restore_configs(memo, "versions.versions_management_report") -- Restore global configurations after eventual changes.
return t
end
if type(versions) ~= "table" then versions = versions.main_versions end
local sought_report = viewers.simple_list(versions.sought)
local known_report = viewers.simple_list(versions.known)
local loaded_report = viewers.simple_list(versions.loaded_list)
local used_report = viewers.simple_list(versions.sub_used)
local all_once_sort = viewers.simple_list(sought_report .. ";" .. known_report .. ";" .. used_report) -- .. ";" .. loaded_report)
local missing_report = ""
local replaced_report = ""
local unknown_report = ""
local all_once_tab = mw.text.split(all_once_sort, ';') -- table of words
for i, name in ipairs(all_once_tab) do -- list all used names, only one each, in alphabetic order
local name_I18N = string.find(name, "/I18N")
-- List erroneous versions which are sought but not found:
if viewers.is_in_sp(name, sought_report, ";") and not viewers.is_in_sp(name, known_report, ";") and not name_I18N then
missing_report = missing_report .. name .. ";"
errs = errs .. ";" .. events.add_err("versions_missing_versions_err", name, versions.versionName ) .. ";"
local main_report_Example = "Central-proj-fr.wikisource.org" -- red error display to_debug_on_20170529 Rical
local sought_report_Example = "Central-s-fr;Mathroman2;TestRequire" -- red error display to_debug_on_20170529 Rical
local known_report_Example = "Central-s-fr;Central-14 * Mathroman2;Mathroman34 * TestRequire;TestRequ * TestBug;TestBug4"
cats = cats .. events.add_cat("versions_with_usage_error_cat") -- "Module with usage error"
end
-- List warning versions which are missing and replaced by normal:
if viewers.is_in_sp(name, used_report, ";") and not viewers.is_in_sp(name, sought_report, ";") and not name_I18N then
replaced_report = replaced_report .. name .. ";"
errs = errs .. ";" .. events.add_err("versions_replaced_versions_err", name, versions.versionName ) .. ";"
cats = cats .. events.add_cat("versions_with_usage_error_cat")
end
if viewers.is_in_sp(name, all_once_sort, ";") and not viewers.is_in_sp(name, known_report, ";") and not name_I18N then
unknown_report = unknown_report .. name .. ";" -- found but not known
errs = errs .. ";" .. events.add_err("versions_unknownversions_err", name, versions.versionName ) .. ";"
cats = cats .. events.add_cat("versions_with_usage_error_cat")
end
end
local loaded_report = viewers.simple_list(loaded_report)
local used_report = viewers.simple_list(used_report)
local missing_report = viewers.simple_list(missing_report)
local replaced_report = viewers.simple_list(replaced_report)
local unknown_report = viewers.simple_list(unknown_report)
t = t .. "
" .. viewers.ta("sought_report", sought_report)
t = t .. "
" .. viewers.ta("known_report", known_report)
t = t .. "
To understand:"
t = t .. "
" .. viewers.ta("loaded_report", loaded_report)
t = t .. "
" .. viewers.ta("used_report", used_report)
t = t .. "
" .. viewers.ta("missing_report", missing_report)
t = t .. "
" .. viewers.ta("replaced_report", replaced_report)
t = t .. "
" .. viewers.ta("unknown_report", unknown_report)
viewers.restore_configs(memo, "versions.versions_management_report") -- Restore global configurations after eventual changes.
return t, errs
end -- function versions.versions_management_report(versions)
function versions.sort_and_list_objects(obj_to_list) -- List all objects in _G global space and in package.loaded local t = t -- t or if type(t) ~= "string" then t = '\n* versions.sort_and_list_objects(obj_to_list) : List all objects in _G global space and in package.loaded' end if (type(obj_to_list) ~= "table") then return t end sort_key = {} local sorted_objects = {} for key, obj in pairs(obj_to_list) do table.insert( sorted_objects, { ["key"] = tostring(key), ["obj"] = obj } ) end if lua_table.level_count(sorted_objects) > 0 then table.sort(sorted_objects, function (a, b) return (a.key < b.key) end ) -- alphabetic sort of objects keys for i, elem in pairs(sorted_objects) do local title = elem.key -- obj_to_list[key] local obj = elem.obj -- obj_to_list[key] -- viewers.styles_colors = "add delete discreet error invoke normal warning wikidata" -- viewers.styles_formats = "big bold small up" local o = versions.get_one_module_or_library(obj, obj) -- (objt, title) Get checked values and types of central objects if o.is_table and (type(obj.add) == "function") then t = t .. viewers.styles(title, "discreet") -- function tracker.initadd() styles elseif o.is_string then t = t .. viewers.styles(title, "normal") -- "value from MediaWiki" elseif o.is_function then t = t .. viewers.styles(title, "error") -- "MediaWiki library" elseif o.hasi18n then t = t .. viewers.styles(title, "add bold") -- "central module or library" elseif o.is_table then t = t .. viewers.styles(title, "add") -- "MediaWiki library" else t = t .. "[ " .. tostring(title) .. " ] " end -- others t = t .. ", " end end t = t .. "\n* Styles for objects types: " ..viewers.styles("central library", "add bold")..", " t = t .. viewers.styles("library", "add")..", " ..viewers.styles("function", "error")..", " ..viewers.styles("track", "discreet")..", " t = t .. "[ others ], " .. viewers.ta("objects number", lua_table.level_count(sort_key) ) return t end -- function versions.versions_management_report(versions)
function versions.all_G_and_loaded_list(t) -- Lists all objects in _G global space and in package.loaded
local memo = viewers.save_configs("versions.all_G_and_loaded_list") -- Save global configuration before eventual changes.
local t = t -- t or
if (type(t) ~= "string") then t = '\n* versions.all_G_and_loaded_list(t) : Lists all objects in _G global space and in package.loaded' end
local function sort_and_list_objects(obj_to_list)
local t, listobjs, sorted_objects = "", "", {}
if (type(obj_to_list) ~= "table") then return " * NO TABLE OF OBJECTS * ", t end
for key, obj in pairs(obj_to_list) do table.insert( sorted_objects, { ["key"] = tostring(key), ["obj"] = obj } ) end
if lua_table.level_count(sorted_objects) > 0 then
table.sort(sorted_objects, function (a, b) return (a.key < b.key) end ) -- alphabetic sort of objects keys
for i, elem in pairs(sorted_objects) do
local title = elem.key -- obj_to_list[key]
local obj = elem.obj -- obj_to_list[key]
-- viewers.styles_colors = "add delete discreet error invoke normal warning wikidata"
-- viewers.styles_formats = "big bold small up"
local o = versions.get_one_module_or_library(obj, obj) -- (objt, title) Get checked values and types of central objects
if o.is_table and (type(obj.add) == "function") then t = t .. viewers.styles(title, "discreet") -- function tracker.initadd() styles
elseif o.is_string then t = t .. viewers.styles(title, "normal") -- "value from MediaWiki"
elseif o.is_function then t = t .. viewers.styles(title, "error") -- "MediaWiki library"
elseif o.hasi18n then t = t .. viewers.styles(title, "add bold") -- "central module or library"
elseif o.is_table then t = t .. viewers.styles(title, "add") -- "MediaWiki library"
else t = t .. "[ " .. tostring(title) .. " ] " end -- others
t = t .. ", "
end
else return " * EMPTY TABLE OF OBJECTS * " end
t = t .. "\n* Styles for objects types: " ..viewers.styles("central library", "add bold")..", "
t = t .. viewers.styles("library", "add")..", " ..viewers.styles("function", "error")..", " ..viewers.styles("track", "discreet")..", "
t = t .. "[ others ], " .. viewers.ta("objects number", lua_table.level_count(sorted_objects) )
end
t = t .. sort_and_list_objects(_G)
t = t .. "\n* Objects in _G global space: " .. listobjs .. "
" .. tx
t = t .. sort_and_list_objects(package.loaded)
t = t .. "\n* Objects in package.loaded: " .. listobjs .. "
" .. tx
viewers.restore_configs(memo, "versions.all_G_and_loaded_list") -- Restore global configurations after eventual changes.
return t
end -- function versions.all_G_and_loaded_list(t)
function versions.central_library(objt, title) -- Get checked values and types of central objects local o = {} local i18n = langs.main_i18n or versions.main_i18n or versions.memo_i18n o.val = objt if (title == objt) then -- Look at the object without any change else -- try to require() the object if type(o.title) ~= "string" then local frame = mw.getCurrentFrame() o.title = frame:getTitle() -- get the main module name end end o.is_nil = (o.type == "nil") o.type = type(o.val) o.is_number = (type(o.val) == "number") if o.is_number then o.number = o.val ; return o else o.number = nil end -- o.number = o.is_string = (type(o.val) == "string") if o.is_string then o.table = o.val ; return o else o.table = nil end -- o.string = o.is_table = (type(o.val) == "table") if o.is_table then o.table = o.val o.title = o.table.libname or o.table.name -- like Module:Author, or the versioning library o.ModuleNS = mw.site.namespaces.Module.name .. ":" else o.table = nil end -- o.table = -- Module or Library if (type(o.title) == "string") then o.title = string.find( o.title, versions.ModuleNS, 1, true) end if o.table and not o.title and (type(o.table.infos) == "table") then o.title = o.table.libname or o.table.name or o.table.infos.libname or o.table.infos.name -- i18n langs end o.is_function = (type(o.val) == "function") if o.title then if o.is_function then o.func = o.val ; return o else o.func = nil end -- o.function = o.is_module = o.is_table and (1 == string.find( o.title, versions.ModuleNS, 1, true) ) -- true if the object is a library if o.is_module then o.module = o.val else o.module = nil end -- o.module = o.is_loaded = o.val and ( o.val == package.loaded[o.title] ) o.is_G = o.val and ( o.val == _G[o.title] ) o.is_library = o.is_table and not (string.find( o.title, versions.ModuleNS, 1, true) ) -- true if the object is a library if o.is_library then o.library = o.val else o.library = nil end o.hasi18n = o.is_table and (type(o.val.i18n) == "table") -- i18n langs if o.hasi18n then o.i18n = o.val.i18n else o.i18n = nil end -- o.i18n = if o.is_library and o.hasi18n then o.is_central_library = true end -- o.i18n = o.isI18N = true and string.find( o.title, "/I18N") -- true if the title contains /I18N like Module:Author/I18N end return o end -- function versions.central_library(objt, title)
function versions.is_ISO_8601_time_format_like(time_in, form) -- Compute the delay from t1 to t2, or adjust t2 at t1 + diff. -- See ISO 8601 time format like : 1977-04-22T01:00:00-05:00 (5 heures de décalage) = 1977-04-22T06:00:00Z local time local nowtime = os.date("%Y-%m-%d %H:%M:%S") -- in ISO 8601 time format like : 1977-04-22T01:00:00 local nowtable = os.date("*t") or {} -- in ISO 8601 time format like : 1977-04-22T01:00:00 local nowclock_rest = os.clock(nowtable) or {} -- seconds from time 00:00 if nowtable.day then local nowclock = {} -- seconds from time 00:00 nowclock.second = math.floor(nowclock_rest / 60) ; nowclock_rest = nowclock_rest - (nowclock.second * 60) ; nowclock.minute = math.floor(nowclock_rest / 60) ; nowclock_rest = nowclock_rest - (nowclock.minute * 60) ; nowclock.hour = math.floor(nowclock_rest / 24) ; nowclock_rest = nowclock_rest - (nowclock.hour * 24) ; nowtable.hour = nowclock.hour ; nowtable.minute = nowclock.minute ; nowtable.second = nowclock.second ; -- if nowclock.minute < 10 then nowclock.minute = "0" .. nowclock.minute end -- if nowclock.hour < 10 then nowclock.hour = "0" .. nowclock.hour end if nowtable.day < 10 then nowtable.day = "0" .. nowtable.day end if nowtable.month < 10 then nowtable.month = "0" .. nowtable.month end if nowtable.year < 10 then nowtable.year = "0" .. nowtable.year end if nowtable.year < 100 then nowtable.year = "0" .. nowtable.year end if nowtable.year < 1000 then nowtable.year = "0" .. nowtable.year end nowtime = nowtable.year .."-"..nowtable.month .."-"..nowtable.day .."-"..nowtable.hour .."-"..nowtable.minute .."-"..nowtable.second end -- See: http://www.lua.org/manual/5.1/manual.html#pdf-os.date -- If format starts with '!', then the date is formatted in Coordinated Universal Time. After this optional character, if format is the string "*t", then date returns a table with the following fields: year (four digits), month (1--12), day (1--31), hour (0--23), min (0--59), sec (0--61), wday (weekday, Sunday is 1), yday (day of the year), and isdst (daylight saving flag, a boolean). local form = form or "1789-12-31T23:59:55-11:44" if (type(time_in) ~= "string") then time_in = nowtime end if not time_in then time_in = nowtime end local startime = "2017-05-14 00:00:00" local form = string.gsub(form, "44", string.sub(startime, 15, 16) ) -- shift_minute, 00 for UTC local form = string.gsub(form, "11", string.sub(startime, 15, 16) ) -- shift_hour, 00 for UTC local form = string.gsub(form, "55", string.sub(startime, 15, 16) ) -- second local form = string.gsub(form, "59", string.sub(startime, 15, 16) ) -- minute local form = string.gsub(form, "23", string.sub(startime, 12, 13) ) -- hour local form = string.gsub(form, "31", string.sub(startime, 9, 10) ) -- day local form = string.gsub(form, "12", string.sub(startime, 6, 7) ) -- month local time_out = string.gsub(form, "1789", string.sub(startime, 1, 4) ) -- year return time_out, nowtime end -- local time_out, nowtime = versions.is_ISO_8601_time_format_like(time, form)
-- { site = "fr.wikisource", verstime = "2019-08-22T14:22:26", versid = "1.34.0-wmf.19 (efab97f)", seen_time = "2019-08-23T07:50:00", }, function versions.MediaWiki_version() -- Formats MediaWiki_version, in error color if it changes. local currentVersion = tostring(mw.site.currentVersion) local vers, time, color, discreet, currentview = "0.0", "0000", "color", "discreet", "currentview" for k, vrs in pairs( versions.MediaWiki_Versions ) do if vrs.verstime > time then time = vrs.verstime vers = vrs.versid end end -- typical record: -- { site = "fr.wikisource", verstime = "2018-02-16T01:11:36", versid = "1.31.0-wmf.21 (828e6cc)", seen_time = "2018-02-18T05:17:00", }, color = viewers.styles_color_error(currentVersion) discreet = viewers.styles_color_discreet(currentVersion) currentview = currentVersion if currentVersion ~= versions.MediaWiki_version_memo then currentview = color end currentview = viewers.ta(" Local MediaWiki version ", currentview .. " time=" .. time) versions.MediaWiki_version_memo = vers versions.MediaWiki_version_time = time versions.MediaWiki_version_color = color versions.MediaWiki_version_discreet = discreet versions.MediaWiki_version_currentview = currentview return currentview end -- function versions.MediaWiki_version()
p.infos = { -- Basis of the descrition of the main and the subs versions, from 20171224 infos p.["infos"]["versions"]["libname"] ['versionFrom'] = "MdCentral function modes.levenshtein_similar_tests == OK OK.lua", ['versionName'] = "Centralizer", ['versionNumber'] = "1.0.0(2019-08-31T08:20)", ['versionDate'] = "2019-08-31T08:20", -- UTC version structure MWMW 2019-03-02T09:28:00 }
function versions.wiki_modules_users_stat() -- Modules, users and stats in this wiki.
local mwuri = mw.uri.new()
local t = ""
-- Main module version
t = t .. "\n*. Modules: "
t = t .. viewers.ta("Main module", tostring(versions.mainversion) )
local VersCentral = p.infos -- Basis of the descrition of one version of the main module
-- Basis of the descrition of the main and the subs versions, from 20191230 infos p.["infos"]["versions"]["libname"]
t = t .. viewers.ta("Modules in this wiki", tostring(mw.site.stats.pagesInNamespace( 828 ) ) )
-- Central module version
t = t .. "\n*. Central module version: " --
t = t .. viewers.ta("versionName", tostring(VersCentral.versionName) )
t = t .. viewers.ta("versionNumber", tostring(VersCentral.versionNumber) )
t = t .. viewers.ta("versionDate", tostring(VersCentral.versionDate) )
t = t .. viewers.ta("taskDescription", tostring(VersCentral.taskDescription) )
-- Users
t = t .. "
\n* Users activities: "
t = t .. viewers.ta("activeUsers", tostring(mw.site.stats.activeUsers ) )
t = t .. viewers.ta("Administrators(sysop)", tostring(mw.site.stats.usersInGroup( "sysop" ) ) )
t = t .. viewers.ta("bots(bot)", tostring(mw.site.stats.usersInGroup( "bot" ) ) )
t = t .. viewers.ta("patrollers(patroller)", tostring(mw.site.stats.usersInGroup( "patroller" ) ) )
t = t .. viewers.ta("bureaucrats(bureaucrat)", tostring(mw.site.stats.usersInGroup( "bureaucrat" ) ) )
t = t .. "\n* Statistics on users and content "
t = t .. " mw mw:Special:ListGroupRights " -- https://www.MediaWiki.org/wiki/Special:ListGroupRights
-- Wivivi : Where vikipedia is read in which language ? https://stats.wikimedia.org/wikimedia/animations/pageviews/wivivi.html
t = t .. "\n* Wivivi: In which language do you read Wikipedia? "
-- Last revision
t = t .. "
\n* Last revision: "
t = t .. viewers.ta("REVISIONTIMESTAMP", modes.frame:preprocess( "20240309154002" ) )
t = t .. viewers.ta("REVISIONUSER", modes.frame:preprocess( "Crochet.david.bot" ) )
-- Languages
t = t .. "
\n* Languages: "
t = t .. viewers.ta("PAGELANGUAGE", modes.frame:preprocess( "fr" ) )
-- t = t .. viewers.ta("PAGELANGUAGE", mw.getCurrentFrame():expandTemplate{ title = 'PAGELANGUAGE' } ) https://gerrit.wikimedia.org/r/#/c/189324/
t = t .. viewers.ta("CONTENTLANGUAGE", modes.frame:preprocess( "fr" ) )
--
t = t .. "\n* User language: "
-- T173207: Implement Lua alternative to ⧼Lang⧽.
t = t .. viewers.ta("⧼Lang⧽", "⧼Lang⧽" )
t = t .. viewers.ta("⧼es⧽", "⧼es⧽" )
-- https://fr.wikisource.org/w/index.php?title=MediaWiki:Lang/en&action=edit
-- https://vi.wikipedia.org/w/index.php?title=MediaWiki:Lang/en&action=edit
-- To support ⧼Lang⧽ for central modules. Equivalent to calling mw.getCurrentFrame():preprocess("⧼Lang⧽") in Lua.
t = t .. viewers.ta("⧼Lang⧽", modes.frame:preprocess( "⧼Lang⧽" ) )
t = t .. viewers.ta("USERLANG", modes.frame:preprocess( "Modèle:USERLANG" ) )
t = t .. viewers.ta("UILANGCODE", modes.frame:preprocess( "Modèle:UILANGCODE" ) )
t = t .. viewers.ta("USERLANG", modes.frame:preprocess( "Modèle:USERLANG" ) )
t = t .. viewers.ta("USERLANGUAGE", modes.frame:preprocess( "fr" ) )
t = t .. viewers.ta("USERIFCODE", modes.frame:preprocess( "Modèle:USERIFCODE" ) )
t = t .. "\n* Scribunto: "
t = t .. ", Extension:Scribunto "
t = t .. viewers.ta("Lua manual , version : ", _VERSION )
--
t = t .. "\n* Server mw.uri.new: "
t = t .. viewers.ta("protocol", mwuri.protocol )
t = t .. viewers.ta("user", mwuri.user )
t = t .. viewers.ta("password", mwuri.password )
t = t .. viewers.ta("main_title", modes.main_title )
t = t .. viewers.ta("label", mwuri.label )
-- local label = modes.args_known.label or modes.main_title or modes.args_known.QITEM or modes.args_known.itemid
t = t .. viewers.ta("text", mwuri.text )
t = t .. viewers.ta("host", mwuri.host )
t = t .. viewers.ta("port", mwuri.port )
t = t .. viewers.ta("path", mwuri.path )
t = t .. viewers.ta("query", mwuri.query )
t = t .. viewers.ta("fragment", mwuri.fragment )
t = t .. viewers.ta("userInfo", mwuri.userInfo )
t = t .. viewers.ta("hostPort", mwuri.hostPort )
t = t .. viewers.ta("authority", mwuri.authority )
t = t .. viewers.ta("queryString", mwuri.queryString )
t = t .. viewers.ta("relativePath", mwuri.relativePath )
-- t = t .. mwuri:parse( "uri:parse : user, ( userInfo ), host-Port = hostPort" )
return t
end -- function versions.wiki_modules_users_stat(t)
function versions.running_times(no_view, res, time1, time2, time3, time4) -- Formats running times and references for Lua-coders. -- Last update example: -- Execution time and page: 2017-04-27 10:01:50 UTC , url = https://fr.wikisource.org/wiki/Module:Centralizer-s-fr/Documentation -- Running times: , start in page = 171 mS , import + 0 mS , form result + 0 mS , tests + 522 mS , duration = 522 mS local res = "" -- res or "\n* versions.running_times() Modules, users and stats in this wiki" res = res .. "\n* " .. viewers.form9user("versions_running_times_title") .. "" -- "\n* versions.running_times() Temps d'exécution et références pour les Lua-codeurs." local mwuri = mw.uri.new() res = res .. "\n* " .. versions.MediaWiki_version() -- Modules, users and stats in this wiki. res = res .. "\n* " .. versions.wiki_modules_users_stat() -- Modules, users and stats in this wiki. modes.time4 = os.clock() if no_view then return default_res end local time4 = time4 or modes.time4 local time3 = time3 or modes.time3 or time4 local time2 = time2 or modes.time2 or time3 local time1 = time1 or modes.time1 or time2 if time2 < time1 then time2 = time1 end if time3 < time2 then time3 = time2 end if time4 < time3 then time4 = time3 end local nowtime = os.date("%Y-%m-%d %H:%M:%S") local mwtitle = mw.title.getCurrentTitle() local url = tostring(mwtitle:canonicalUrl( )) local time2d = time2 - time1 local time3d = time3 - time2 local time4d = time4 - time3 local duration = time2d + time3d + time4d time1 = tostring(math.floor( time1 * 1000 )) .. " mS" time2d = tostring(math.floor( time2d * 1000 )) .. " mS" time3d = tostring(math.floor( time3d * 1000 )) .. " mS" time4d = tostring(math.floor( time4d * 1000 )) .. " mS" duration = tostring(math.floor( duration * 1000 )) .. " mS" res = res .. "\n* Execution time and page: " .. nowtime .. " UTC, " .. viewers.ta("url", url) -- prefixedText res = res .. "\n* Running times: " res = res .. viewers.ta("start in page", time1) .. viewers.ta("import", time2d, "+") res = res .. viewers.ta("form result", time3d, "+") .. viewers.ta("tests", time4d, "+") .. viewers.ta("duration", duration) -- Inside the viewer drop_box.form(), a function in test or in report has a nil result return res end -- function versions.running_times(no_view, res, time1, time2, time3, time4)
function viewers.doc_page(selector, mask_sections) -- Formats some Dropboxes of tests to document a page. local res = "" if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_page", "h2", mask_sections) end res = res .. viewers.drop(selector, "datas.available_props_report(t) Reports availables datas properties **", datas.available_props_report) -- res = res .. viewers.drop(selector, "modes_args_known_report_title", modes.args_known_report) res = res .. viewers.drop(selector, "modes_used_options_list_title", modes.used_options_list ) res = res .. viewers.drop(selector, "modes_list_all_args_main_title", modes.list_all_args_main) -- res = res .. "\n------ " -- This code interact with drop_box and debug the bug T20151215 2016-11-13 17:57. -- res = res .. viewers.drop(selector, "langs_translations_counts_title", langs.translations_counts) -- S170618ltc res = res .. viewers.drop(selector, "luaTable_table_args_source_title", lua_table.structure, modes.args_source, "modes.args_source") res = res .. viewers.drop(selector, "modes_args_known_structure_title", modes.args_known_structure) return res end -- function viewers.doc_page(selector, mask_sections)
function viewers.doc_module(selector, mask_sections) -- Formats some Dropboxes of tests to document a module. local res = "" if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_module", "h2") end res = res .. viewers.drop(selector, "modes_args_unknown_report_title", modes.args_unknown_report) res = res .. viewers.drop(selector, "versions_support_desk_title", versions.form_support_desk_report) res = res .. viewers.drop(selector, "modes_options_uses_tests_title", modes.options_from_mode_tests) res = res .. viewers.drop(selector, "modes_all_categories_list_title", modes.all_categories_list) res = res .. viewers.drop(selector, "modes_all_errors_list_title", modes.all_errors_list) return res end -- function viewers.doc_module(selector, mask_sections)
function viewers.doc_internal(selector, mask_sections) -- Formats some Dropboxes of tests to document internal functions. local res = "" if not mask_sections then res = res .. viewers.doc_section(selector, "Library:activity", "h3") end res = res .. viewers.drop(selector, "activity_support_central_modules_title", activity.begin_central_modules_support) -- doc link res = res .. viewers.drop(selector, "langs_translations_stats_report_title", langs.translations_statistics_report) res = res .. viewers.drop(selector, "activity_phabricator_tasks_title", activity.phabricator_tasks_report) -- S170606act res = res .. viewers.drop(selector, "activity_report_subtasks_title", activity.central_subtasks_report) res = res .. viewers.drop(selector, "activity_MW_Versions_report_title", activity.MW_Versions_report) res = res .. viewers.drop(selector, "activity_central_functions_report_title", activity.central_functions_report) res = res .. viewers.drop(selector, "activity_check_html_bold_tags_title", activity.check_html_bold_tags) -- if 1 then return res end -- try to find :
- ARGS.t=, CNT.t=modes.mode_name = tests , modes.options = nil , (p.box_read)catview = Module with internal error Module with usage error
firstname: Galileo, sitelink: nil - Datas Labels in langs: Galileo.arp.300pix.jpg, user: nil, content: Galilée, page: Galilée description: physicien, philosophe et astronome italien ( 1564 - 1642 ) * used languages: user:⧼Lang⧽, content:fr, page:fr * - datas.default_item = Q307, datas.default_name = Q307
Remove all modes to return to read mode.
- Description of the Module:Centralizer version: versionName = Centralizer , versionNumber = 1.0.0(181227T22:44) , versionDate = 2018-12-27T22:44:00 ,
- The structure of the Module:Centralizer versionNumber is
yymmdd:hh:mm
. - Main module Description = Begin to use , function = first functional support , task = enough advanced to use in CentralSchool OK ,
- MediaWiki_version: Local MediaWiki version = 1.44.0-wmf.5 (d64f667) time=2018-12-20T17:20:46 ,
- This module can translate 270 sentences into 7 languages: 282-brezhoneg(br=Breton), 234-Deutsch(de=German), 282-English(en=English), 283-español(es=Spanish), 283-français(fr=French), 246-magyar(hu=Hungarian), 282-Tiếng Việt(vi=Vietnamese),
- Start versions from the main module: bind_verif_modules_report_start missing
- versions.versions_management_report(): Versions management details:
- To debug later to_debug_on_20170531 Rical
- versions.sort_central_modules_report() -- Sorted list of central modules and libraries.
- versions.loaded_modules_track : #versions.loaded_modules_and_libraries = 8 ,
Title | Version | Date | Translations / Languages |
---|---|---|---|
Centralizer | v240309 | 2024-03-09 15:39 | this: + %1/%2 T/L, ;219;5 |
activity | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;157;7 |
events | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;71;6 |
langs | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;301;7 |
lua_table | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;112;7 |
mathroman | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;119;7 |
modes | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;648;7 |
versions | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;303;7 |
- versions.running_times() Running times and references for Lua-coders.
- Local MediaWiki version = 1.44.0-wmf.5 (d64f667) time=2018-12-20T17:20:46 ,
- . Modules: Main module = Module:Centralizer , Proto version = Centralizer , Modules in this wiki = 380 ,
- . Central module version: versionName = Centralizer , versionNumber = 1.0.0(181227T22:44) , versionDate = 2018-12-27T22:44:00 , taskDescription = enough advanced to use in CentralSchool OK ,
- Users activities: activeUsers = 48 , Administrators(sysop) = 9 , bots(bot) = 9 , patrollers(patroller) = 72 , bureaucrats(bureaucrat) = 2 ,
- Statistics on users and content mw mw:Special:ListGroupRights
- Wivivi: In which language do you read Wikipedia?
- Last revision: REVISIONTIMESTAMP = 20240309154002 , REVISIONUSER = Crochet.david.bot ,
- Languages: PAGELANGUAGE = fr , CONTENTLANGUAGE = fr ,
- User language: ⧼Lang⧽ = ⧼Lang⧽ , ⧼es⧽ = ⧼es⧽ , {{int:Lang}} = ⧼Lang⧽ , USERLANG = Modèle:USERLANG , UILANGCODE = Modèle:UILANGCODE , USERLANG = Modèle:USERLANG , USERLANGUAGE = fr , USERIFCODE = Modèle:USERIFCODE ,
- Scribunto: , Extension:Scribunto Lua manual , version : = Lua 5.1 ,
- Server mw.uri.new: protocol = nil , user = nil , password = nil , main_title = nil , label = nil , text = nil , host = fr.wikiversity.org , port = nil , path = /wiki/Module:Multilingual , query = nil , fragment = nil , userInfo = nil , hostPort = fr.wikiversity.org , authority = fr.wikiversity.org , queryString = nil , relativePath = /wiki/Module:Multilingual ,
- Execution time and page: 2024-11-27 18:23:46 UTC, url = https://fr.wikiversity.org/wiki/Module:Multilingual ,
- Running times: start in page = 970 mS , import + 0 mS , form result + 0 mS , tests + 0 mS , duration = 0 mS ,
title = Q535 , QITEM = Q535 , itemid = Q535 , , (%1 properties);""
* Error: This unnamed argument is too many: 1 = tests.
* Error: parameter itemid is unknown in this template. Check the name or report this gap.
* Error: Do you need the known argument itemid ?
* Module with internal error
* Module with internal error
* Module with usage error This module can translate 270 sentences into 7 languages: 282-brezhoneg(br=Breton), 234-Deutsch(de=German), 282-English(en=English), 283-español(es=Spanish), 283-français(fr=French), 246-magyar(hu=Hungarian), 282-Tiếng Việt(vi=Vietnamese),
viewers_section_title_page
- birthyear = P569 , sitelink = sitelink , description = description , lastname = P734 , image = P18 , deathyear = P570 , labeluser = labeluser , labelpage = labelpage , args_known_monument = P18 , label = P735 , sex = P21 , firstname = P735 , label = label , QITEM = QITEM , args_known_country = P18 , args_known_town = P18 , country = P27 , args_known_flag = P18 , uri = uri , firstname = P735 , initial = P735 , personlang = P1412 , labelcontent = labelcontent , lastname = P734 , labelbylang = P18 ,
- Count of available datas properties: = 25 ,
key | val | type | need | keyword | syn | prop | format | source |
---|---|---|---|---|---|---|---|---|
QITEM | Q535 | dat | 0 | QITEM | 0 | QITEM | - | final |
args_known_country | Galileo.arp.300pix.jpg | dat | 0 | args_known_country | 0 | P18 | - | datas |
args_known_flag | Galileo.arp.300pix.jpg | dat | 0 | args_known_flag | 0 | P18 | - | datas |
args_known_monument | Galileo.arp.300pix.jpg | dat | 0 | args_known_monument | 0 | P18 | - | datas |
args_known_town | Galileo.arp.300pix.jpg | dat | 0 | args_known_town | 0 | P18 | - | datas |
birthyear | 1564 | dat | 0 | birthyear | 0 | P569 | year | datas |
c | - | config | 0 | c | 0 | - | - | known |
category | - | ctr | 0 | category | 0 | - | - | known |
contentlang | - | config | 0 | contentlang | 0 | - | - | known |
country | duché de Florence, grand-duché de Toscane | dat | 0 | country | 0 | P27 | - | datas |
deathyear | 1642 | dat | 0 | deathyear | 0 | P570 | year | datas |
debug | - | opt | 0 | debug | 0 | - | - | known |
description | physicien, philosophe et astronome italien | dat | 0 | description | 0 | description | - | datas |
docfunc | - | config | 0 | docfunc | 0 | - | - | known |
docitem | - | config | 0 | docitem | 0 | - | - | known |
dockey | - | config | 0 | dockey | 0 | - | - | known |
firstname | Galileo | dat | 0 | firstname | 0 | P735 | - | datas |
firstname2 | Galileo | dat | 0 | firstname | 2 | P735 | - | datas |
image | Galileo.arp.300pix.jpg | dat | 0 | image | 0 | P18 | - | datas |
initial | Galileo | dat | 0 | initial | 0 | P735 | - | datas |
itemid | Q535 | config | 0 | itemid | 0 | - | - | final |
knownversions | - | config | 0 | knownversions | 0 | - | - | known |
label | Galilée | dat | 0 | label | 0 | label | - | datas |
title | nil | dat | 0 | label | 2 | P735 | - | datas |
labelbylang | Galileo.arp.300pix.jpg | dat | 0 | labelbylang | 0 | P18 | - | datas |
labelcontent | Galilée | dat | 0 | labelcontent | 0 | labelcontent | - | datas |
labelpage | Galilée | dat | 0 | labelpage | 0 | labelpage | - | datas |
labeluser | nil | dat | 0 | labeluser | 0 | labeluser | - | datas |
lastname | Galilei | dat | 0 | lastname | 0 | P734 | - | datas |
lastname2 | Galilei | dat | 0 | lastname | 2 | P734 | - | datas |
mode | - | config | 0 | mode | 0 | - | - | known |
modules_guide | - | ctr | 0 | modules_guide | 0 | - | - | known |
options | - | config | 0 | options | 0 | - | - | known |
pagelang | - | config | 0 | pagelang | 0 | - | - | known |
personlang | latin, italien | dat | 0 | personlang | 0 | P1412 | - | datas |
region | - | dat | 0 | region | 0 | - | - | known |
rights | - | dat | 0 | rights | 0 | - | - | known |
sex | masculin | dat | 0 | sex | 0 | P21 | - | datas |
sitelink | nil | dat | 0 | sitelink | 0 | sitelink | - | datas |
soughtversions | - | config | 0 | soughtversions | 0 | - | - | known |
uri | nil | dat | 0 | uri | 0 | uri | - | datas |
userlang | - | config | 0 | userlang | 0 | - | - | known |
- Counts for all args_known{}.template = 0 , final = 2 , known = 42 , datas = 25 , source = 0 , import = 1 ,
- Track argmt.keyword = n : known = 1 , datas = 1 , known = 2 , datas = 2 , known = 3 , datas = 3 , known = 4 , datas = 4 , known = 5 , datas = 5 , known = 6 , known = 7 , known = 8 , datas = 6 , known = 9 , datas = 7 , known = 10 , known = 11 , datas = 8 , known = 12 , datas = 9 , known = 13 , known = 14 , known = 15 , datas = 10 , known = 16 , datas = 11 , known = 17 , known = 18 , datas = 12 , known = 19 , known = 20 , datas = 13 , known = 21 , datas = 14 , final = 1 , known = 22 , datas = 15 , known = 23 , known = 24 , known = 25 , datas = 16 , known = 26 , known = 27 , import = 1 , final = 2 , known = 28 , known = 29 , known = 30 , datas = 17 , known = 31 , datas = 18 , known = 32 , datas = 19 , known = 33 , datas = 20 , known = 34 , datas = 21 , known = 35 , known = 36 , datas = 22 , known = 37 , known = 38 , datas = 23 , known = 39 , known = 40 , known = 41 , datas = 24 , known = 42 , datas = 25 ,
- Final content of arguments{}.1 = nil , 2 = nil , 3 = nil , 4 = nil , 5 = nil , 6 = nil , 7 = nil , 8 = nil , 9 = nil , 10 = nil , 11 = nil , 12 = nil , 13 = nil , 14 = nil , 15 = nil , 16 = nil , 17 = nil , 18 = nil , 19 = nil , 20 = nil , 21 = nil , 22 = nil , 23 = nil , 24 = nil , 25 = nil , 26 = nil , 27 = nil , 28 = nil , 29 = nil , 30 = nil , 31 = nil , 32 = nil , 33 = nil , 34 = nil , 35 = nil , 36 = nil , 37 = nil , 38 = nil , 39 = nil , 40 = nil , 41 = nil , 42 = nil ,
- doc = nobox1 noerr nocatview ,
- read = box1 catview ,
- tests = box1 catview docdef docline docsrc docdata docview : tests ,
- edit = box1 catview docdef docline docsrc docdata docview : ,
, docdata , debug , tests , box1 , docmax , docdef , : , docmin , docview , noerr
* List of needed arguments:
* List of all other arguments:
* list_all_authorities
* List of all config arguments:
* List of all system arguments:
- 0;0;0
viewers_section_title_module
i | where | save |
---|---|---|
- | - | - |
- Description of the Module:Centralizer version: versionName = Centralizer , versionNumber = 1.0.0(181227T22:44) , versionDate = 2018-12-27T22:44:00 ,
- The structure of the Module:Centralizer versionNumber is
yymmdd:hh:mm
. - Main module Description = Begin to use , function = first functional support , task = enough advanced to use in CentralSchool OK ,
- MediaWiki_version: Local MediaWiki version = 1.44.0-wmf.5 (d64f667) time=2018-12-20T17:20:46 ,
- This module can translate 270 sentences into 7 languages: 282-brezhoneg(br=Breton), 234-Deutsch(de=German), 282-English(en=English), 283-español(es=Spanish), 283-français(fr=French), 246-magyar(hu=Hungarian), 282-Tiếng Việt(vi=Vietnamese),
- Start versions from the main module: bind_verif_modules_report_start missing
- versions.versions_management_report(): Versions management details:
- To debug later to_debug_on_20170531 Rical
- versions.sort_central_modules_report() -- Sorted list of central modules and libraries.
- versions.loaded_modules_track : #versions.loaded_modules_and_libraries = 8 ,
Title | Version | Date | Translations / Languages |
---|---|---|---|
activity | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;157;7 |
events | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;71;6 |
langs | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;301;7 |
lua_table | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;112;7 |
mathroman | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;119;7 |
modes | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;648;7 |
versions | v-27 18:23 | 2024-11-27 18:23 | this: + %1/%2 T/L, ;303;7 |
Centralizer | v240309 | 2024-03-09 15:39 | this: + %1/%2 T/L, ;219;5 |
- versions.running_times() Running times and references for Lua-coders.
- Local MediaWiki version = 1.44.0-wmf.5 (d64f667) time=2018-12-20T17:20:46 ,
- . Modules: Main module = Module:Centralizer , Proto version = Centralizer , Modules in this wiki = 380 ,
- . Central module version: versionName = Centralizer , versionNumber = 1.0.0(181227T22:44) , versionDate = 2018-12-27T22:44:00 , taskDescription = enough advanced to use in CentralSchool OK ,
- Users activities: activeUsers = 48 , Administrators(sysop) = 9 , bots(bot) = 9 , patrollers(patroller) = 72 , bureaucrats(bureaucrat) = 2 ,
- Statistics on users and content mw mw:Special:ListGroupRights
- Wivivi: In which language do you read Wikipedia?
- Last revision: REVISIONTIMESTAMP = 20240309154002 , REVISIONUSER = Crochet.david.bot ,
- Languages: PAGELANGUAGE = fr , CONTENTLANGUAGE = fr ,
- User language: ⧼Lang⧽ = ⧼Lang⧽ , ⧼es⧽ = ⧼es⧽ , {{int:Lang}} = ⧼Lang⧽ , USERLANG = Modèle:USERLANG , UILANGCODE = Modèle:UILANGCODE , USERLANG = Modèle:USERLANG , USERLANGUAGE = fr , USERIFCODE = Modèle:USERIFCODE ,
- Scribunto: , Extension:Scribunto Lua manual , version : = Lua 5.1 ,
- Server mw.uri.new: protocol = nil , user = nil , password = nil , main_title = nil , label = nil , text = nil , host = fr.wikiversity.org , port = nil , path = /wiki/Module:Multilingual , query = nil , fragment = nil , userInfo = nil , hostPort = fr.wikiversity.org , authority = fr.wikiversity.org , queryString = nil , relativePath = /wiki/Module:Multilingual ,
- Execution time and page: 2024-11-27 18:23:46 UTC, url = https://fr.wikiversity.org/wiki/Module:Multilingual ,
- Running times: start in page = 980 mS , import + 0 mS , form result + 0 mS , tests + 343 mS , duration = 343 mS ,
- doc = nobox1 noerr nocatview ,
- read = box1 catview ,
- tests = box1 catview docdef docline docsrc docdata docview : tests ,
- edit = box1 catview docdef docline docsrc docdata docview : ,
Mode | List of options | noerr value | docview value | tests value options_from_mode_test: |
---|---|---|---|---|
read | box1 catview | |||
edit | box1 catview docdef docline docsrc docdata docview : | true | ||
tests | box1 catview docdef docline docsrc docdata docview : tests | true | true |
- versions.running_times() Running times and references for Lua-coders.
- Local MediaWiki version = 1.44.0-wmf.5 (d64f667) time=2018-12-20T17:20:46 ,
- . Modules: Main module = Module:Centralizer , Proto version = Centralizer , Modules in this wiki = 380 ,
- . Central module version: versionName = Centralizer , versionNumber = 1.0.0(181227T22:44) , versionDate = 2018-12-27T22:44:00 , taskDescription = enough advanced to use in CentralSchool OK ,
- Users activities: activeUsers = 48 , Administrators(sysop) = 9 , bots(bot) = 9 , patrollers(patroller) = 72 , bureaucrats(bureaucrat) = 2 ,
- Statistics on users and content mw mw:Special:ListGroupRights
- Wivivi: In which language do you read Wikipedia?
- Last revision: REVISIONTIMESTAMP = 20240309154002 , REVISIONUSER = Crochet.david.bot ,
- Languages: PAGELANGUAGE = fr , CONTENTLANGUAGE = fr ,
- User language: ⧼Lang⧽ = ⧼Lang⧽ , ⧼es⧽ = ⧼es⧽ , {{int:Lang}} = ⧼Lang⧽ , USERLANG = Modèle:USERLANG , UILANGCODE = Modèle:UILANGCODE , USERLANG = Modèle:USERLANG , USERLANGUAGE = fr , USERIFCODE = Modèle:USERIFCODE ,
- Scribunto: , Extension:Scribunto Lua manual , version : = Lua 5.1 ,
- Server mw.uri.new: protocol = nil , user = nil , password = nil , main_title = nil , label = nil , text = nil , host = fr.wikiversity.org , port = nil , path = /wiki/Module:Multilingual , query = nil , fragment = nil , userInfo = nil , hostPort = fr.wikiversity.org , authority = fr.wikiversity.org , queryString = nil , relativePath = /wiki/Module:Multilingual ,
- Execution time and page: 2024-11-27 18:23:47 UTC, url = https://fr.wikiversity.org/wiki/Module:Multilingual ,
- Running times: start in page = 980 mS , import + 0 mS , form result + 0 mS , tests + 355 mS , duration = 355 mS , Erreur Lua : not enough memory
-- activity_check_html_bold_tags_title = "activity.check_html_bold_tags() Report imbalances of beginnings and ends of bold in code.", -- if not mask_sections then res = res .. viewers.doc_section(selector, "Library:datas", "h3") end -- .get_item( res = res .. viewers.drop(selector, "datas.get_item() Report datas from mw.wikibase **", datas.get_item_report) -- res = res .. viewers.drop(selector, "datas_update_Special_PageData_title", datas.update_PageData) -- -- if not mask_sections then res = res .. viewers.doc_section(selector, "Library:events", "h3") end -- function events.all_kinds_test(t) -- Test: all kinds of events (err, wng, cat) -- res = res .. viewers.drop(selector, "events_all_kinds_tests_title", events.all_kinds_test) -- 5 empty rows -- res = res .. viewers.drop(selector, "langs_selectLang_tests_title", langs.select_lang_test) -- lang %1 %2 %3 -- if not mask_sections then res = res .. viewers.doc_section(selector, "Library:langs", "h3") end res = res .. viewers.drop(selector, "langs_translations_counts_title", langs.translations_counts) -- S170618ltc -- res = res .. viewers.drop(selector, "langs_changing_translations_title", langs.changing_translations) -- no tabview res = res .. viewers.drop(selector, "langs_missing_translations_title", langs.missing_translations) -- string.find nil res = res .. viewers.drop(selector, "langs_dummy_languages_title", langs.dummy_languages) -- res = res .. viewers.drop(selector, "langs_mixed_translations_title", langs.i18n_lister) -- res = res .. viewers.drop(selector, "langs_abnormal_char_in_text_title", langs.abnormal_char_in_text ) -- false res = res .. viewers.drop(selector, "langs_list_MediaWiki_languages_title", langs.list_MediaWiki_languages ) -- OK, show in table ? -- if not mask_sections then res = res .. viewers.doc_section(selector, "Library:lua_table", "h3") end -- local list, count, level, split = lua_table.level_list(tab, typ, select, field) lua_table.level_list_tests( -- subtasks S170813lll res = res .. viewers.drop(selector, "lua_table_count_all_values_title", lua_table.count_tests ) -- lua_table.count_tests() -- function lua_table.count_tests(t) -- Count all objects or types or values in the table -- res = res .. viewers.drop(selector, "luaTable_fromsubnames_test_title", lua_table.fromsubnames_test ) -- nil res = res .. viewers.drop(selector, "luaTable_rough_view_tests_title", lua_table.rough_view_test ) res = res .. viewers.drop(selector, "lua_table_structure_recursive_report", lua_table.structure_recursive_report) res = res .. viewers.drop(selector, "luaTable_toList_tests_title", lua_table.to_list_tests, { ["dropit"] = "dropit", arggg = "dropit" } ) res = res .. viewers.drop(selector, "luaTable_toTable_tests_title", lua_table.to_table_test) -- -- In central modules, the Library:mathroman is a simple example of central modules support for any library. if not mask_sections then res = res .. viewers.doc_section(selector, "Library:mathroman", "h3") end -- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_mathroman", "h3") end res = res .. viewers.drop(selector, "mathroman_roman2int_tests_title", mathroman.roman2int_tests) -- Discreet main version res = res .. viewers.drop(selector, "mathroman_int2roman_test_title", mathroman.int2roman_test) -- Discreet main version --"enforcerun" "allwaysview" -- if not mask_sections then res = res .. viewers.doc_section(selector, "Library:modes", "h3") end -- function viewers.doc_section( -- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_modes", "h3") end -- res = res .. viewers.drop(selector, "datas.get_item() Report datas from mw.wikibase **", datas.get_item_report) -- res = res .. viewers.drop(selector, "modes_args_known_report_title", modes.args_known_report) res = res .. viewers.drop(selector, "modes_used_options_list_title", modes.used_options_list) -- res = res .. viewers.drop(selector, "modes.bind_args_known_one_lib_report(t) Report the binding of one library known args. **", modes.bind_args_known_one_lib_report) -- res = res .. viewers.drop(selector, "modes_used_options_list_title", modes.used_options_list ) res = res .. viewers.drop(selector, "versions_bind_arguments_tests_title", modes.options_from_args_tests) -- res = res .. viewers.drop(selector, "versions_bind_arguments_tests_title", versions.bind_arguments_tests) res = res .. viewers.drop(selector, "modes_options_uses_tests_title", modes.options_from_mode_tests) -- res = res .. viewers.drop(selector, "modes_options_uses_tests_title", modes.options_from_mode_tests, -- d.bg1="yellow", d.border_color="red", d.border_radius="10px 10px 10px 10px", image="Sanscrit dha.svg", } ) -- , cssview=true res = res .. viewers.drop(selector, "modes_recursive_normal_tests_title", modes.recursive_normal_tests) -- only errors -- arguments list -- res = res .. viewers.drop(selector, "modes_all_categories_list_title", modes.all_categories_list) -- n = 0 -- res = res .. viewers.drop(selector, "modes_all_errors_list_title", modes.all_errors_list) -- todo -- arguments support -- res = res .. viewers.drop(selector, "modes_multiple_selection_tests_title", modes.multiple_selection_tests) res = res .. viewers.drop("never", "modes_multiple_values_tests_title", modes.multiple_values_tests) res = res .. viewers.drop(selector, "modes_levenshtein_similar_tests_title", modes.levenshtein_similar_tests) res = res .. viewers.drop(selector, "modes_namespaces_page_list_title", modes.namespaces_page_list) res = res .. viewers.drop(selector, "modes_recursive_normal_tests_title", modes.recursive_normal_tests) -- only errors res = res .. viewers.drop(selector, "modes_namespaces_page_list_title", modes.recursive_normal_tests) -- only errors -- function tab_view.form_one_case) -- "enforcerun" if not mask_sections then res = res .. viewers.doc_section(selector, "Library:versions", "h3") end -- if not mask_sections then res = res .. viewers.doc_section(selector, "viewers_section_title_library_versions", "h3") end res = res .. viewers.drop(selector, "versions_versions_management_title", versions.versions_support_test ) -- OK, to optimize res = res .. viewers.drop(selector, "versions.bind_all_sub_modules() ACTUAL Bind all sub-modules of the main module **", versions.bind_all_sub_modules_actual_report ) -- to_debug_on_20170507 res = res .. viewers.drop(selector, "versions_all_G_and_loaded_list_title", versions.all_G_and_loaded_list) -- res = res .. viewers.drop(selector, "versions_central_changes_title", versions.central_changes) --RIC mw.loadData( -- res = res .. viewers.drop(selector, "versions_deprecated_function_tests", viewers.simple_list_test) -- res = res .. viewers.drop(selector, "versions_bind_modules_tests_title", versions.bind_modules_test ) res = res .. viewers.drop(selector, "versions_sort_central_modules_title", versions.sort_central_modules_report ) -- S170606cmr -- res = res .. viewers.drop(selector, "versions_antiCrash_tests_title", versions.anti_crash_tests ) -- Tests antiCrash() -- to_debug_on_20170507 res = res .. viewers.drop(selector, "versions_running_times_title", versions.running_times ) -- versions.running_times() --[[ --function viewers.drop( if not mask_sections then res = res .. viewers.doc_section(selector, "Library:viewers", "h3") end -- The Library:viewers can formats texts to document in some languages: tableview(in lines and columns), Dropboxes, recursive luatables... res = res .. viewers.drop(selector, "langs_form9user_tests_title", viewers.form9user_test ) res = res .. viewers.drop(selector, "langs_form99user_tests_title", viewers.form99user_test ) res = res .. viewers.drop(selector, "viewers_parts_of_date_tests_title", viewers.parts_of_date_tests) res = res .. viewers.drop(selector, "viewers_simpleList_tests_title", viewers.simple_list_test ) res = res .. viewers.drop("never", "viewers_table_tab_options_title", viewers.table_test ) res = res .. viewers.drop(selector, "viewers_save_restore_balance_title", viewers.save_restore_balance_report) -- to_debug_on_20170507 --]] return res end -- function viewers.doc_internal(selector, mask_sections)
-- See T166202 Strings defined as long comments give a Lua modules syntax error function viewers.try_graph() -- see Macron from https://fr.wikipedia.org/w/index.php?title=Mod%C3%A8le:Frise_chronologique_Emmanuel_Macron&action=edit -- unusable : frame:expandTemplate{ title = 'template', args = { 'arg1', 'arg2', name = 'arg3' } } -- use : frame:preprocess( string ) or object = frame:newParserValue( text ) -- use : frame:newTemplateParserValue{ title = title, args = table } local t = "\n* viewers.try_graph()" t = t .. "Carrière et parcours politique d'Emmanuel Macron" t = t .. viewers.time_line -- return t end -- function viewers.try_graph()
viewers.central_functionalCSS = { -- S170617CSS : Use MW CSS see edit_class, content_class, CSSstructure edit_class = "editOptions", edit_form = "mw-editform-legacy", box_class = "infobox_v2", box_form = "infobox_v2", content_class = "content", content_form = "content", page_class = "page_class", page_form = "page_form", user_class = "user_class", user_form = "user_form", toc_class = "toc", toc_form = "toc_form", -- result_form = viewers.form9user(result_form, toc_form, toc_class, edit_form, content_form, page_form, user_form, xx, xx, xx) -- %1 %1 %1 %1 %1 %1 %1 %1
CSSstructure = 'viewers_sentence_example_page_text = "Cette phrase montre un exemple de texte de page. ", -- br viewers_sentence_example_page_text = "Dieser Satz zeigt eine Beispieltextseite. ", -- de viewers_sentence_example_page_text = "This sentence shows an example of page text. ", -- en viewers_sentence_example_page_text = "Esta frase muestra una página de muestra de texto. ", -- es viewers_sentence_example_page_text = "Cette phrase montre un exemple de texte de page. ", -- fr viewers_sentence_example_page_text = "Ez a mondat egy minta oldal szöveg.", -- hu viewers_sentence_example_page_text = "Câu này cho thấy một trang mẫu của văn bản. ", -- vi }
-- The TemplateStyles extension introduces a <templatestyles> tag to specify that a stylesheet should be loaded from a wiki page. Placing this in a template allows the template to have custom styles without having to place them in MediaWiki:Common.css.
p.options_for_modes = { -- module options_for_modes read = " box1 catview ", doc = " nobox1 noerr nocatview ", edit = " box1 catview docdef docline docsrc docdata docview : ", tests = " box1 catview docdef docline docsrc docdata docview : tests ", }
function p.box_read(prop, title) -- Draws the read box -- 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) local res, props, prop = "", datas.props, datas.prop datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42" local QITEM = datas.QITEM or datas.default_item or "Q11758" -- Dr Ludwik Zamenhof datas.prop, datas.props = datas.get_item(modes.args_known, QITEM) -- Get datas from mw.wikibase for the page. langs.init_content_page_user_lang() -- function langs.init_content_page_user_lang()langs.init_content_page_user_lang(content_lang, page_lang, user_lang) -- local image = viewers.form_image(prop.image, 50) local flag = viewers.form_image("Flag_of_Europe.svg", 50) local birthyear_deathyear = " ( " .. (prop.birthyear or "birthyear") .. " - " .. (prop.deathyear or "deathyear") .. " ) " -- local phabtask = " - Datas "
local res = "p.box_read) res = res .. "
Labels in langs: " .. prop.labelbylang .. ", user: " .. prop.labeluser .. ", content: " .. prop.labelcontent .. ", page: " .. prop.labelpage .. ""
res = res .. "
description: " .. prop.description .. ""
res = res .. "
" .. flag .. " * used languages: user:" .. langs.user_lang .. ", content:" .. langs.content_lang .. ""
res = res .. " page: " .. langs.page_lang .. " * "
return t -- versions_err_module_miss_i18n_cat end -- local res function p.box_read(args_known, title)
function p.form_result(args_known, main_module) -- Formats all results of this module and its sub-modules. local res = "" local memo = viewers.init_configs("p.form_result") -- Initialize global configurations and save them before eventual changes. datas.default_item = datas.default_item or "Q56855339" -- Keep Zamenhof (Q56855339) local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = { -- Table ...} main_module = main_module or versions.main_module res = res .. viewers.ta("modes.mode_name", modes.mode_name) .. viewers.ta("modes.options", modes.options) if modes.option("box1") or modes.option("catview") then res = res .. " catview = " .. events.categories_lister(":") end -- Display categories events.gener_categories(args_known) -- Formats all categories without activate them if modes.option("docview") or modes.option(":") or modes.option("tests") or (modes.args_known.mode == "edit") then res = res .. "\n* datas.default_item = " .. datas.default_item .. ", datas.default_name = " .. datas.default_item .. "\n" res = res .. p.box_read(args_known) end modes.time3 = os.clock() if modes.option("tests") or 1 then -- or (modes.args_known.mode == "tests") -- res = res .. viewers.doc_group("allwaysview") -- viewers.doc_group(selector, mask_sections) -- To enforce title of sections -- res = res .. viewers.doc_page("allwaysview") -- included in viewers.doc_group -- res = res .. viewers.doc_module("allwaysview") -- included in viewers.doc_group -- res = res .. viewers.doc_internal("allwaysview") -- included in viewers.doc_group -- res = res .. versions.running_times(false, "") end viewers.restore_configs(memo, "p.form_result") -- Restore global configurations after eventual changes. return res end -- res = res .. p.form_result(args_known, main_module) -- Formats all results of this module and its sub-modules.
function viewers.init_configs(memo, tab_view, group) -- Initialize global configurations and save them before eventual changes. if type(memo) ~= "table" then memo = {} end if type(group) ~= "table" then group = nil end if type(tab_view) ~= "table" then tab_view = events.tab_view or {} end memo.events = events -- A new events process/object come from the events process/object in this module. memo.events.tab_view = tab_view or memo.events.tab_view or events.tab_view memo.events.catview = tab_view.catview or memo.events.catview or modes.catView memo.events.default_group = tab_view.default_group or memo.events.group_all_types_test memo.events.DropboxStyle = tab_view.DropboxStyle or memo.events.DropboxStyle memo.events.testGroup = group or tab_view.testGroup or memo.events.testGroup or events.testGroup or {} memo.events.headers = tab_view.headers or memo.events.headers memo.events.kind = tab_view.kind or memo.events.kind memo.events.tableViewStyle = tab_view.tableViewStyle or memo.events.DropboxStyle memo.events.testsFunction = tab_view.testsFunction or memo.events.testsFunction memo.events.typ = tab_view.typ or memo.events.typ memo.events.content_lang = tab_view.content_lang or memo.events.content_lang memo.events.page_lang = tab_view.page_lang or memo.events.page_lang memo.events.user_lang = tab_view.user_lang or memo.events.user_lang memo.events.recursiveLevel = tab_view.recursiveLevel or memo.events.recursiveLevel memo.events.recursiveLimit = tab_view.recursiveLimit or memo.events.recursiveLimit or 11111 memo.events.testGroup = events.testGroup or memo.events.testGroup or {} langs.init_content_page_user_lang(memo.events.content_lang, memo.events.page_lang, memo.events.user_lang) return memo, memo.events end -- function viewers.init_configs(memo, tab_view, group)
function viewers.save_configs(where) -- Save global configuration before eventual changes. if type(where) ~= "string" then where = "where" end -- to not disturb normal string and detect missing where viewers.save_configs_runs = viewers.save_configs_runs or {} viewers.save_configs_runs[where] = { ["where"] = where, ["save"] = "save", } local memo = {} memo.memo_categories_list = events.categories_list memo.memo_tabView = events.tab_view memo.memo_testGroup = events.testGroup memo.memo_content_lang = langs.content_lang memo.memo_content_translations = langs.content_translations memo.memo_langs_main_i18n = langs.main_i18n memo.memo_page_lang = langs.page_lang memo.memo_page_translations = langs.page_translations memo.memo_user_lang = langs.user_lang memo.memo_user_translations = langs.user_translations memo.memo_args_known = modes.args_known memo.memo_args_template = modes.args_template memo.memo_modes_catView = modes.catView memo.memo_mode_name = modes.mode_name memo.memo_mode_options = modes.mode_options memo.memo_options_for_modes = modes.options_for_modes memo.memo_recursiveLimit = modes.recursiveLimit memo.memo_report_trackOptions = modes.report_trackOptions memo.memo_template_options = modes.template_options memo.memo_used_options = modes.used_options memo.memo_versions_actual_modules = versions.actual_modules memo.memo_versions_main_i18n = versions.main_i18n return mw.clone(memo) end -- function viewers.save_configs()
function viewers.restore_configs(memo, where) -- Restore global configurations after eventual changes. if type(where) ~= "string" then where = "where" end -- to not disturb normal string and detect missing where if type(memo) ~= "table" then events.add_err("events_close_without_memo_err", where) -- Add an error in the actual table of events. return end viewers.restore_configs_runs = viewers.restore_configs_runs or {} viewers.restore_configs_runs[where] = { ["where"] = where, ["restore"] = "restore", } -- local memo = mw.clone(memo) events.categories_list = memo.memo_categories_list events.tab_view = memo.memo_tabView events.testGroup = memo.memo_testGroup langs.content_lang = memo.memo_content_lang langs.content_translations = memo.memo_content_translations langs.main_i18n = memo.memo_langs_main_i18n langs.page_lang = memo.memo_page_lang langs.page_translations = memo.memo_page_translations langs.user_lang = memo.memo_user_lang langs.user_translations = memo.memo_user_translations langs.init_content_page_user_lang(langs.content_lang, langs.page_lang, langs.user_lang) modes.args_known = memo.memo_args_known modes.args_template = memo.memo_args_template modes.catView = memo.memo_modes_catView modes.mode_name = memo.memo_mode_name modes.mode_options = memo.memo_mode_options modes.options_for_modes = memo.memo_options_for_modes modes.recursiveLimit = memo.memo_recursiveLimit modes.report_trackOptions = memo.memo_report_trackOptions modes.template_options = memo.memo_template_options modes.used_options = memo.memo_used_options versions.actual_modules = memo.memo_versions_actual_modules versions.main_i18n = memo.memo_versions_main_i18n return end -- function viewers.restore_configs(memo, where)
function viewers.save_configs_check(save_configs_runs, restore_configs_runs) -- AFTER ALL RUNS, report saved global configurations. viewers.save_configs_runs = save_configs_runs or viewers.save_configs_runs or {} viewers.restore_configs_runs = restore_configs_runs or viewers.restore_configs_runs or {} viewers.mix_configs_runs, i = {}, 0 for where, one_func in pairs(viewers.save_configs_runs) do viewers.mix_configs_runs[where] = one_func -- get all configs from save_configs_runs end for where, one_func in pairs(viewers.restore_configs_runs) do viewers.mix_configs_runs[where] = one_func -- get all configs from restore_configs_runs to complete the group. end viewers.save_restore_balance_group = {} for i, one_func in pairs(viewers.mix_configs_runs) do local where = one_func["where"] if viewers.save_configs_runs[where] then one_func["save"] = "save" end if viewers.restore_configs_runs[where] then one_func["restore"] = "restore" end table.insert(viewers.save_restore_balance_group, one_func) end table.sort(viewers.save_restore_balance_group, function (a, b) return ( a.where < b.where ) end ) -- Sort based on where for i, one_func in pairs(viewers.save_restore_balance_group) do one_func.i = i if one_func["save"] and one_func["restore"] then one_func["err"] = "OK" -- normal run, saved and restored elseif one_func["save"] then one_func["err"] = "missing restore" elseif one_func["restore"] then one_func["err"] = "missing save" else one_func["err"] = "missing save and restore" end end return viewers.save_restore_balance_group end -- function viewers.save_configs_check(save_configs_runs, restore_configs_runs) -- After all runs, report saved global configurations.
function viewers.save_restore_balance_report(t) -- Reports the check of save and restore configs balance
local t = t -- t or
if (type(t) ~= "string") then t = '\n* viewers.save_restore_balance_report(t) : Reports the check of save and restore configs balance' end
viewers.save_restore_balance_group = viewers.save_configs_check(viewers.save_configs_runs, viewers.restore_configs_runs) -- After all runs, report saved global configurations.
t = t .. viewers.form9user("\n* This report checks %1 configurations.", #viewers.save_restore_balance_group)
if type(viewers.save_restore_balance_group) ~= "table" then -- abnormal run
t = t .. "\n* Error: The table viewers.save_restore_balance_group{} do not exist."
return t
end
-- t = t .. "\n* save_restore_balance_group[37] = " .. lua_table.level_count(viewers.save_restore_balance_group[37]) ..
-- lua_table.rough_view(viewers.save_restore_balance_group[37])
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = "viewers.save_restore_balance_report(t) -- Reports the check of save and restore configs balance",
test_group = viewers.save_restore_balance_group,
headers = "viewers_save_restore_balance_headers", -- i;where;save;restore;errors
headers_class = "wikitable alternative center sortable",
form_one_case = function(one_func) -- Convert a case from test_group to rowGroup.
return { one_func.i, one_func.where, one_func.save, one_func.restore, one_func.err, }
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. "
" .. tableview.new(tab_view) -- Form a table view with lines and columns.
return t
end -- t = t .. viewers.save_restore_balance_report(t)
-- cut_libraries
p.i18n = {} -- translations tables known in the module
p.i18n.en = { -- Translations in English -- Arguments to import, do not translate. ["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", }, ['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', -- -- 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. ["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", }, ['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', -- -- 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 to import, do not translate. Arguments à importer, ne pas traduire. ["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", }, ['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', -- -- Translate all next arguments. 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.box_read)
-- Arguments in order without names, with their keyword for use as other arguments. -- Arguments dans l'ordre, non nommés, avec leur keyword pour traitement comme les autres arguments. -- [1] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "mode", ["syn"] = 2},
-- Guideline to integer i18n translations following a list of sub-modules: modules_guide with their own translations. -- Guideline to integer default arguments values: defaults values are always from Centralizer. -- Guideline for default arguments values: each main_module can replace any option of any argument from Centralizer. -- Guideline for these changes: Centralizer is always protected against any change. -- -- Special arguments to modify the fonctions and outputs of this module. -- Arguments speciaux pour modifier le fonctionnement et les sorties de ce module. ["modules_guide"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "modules_guide", ["modules_guide_default"] = "Centralizer", }, ["category"] = { ["typ"] = "ctr", ["need"] = 0, ["keyword"] = "category"}, ["debug"] = { ["typ"] = "opt", ["need"] = 0, ["keyword"] = "debug"}, ["c"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "c"}, ["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"}, ["knownversions"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "knownversions"}, ["soughtversions"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "soughtversions"}, ["contentlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "contentlang"}, ["pagelang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "pagelang"}, ["userlang"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "userlang"}, ["args_known_country"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_country", ["prop"] = "P18", }, ["args_known_flag"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_flag", ["prop"] = "P18", }, ["args_known_monument"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_monument",["prop"] = "P18", }, ["args_known_town"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_town", ["prop"] = "P18", }, -- 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. ["image"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "image", ["prop"] = "P18", }, ["country"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "country", ["prop"] = "P27", }, ["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"] = "Q307", }, -- Galilée -- Nicolas Flamel (Q41568), alchimie Victor Hugo (Q535) très connu, Montaigne (Q41568) education, Dr Ludwik Zamenhof (Q11758) esperanto UMUM ["sitelink"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "sitelink", ["prop"] = "sitelink", }, ["uri"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "uri", ["prop"] = "uri", }, ["sex"] = {["keyword"] = "sex", ["typ"] = "dat", ["need"] = 0, ["prop"] = "P21", ["arg_values"] = "sex_values", ["key_values"] = "male;femelle", }, -- wiki_selectors ["region"] = {["keyword"] = "region", ["typ"] = "dat", ["need"] = 0, ["arg_values"] = "region_values", ["key_values"] = "other;china;india;century" }, -- wiki_selectors ["rights"] = {["keyword"] = "rights", ["typ"] = "dat", ["need"] = 0, ["arg_values"] = "rights_values", ["key_values"] = "no;none;ONU;none;cn;50;us;70;mpf", -- wiki_selectors ["delay_values"] = "0;0;0;0;50;50;70;70;95", ["arg_uses"] = "none;none;none;none;cn;cn;us;us;mpf" }, -- wiki_selectors ["args_known_monument"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "args_known_monument", ["prop"] = "P18", }, ["labelbylang"] = { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "labelbylang", ["prop"] = "P18", }, -- args_known_monument = "Tour Eiffel", -- French -- args_known_town = "Paris", -- French } -- #p.args_known = 29 on 2018-01-15
function p.form_support_desk_report(t) return versions.form_support_desk_report(t) end
function versions.form_support_desk_report(t) -- Formats the detailed Versions report
local memo = viewers.save_configs("versions.form_support_desk_report") -- Save global configuration before eventual changes.
local report_main_discreet = versions.report_main_discreet or " report_main_discreet missing "
local t = t -- t or
if type(t) ~= "string" then t = '\n* Formats the detailed Versions report : Formats the detailed Versions report' end
t = t .. "\n* Discreet main version: " .. viewers.discreet_main_version() -- .. form_support_desk_report
local version = p.version or {}
t = t .. "\n* Description of the Module:Centralizer version: " .. viewers.ta("versionName", version.versionName) .. viewers.ta("versionNumber", version.versionNumber) .. viewers.ta("versionDate", version.versionDate)
t = t .. "\n* The structure of the Module:Centralizer versionNumber is yymmdd:hh:mm
."
t = t .. "\n* " .. viewers.ta("Main module Description", version.mainDescription) .. viewers.ta("function", version.functionDescription) .. viewers.ta("task", version.taskDescription)
t = t .. "\n* MediaWiki_version: " .. versions.MediaWiki_version() -- Formats MediaWiki_version, in error color if it changes.
t = t .. "\n*" .. langs.main_i18n_languages_list() -- Lists available translations in available languages.
t = t .. "\n* Start versions from the main module: " .. (versions.bind_verif_modules_report_start or " bind_verif_modules_report_start missing ")
t = t .. versions.versions_management_report()
t = t .. versions.sort_central_modules_report()
t = t .. versions.running_times()
-- Inside the viewer drop_box.form(), a function in test or in report has a nil result
viewers.restore_configs(memo, "versions.form_support_desk_report") -- Restore global configurations after eventual changes.
return t
end
-- Nicolas Flamel (Q41568), alchimie Victor Hugo (Q535) très connu, Montaigne (Q41568) education, Dr Ludwik Zamenhof (Q11758) esperanto UMUM
datas.default_item = datas.default_item or "Q11758"
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)
-- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - --------------------------------- -- Interfaces, alias and functions to templates -- Interfaces, alias y funciones para modelos -- Interfaces, alias et fonctions pour les modèles -- - - - ------------------ - - - - --------------------------------- -- - - - ------------------ - - - - ---------------------------------
-- done for ModuleCentralizer : then use function versions.init_multilingual_module() to replace function versions.init_multilingual_module() function modes.
function versions.init_multilingual_module(mode, args_known) -- Replace each versions.init_multilingual_module() function by its sub fonctions.
-- p.version.versionNumber = CentralI18N.version.versionNumber
local res = ""
local args_all = {}
-- function versions.bind_reverse_i18n_translations(
local args_known = args_known or modes.args_known or p.args_known or {}
versions.setup_central_libraries(versions.bindable_libraries) -- Actual installation of central bindable libraries in package.loaded
versions.memo_i18n = mw.clone(versions.main_i18n or langs.main_i18n)
langs.init_content_page_user_lang() -- content_lang, page_lang, user_lang, "versions.init") first and later for all cases
modes.args_import = modes.import_arguments(args_known, args_source, content_translations, args_wikidata) -- Imports all arguments from template, or invoke, or wikidata
local args_import = args_import or modes.args_import
local options_for_modes = modes.options_for_modes or p.options_for_modes
-- local args_known, done = p.add_one_arg(args_known, one_arg) -- Gets mode, frame, args_known and interacts them.
res = res .. "\n* Count the previous main arguments:" .. lua_table.level_count(args_known) .. "
"
res = res .. "\n* Count of new arguments added to previous main arguments:" .. lua_table.level_count(p.args_known) .. "
"
langs.changing_translations() -- Changements de traduction dans les tables i18n
langs.init_content_page_user_lang() -- content_lang, page_lang, user_lang, "versions.init") first and later for all cases
versions.bind_the_main_module() -- Bind the main module, all sub-modules and all their i18n. function versions.bind_the_main_module(
langs.main_i18n_complete = false -- Mask any views to avoid failures until enough init.
versions.bind_all_sub_modules() -- Bind all sub-modules of the main module. function versions.bind_all_sub_modules(
res = res .. modes.init_modes_translate_events(frame, Central_version, mode_name, args_known, options_for_modes, QITEM)
if type(langs) == "table" then langs.main_i18n = langs.main_i18n or versions.main_i18n or {} end -- Same pointers insure later same contents.
-- Bind all i18n translations from libraries, modules and their /I18N translations sub-modules
local loaded_pack = versions.loaded_modules_and_libraries
versions.bind_reverse_i18n_translations(main_versions, loaded_pack) -- Bind all i18n translations from modules and their /I18N translations sub-modules
langs.init_content_page_user_lang() -- content_lang, page_lang, user_lang, "versions.init") function langs.init_content_page_user_lang(
langs.main_i18n_complete = true -- Unmask all views after enough init.
-- res = res .. activity.detect_MediaWiki_changes() -- MWMW
return res
end -- res = res .. versions.init_multilingual_module(mode, args_known) -- Replace each Mdversions.init_multilingual_module() function by its sub fonctions.
-- done for ModuleCentralizer : then use function versions.init_multilingual_module() to replace function versions.init_multilingual_module() function modes.
function versions.init_multilingual_module_report(t) -- Reports args_known for phase = "mode" or "argument" or "QITEM" or "property"
local memo = viewers.save_configs("versions.init_multilingual_module_report") -- Save global configuration before eventual changes.
local t = t -- t or
if type(t) ~= "string" then t = '\n* versions.init_multilingual_module_report(t) : Reports args_known for phase = "mode" or "argument" or "QITEM" or "property"' end
modes.actual_arguments = modes.actual_arguments or {} -- Activated args_known depending of for phase = mode or argument or QITEM or property
local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...}
t = t .. "\n* Count the previous main arguments:" .. lua_table.level_count(args_known) .. "
"
t = t .. "\n* Count of new arguments added to previous main arguments:" .. lua_table.level_count(p.args_known) .. "
"
local tab_view = { -- Group datas and options for a table view with lines and columns.
title_memo = 'versions.init_multilingual_module_report(t) -- Reports args_known for phase = "mode" or "argument" or "QITEM" or "property"',
test_group = p.args_known, -- = sorted activity.phabricator_tasks_Group,
headers = "activity_phabricator_tasks_headers", -- "Importance; modified on; Task; Status; Title"
headers = "key; keyword; typ; bind; need; prop; prop_default; format; value",
headers_class = "wikitable alternative center sortable",
form_one_case = function(case) -- Convert a case from test_group to rowGroup.
-- ["QITEM"] = { ["typ"] = "dat", ["mode"] = "read", ["need"] = 0, ["keyword"] = "QITEM", ["prop"] = "QITEM", prop_default = "Q34743", },
-- ["mode"] = { ["typ"] = "config", ["mode"] = "edit", ["need"] = 0, ["keyword"] = "mode", ["prop_default"] = "read"},
-- ["label"] = { ["typ"] = "dat", ["mode"] = "doc", ["need"] = 0, ["keyword"] = "label" , ["prop"] = "label", ["prop_default"] = "Aristote", },
return { case.key, case.keyword, case.value, case.typ, case.bind, case.need, case.prop, case.prop_default, case.format, }
end,
headers_class = "wikitable alternative center sortable",
rowGroup = {},
-- track_on == "details", convert function tab_view.form_one_case( to form_one_case = function(
}
t = t .. tableview.new(tab_view) -- Runs tests cases and formats a table view with lines and columns.
viewers.restore_configs(memo, "versions.init_multilingual_module_report") -- Restore global configurations after eventual changes.
return t
end -- t = t .. function versions.init_multilingual_module_report(t) -- FAMLTVQDR replaces function versions.init_multilingual_module( code DODO
function p.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 args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...} res = res .. versions.init_multilingual_module("read", args_known) res = res .. p.form_result(args_known, main_module) -- Formats all results of this module and its sub-modules. -- res = res .. "\n* " .. datas.track_val return res end -- function p.read(frame)
function p.edit(frame) -- The edit mode verifies arguments, displays the edit panel with errors, warnings and categories. local res = "" res = res .. versions.init_multilingual_module("edit", args_known) res = res .. p.form_result(args_known, main_module) -- Formats all results of this module and its sub-modules. return res end -- function p.edit(frame)
-- ["docfunc"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "docfunc"}, -- ["docitem"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "docitem"}, -- ["dockey"] = { ["typ"] = "config", ["need"] = 0, ["keyword"] = "dockey"}, function p.doc(frame) -- Formats a documentation or a test in a drop_box. local res = "" res = res .. versions.init_multilingual_module("doc", args_known) modes.change_itemid() -- default = "Q41568" datas.QITEM = mw.wikibase.getEntityIdForCurrentPage() -- use props.QITEM Returns the Item id as string, like "Q42" local QITEM = datas.QITEM or datas.default_item or "Q34743" -- Rudyard Kipling local docfunc = args_known.docfunc or args_known[3] or modes.args_import.docitem or modes.args_import[3] local docitem = args_known.docitem or args_known[2] or modes.args_import.docitem or modes.args_import[2] or datas.default_item local dockey = args_known.dockey or args_known[1] or modes.args_import.dockey or modes.args_import[1] local QITEM = args_known.QITEM or args_known.docitem or docitem -- datas.QITEM = mw.text.trim(QITEM) -- clean spaces in each name if dockey then -- local selector = mw.text.trim(dockey) end return res end -- function p.doc(frame)
function p.tests(frame) -- Formats several groups of test cases to finalise the Centralizer UMUM local res = "" res = res .. tracker.init_trakers() -- Initialize some trakers. To run in p.init() local args_known = args_known or modes.args_known or p.args_known or {} -- optional value from p.args_known = {...} local main_module = versions.main_module -- Bind the main module from function versions.bind_the_main_module() local t = versions.init_multilingual_module("tests", args_known) res = res .. t -- res = res .. "\n* getEntityIdForCurrentPage = " .. tostring( mw.wikibase.getEntityIdForCurrentPage() ) -- Returns the Item id as string, like "Q42" p.form_tests_init() langs.init_content_page_user_lang(a, b, c, d, "p.tests") versions.main_versions = versions.main_versions or { versionName = "versionName", versionNumber = "0.0", } if not versions.main_versions then versions.main_versions = p.version or versions.version end modes.mode_name = "tests" res = res .. p.form_result(modes.args_known) -- Generate wikitext, categories, and others -- res = res .. viewers.try_graph() return res end -- function p.tests(frame)
function p.begin(frame) local res = "" res = res .. "\n* Some examples of author headers, infosbox, ... from 10 first begin modules in langs" return res end -- function p.begin(frame)
function viewers.doc_group(selector, mask_sections) -- Formats all or any documentations of tests and reports. -- snaks tst local res = "" -- function viewers.drop( -- res = res .. viewers.drop(selector, "versions_bind_arguments_tests_title", versions.bind_arguments_tests) -- Do it not need to test res = res .. viewers.doc_section(selector, "Tests of this page", "h2", mask_sections) res = res .. viewers.drop(selector, "modes_args_known_report_title", modes.args_known_report) res = res .. viewers.drop(selector, "activity_report_subtasks_title", activity.central_subtasks_report) res = res .. viewers.drop(selector, "datas.get_item() Report datas from mw.wikibase **", datas.get_item_report) -- res = res .. viewers.doc_section(selector, "viewers_section_title_page", "h2") -- res = res .. datas.get_item_report() -- datas.get_item() Report datas from mw.wikibase for the page ** res = res .. viewers.doc_page(selector, mask_sections) res = res .. viewers.doc_module(selector, mask_sections) res = res .. viewers.doc_internal(selector, mask_sections) -- res = res .. versions.running_times(false, "") -- res = res .. datas.get_item_report(t) -- datas.get_item() Report datas from mw.wikibase for the page ** res = res .. activity.MW_Versions_report(t) -- Reports versions of MediaWiki for 3 months. return res end -- function viewers.doc_group(selector, mask_sections) item:
return p
-- Nicolas Flamel (Q41568), alchimie Victor Hugo (Q535) très connu, Montaigne (Q41568) education, Dr Ludwik Zamenhof (Q11758) esperanto UMUM -- local QITEM = datas.QITEM or datas.default_item -- -- Tests pages on 2018-07-24 : -- Patrom:TestsAuteur2Tpt -- s.br.Patrom:TestsAuteur2Tpt for tests in Breton -- Patrom:Auteur2Tpt -- s.br.Patrom:Auteur2Tpt as templete in Breton -- Modulenn:Auteur2Tpt-s-br -- s.br.Modulenn:Auteur2Tpt as module itself in Breton -- -- Mô đun:Centralizer-w-vi -- w.vi.wikipedia.Mô đun:Centralizer-w-vi in Vietnamise -- MediaWiki:Centralizer/Tests -- w.vi.wikipedia.Mô đun:Centralizer/Tests in Vietnamise -- Módulo:Centralizer-w-es -- s.es.wikipedia.Módulo:Central-w-es in Spanish -- Plantilla:Centralizer/Tests -- s.es.wikipedia.Módulo:Centralizer/Tests in Spanish -- Modulenn:Centralizer-s-br -- s.br.wikisource.Modulenn:Centralizer-s-br in Breton -- Patrom:TestsCentralizer -- s.br.wikisource.Patrom:CentralizerTests in Breton -- -- Tests pages on 2018-08-06 : -- Module:Auteur2Tpt -- s.fr.wikisource.Module:Auteur2Tpt in French -- Module:Auteur2Tpt/Documentation -- s.fr.wikisource.Module:Auteur2Tpt/Documentation in French -- Module:Centralizer/Documentation -- s.fr.wikisource.Module:Centralizer/Tests in French -- Utilisateur:Rical/Victor Hugo -- Tester Module:Centalizer pour l'auteur Victor Hugo --
- ↑ " .. viewers.styles_color_error( dropit.content_error) .. "