Difference between revisions 18626526 and 18626527 on frwiktionarylocal languages = mw.loadData("Module:languages") local export = {} -- transliterate the text, if possible function export.translit(lang, text) -- TODO: the table's information should be moved to [[Module:languages]] local translit_modules = { ["ae"] = "Module:Avst-translit", ["ady"] = "Module:ady-translit", ["el"] = "Module:el-translit", (contracted; show full) return script end end end -- Format the categories with the appropriate sort key function export.format_categories(categories, lang, sort_key) if type(categories) == "table" then local args = categories.args lang = args["lang"] or error("The parameter \"lang=\" has not been given") sort_key = args["sort_key"]; if sort_key == "" then sort_key = nil end categories = {} local i = 1 local cat = args[i] or "" while cat ~= "" do table.insert(categories, cat) i = i + 1 cat = args[i] or "" end end⏎ ⏎ local langinfo = languages[lang] or error("The language code \"" .. lang .. "\" is not valid.") NAMESPACE = NAMESPACE or mw.title.getCurrentTitle().nsText if NAMESPACE == "" or NAMESPACE == "Appendix" then PAGENAME = PAGENAME or mw.title.getCurrentTitle().text SUBPAGENAME = SUBPAGENAME or mw.title.getCurrentTitle().subpageText -- If no sort key was given, generate one if not sort_key then -- Generate a default language-independent sort key sort_key = mw.ustring.gsub(SUBPAGENAME, "^[-־ـ]", "") -- If there are language-specific rules to generate the key, use those if langinfo.sort_key then for i, from in ipairs(langinfo.sort_key.from) do local to = langinfo.sort_key.to[i] or "" sort_key = mw.ustring.gsub(sort_key, from, to) end end end -- If the resulting key is the same as the wiki software's default, remove it if sort_key == PAGENAME then sort_key = nil end for key, cat in ipairs(categories) do categories[key] = "[[Category:" .. cat .. (sort_key and "|" .. sort_key or "") .. "]]" end return table.concat(categories, "") else return "" end end return export All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://fr.wiktionary.org/w/index.php?diff=prev&oldid=18626527.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|