Module:translit-redirect
This module replaces transliteration modules that don't generate transliteration. It takes language and script code and redirects to the actual transliteration module that handles this combination of codes, using Module:translit-redirect/data. It has replaced transliteration modules like Module:pa-translit. Languages whose transliteration is handled by this module: Antigong Griyego (grc
) , Aramaic (arc
) , Ashokan Prakrit (inc-ash
) , Bhojpuri (bho
) , Kashmiri (ks
) , Kipchak (qwm
) , Konkani (kok
) , Kurdish (ku
) , Lomavren (rmi
) , Lü (khb
) , Middle Persian (pal
) , Newar (new
) , Northern Kurdish (kmr
) , Old Marathi (omr
) , Pali (pi
) , Parthian (xpr
) , Punjabi (pa
) , Sanskrit (sa
) , Sogdian (sog
) , Udi (udi
) , Wakhi (wbl
) .
Using a single module to redirect to other transliteration modules will save some Lua memory on pages that tend to go over the memory limit. Also, the template that generates documentation for transliteration modules ({{translit module documentation}}
) can only discover that a language uses a transliteration module, and list that language on the transliteration module's documentation page, if the transliteration module is listed either in the language's data file, or in Module:translit-redirect/data.
Examples
baguhonpa
(Punjabi) uses this module to redirect to the correct transliteration module for whatever script is being used.
- Gurmukhi: Lua error at line 20: package.lua:80: module 'Module:Guru-translit' not found. → Plantilya:xlit
- Shahmukhi: Lua error at line 20: package.lua:80: module 'Module:pa-Arab-translit' not found. → Plantilya:xlit
local export = {}
function export.tr(text, lang, sc, debug_mode)
if not sc then
sc = require("Module:scripts").findBestScript(text, require("Module:languages").getByCode(lang)):getCode()
end
local language_data = mw.loadData("Module:translit-redirect/data")[lang]
if language_data then
script_data = language_data[sc]
if script_data then
if script_data.module then
local success, translit_module = pcall(require, "Module:" .. script_data.module)
if success then
return translit_module.tr(text, lang, sc, debug_mode)
else
error(translit_module)
end
else
return nil
end
else
require("Module:debug").track{
"translit-redirect/incorrect-script/" .. lang,
"translit-redirect/incorrect-script/" .. lang .. "/" .. sc,
}
mw.log("script code (" .. sc .. ") for language code " .. lang .. " not found in Module:translit-redirect/data; text: " .. text)
end
end
end
return export