Module:zza-sortkey
Appearance
- The following documentation is located at Module:zza-sortkey/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will sort Zazaki language text.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{sortkey}}.
Within a module, use Module:languages#Language:makeSortKey.
For testcases, see Module:zza-sortkey/testcases.
Functions
makeSortKey(text, lang, sc)- Generates a sortkey for a given piece of
textwritten in the script specified by the codesc, and language specified by the codelang. - When the sort fails, returns
nil.
local export = {}
local u = mw.ustring.char
local a, b = u(0xF000), u(0xF001)
local oneChar = {
["ç"] = "c" .. a, ["ê"] = "e" .. a, ["ğ"] = "g" .. a, ["ı"] = "i", ["î"] = "i" .. b, ["ş"] = "s" .. a, ["û"] = "u" .. a
}
function export.makeSortKey(text, lang, sc)
text = mw.ustring.gsub(mw.ustring.lower(mw.ustring.gsub(text, "I", "ı")), "i", "i" .. a) -- ensure "i" comes after "ı"
return mw.ustring.upper(mw.ustring.gsub(text, ".", oneChar))
end
return export