Module:auto cat: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local export = {} local function get_language(title) local find_by_name = require("Module:languages").find_by_name local language local words = mw.text.split(title, " ") for i = 1, #words do name = table.concat(words, " ", 1, i) language = find_by_name(name) if language then break end end return language end return export") |
No edit summary |
||
Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
local function | local function get_language_and_label(title) | ||
local find_by_name = require("Module:languages").find_by_name | local find_by_name = require("Module:languages").find_by_name | ||
local language | local language, label | ||
local words = mw.text.split(title, " ") | local words = mw.text.split(title, " ") | ||
for i = 1, #words do | for i = 1, #words do | ||
name = table.concat(words, " ", 1, i) | name = table.concat(words, " ", 1, i) | ||
label = table.concat(words, " ", i + 1) | |||
language = find_by_name(name) | language = find_by_name(name) | ||
if language then break end | if language then break end | ||
end | end | ||
return language | return language, label | ||
end | end | ||
return export | return export |
Revision as of 08:07, 6 August 2023
local export = {}
local function get_language_and_label(title)
local find_by_name = require("Module:languages").find_by_name
local language, label
local words = mw.text.split(title, " ")
for i = 1, #words do
name = table.concat(words, " ", 1, i)
label = table.concat(words, " ", i + 1)
language = find_by_name(name)
if language then break end
end
return language, label
end
return export