This module holds data indicating how to transform symbols/shortcuts into characters of the language in question. The data is used by Module:typing-aids and made available through {{chars}}
. The return value of a module is a table holding replacements, in one of the following forms:
This format is preferred, because it clearly specifies the order in which the replacements will happen. Each replacement is itself a two-element list { "FROM", "TO", before = "BEFORE_CONDITION", after = "AFTER_CONDITION" }
:
"FROM"
is a Lua pattern indicating what to replace;"TO"
is a Lua replacement expression, which can include references to parenthesized groups in the pattern, e.g. %1
to refer to the first parenthesized group;before = "BEFORE_CONDITION"
is a Lua pattern, and the replacement will only happen if the specified pattern occurs before the symbol being replaced;after = "AFTER_CONDITION"
is a Lua pattern, and the replacement will only happen if the specified pattern occurs after the symbol being replaced.Both before
and after
are optional.
The order in which the replacements happen is top-to-bottom.
In this format, the key is a string (a Lua pattern indicating what to replace) and the value is either a string (a Lua replacement expression), or a table of the format { "REPLACEMENT", before = "BEFORE_CONDITION", after = "AFTER_CONDITION" }
, where before
and after
are as above, and both are optional.
The order in which the replacements happen is undetermined; as a result, this format is dispreferred.
In this format, the return value consists of multiple key-value tables as in the second format above. All replacements in the first table happen before those in the second table, but the order in which the replacements happen in a given table is still undetermined; as a result, this format is also dispreferred.
Replacements for some languages are found in subpages:
local U = require("Module:string utilities").char
local stops = "PpBbTtDdKkGgQq"
local velars = "GgKk"
local diacritics = "_%^\'0"
local vowels = "AaEeIiOoUu"
local sonorants = "RrLlMmNn"
local not_laryngeal_numbers = ""
local ProtoGreekpalatalized = "TtDdLlNnRr"
local ProtoGreekaspirated = "PpTtKk"
local acute = U(0x0301)
local data = {}
data = {
= "h₁",
= "h₂",
= "h₃",
= "ə₁",
= "ə₂",
= "ə₃",
= "ē₂",
= "ʷ",
= "ʷ",
= "ʰ",
= "ʰ",
= { "ʷʰ", before = "", after = not_laryngeal_numbers, },
= { "ʰ", before = "", after = not_laryngeal_numbers, },
= { "ʷ", before = "", },
= "ₔ", -- sometimes used for the schwa secundum
= U(0x304), -- macron
= { U(0x302), before = "?", }, -- circumflex
= { U(0x301), before = "?", }, -- acute
= { U(0x325), before = "?", }, -- ring below
= { U(0x328), before = "?", }, -- ogonek
= "þ",
= "Þ",
= "ə",
= { U(0x30C), before = "", }, -- caron
= "⁓", -- swung dash
}
data = {
= {
= "h₁",
= "h₂",
= "h₃",
= "ə₁",
= "ə₂",
= "ə₃",
= "ʷ",
= "ʷ",
= "ʰ",
= "ʰ",
= { "ʷʰ", before = "", after = not_laryngeal_numbers, },
= { "ʰ", after = not_laryngeal_numbers, },
= { "ʷ", before = "", },
= "ₔ", -- sometimes used for the schwa secundum
= { U(0x301), before = "?", }, -- acute
= { U(0x304), before = "?", }, -- macron
= { U(0x325), before = "?", }, -- ring below
= "⁓", -- swung dash
= { U(0x311), before = "", }, -- inverted breve above
},
= {
= { U(0x32F), before = "", }, -- inverted breve above
},
}
data = data
data = {
= "ē₂",
= { U(0x328), before = "?", }, -- ogonek
= "þ",
= "Þ",
= { U(0x304), before = "?", }, -- macron
= { U(0x302), before = "?", }, -- circumflex
}
data = data
data = {
= {
= { U(0x304) .. U(0x301), before = "", }, -- macron and acute
= { U(0x304) .. U(0x301), before = "", }, -- macron and acute
= { "ʷʰ", before = "", },
= { "ʷʰ", before = "", },
= { U(0x30C), before = "", }, -- caron
},
= {
= U(0x30C), -- caron
= "ə",
= { U(0x304), before = "?", }, -- macron
= { U(0x301), before = "*", }, -- acute
= { "ʰ", before = "", },
= { "ʷ", before = "", },
}
}
data = data
data = {
= {
= "Ё",
= "ё",
= "Ю",
= "ю",
= "Я",
= "я",
= "Ч",
= "ч",
= "Ш",
= "ш",
= "й",
},
= {
= "А",
= "а",
= "Б",
= "б",
= "В",
= "в",
= "Г",
= "г",
= "Д",
= "д",
= "Е",
= "е",
= "Ж",
= "ж",
= "З",
= "з",
= "И",
= "и",
= "Й",
= "й",
= "К",
= "к",
= "Л",
= "л",
= "М",
= "м",
= "Н",
= "н",
= "О",
= "о",
= "П",
= "п",
= "Р",
= "р",
= "С",
= "с",
= "Т",
= "т",
= "У",
= "у",
= "Ф",
= "ф",
= "Х",
= "х",
= "Ц",
= "ц",
= "Щ",
= "щ",
= "Ъ",
= "ъ",
= "Ы",
= "ы",
= "Ь",
= "ь",
= "Э",
= "э",
= U(0x301), -- acute
},
}
--[[
The shortcut (or regex search pattern) is enclosed in ,
and the replacement is enclosed in quotes after the equals sign:
= "replacement",
if the shortcut includes a parenthesis "()",
the replacement will contain a capture string "%1" or "%2",
which matches the contents of first or second parenthesis.
]]
data.acute_decomposer = {
= "a" .. acute,
= "e" .. acute,
= "i" .. acute,
= "o" .. acute,
= "u" .. acute,
= "y" .. acute,
= "ē" .. acute,
= "ō" .. acute,
= "A" .. acute,
= "E" .. acute,
= "I" .. acute,
= "O" .. acute,
= "U" .. acute,
= "Y" .. acute,
= "Ē" .. acute,
= "Ō" .. acute,
}
--[=[
If table is an array, the first string is the subpage of
] that contains the language's replacements; the
second is the index of the field in the exported table of that module that
contains the language's replacements.
Otherwise, the table contains fields for particular scripts, specifying the
module used when the |sc= parameter is set to that script code, as well as a
"default" field for cases where no script has been specified.
]=]
data.modules = {
= { "ae", "ae", },
= { "ae", "ae", },
= { "ae", "ae", },
= { "ae", "ae-tr", },
= { "akk", "akk-tr" },
= { "ar" },
= { default = "Armi", Palm = "Palm" },
= { default = "Armi", Palm = "Palm" },
= { "Palm", "Palm"},
= { "bho", "bho" },
= { "bho", "bho-tr" },
= { "bho", "bho" },
= { "bho", "bho-tr" },
= { "Cyrs" },
= { "fa" },
= { "fa" },
= { "fa" },
= { "gmy" },
-- = { "gmy", "gmy-tr" },
= { "got", "got" },
= { "got", "got-tr" },
= { "grc" },
= { "hit", "hit" },
= { "hit", "hit-tr" },
= { "hy", "hy", },
= { "hy", "hy-tr", },
= { "ja", "ja" },
= { "kn", "kn" },
= { "kn", "kn-tr" },
= { "Mani", "Mani-tr" },
= { "Narb", "Narb"},
= { "Narb", "Narb-tr"},
= { default = "Phlv", Phli = "Phli", Mani = "Mani" },
= { "Phnx" },
= { "Cyrs" },
= { "os" },
= { "os" },
= { "os" },
= { "Orkh" },
= { "oty" },
= { "peo" },
= { "Phli", "Phli-tr" },
= { "Prti", "Prti-tr" },
= { "mai", "mai" },
= { "mai", "mai-tr" },
= { "mwr", "mwr" },
= { "mwr", "mwr-tr" },
= { "omr", "omr" },
= { "omr", "omr-tr" },
= { "pra", "pra" },
= { "pra", "pra-tr" },
= { "sa-Sidd", "sa-Sidd" },
= { "sa-Sidd", "sa-Sidd-tr" },
= { "bho", "bho" },
= { "bho", "bho-tr" },
= { "pra", "pra" },
= { "pra", "pra-tr" },
= { "pra-Deva", "pra-Deva" },
= { "pra-Deva", "pra-Deva-tr" },
= { "pra-Knda", "pra-Knda" },
= { "pra-Knda", "pra-Knda-tr" },
= { "doi", "doi" },
= { "doi", "doi-tr" },
= { "sa-Gujr", "sa-Gujr" },
= { "sa-Gujr", "sa-Gujr-tr" },
= { "bho", "bho" },
= { "bho", "bho-tr" },
= { "sa-Modi", "sa-Modi" },
= { "sa-Modi", "sa-Modi-tr" },
= { "sa-Shrd", "sa-Shrd" },
= { "sa-Shrd", "sa-Shrd-tr" },
= { "sa-Sidd", "sa-Sidd" },
= { "sa-Sidd", "sa-Sidd-tr" },
= { "omr-Deva", "omr-Deva" },
= { "omr-Deva", "omr-Deva-tr" },
= { "psu", "psu" },
= { "sa", "sa" },
= { "sa", "sa-tr" },
= { "Sarb", "Sarb"},
= { "Sarb", "Sarb-tr"},
= { "saz", "saz" },
= { "saz", "saz-tr" },
= { "sd", "sd" },
= { "sd", "sd-tr" },
= { "Narb", "Narb" },
= { "sgh-Cyrl"},
= { "skr", "skr" },
= { "skr", "skr-tr" },
= { default = "Sogd", Mani = "Mani", Sogo = "Sogo" },
= { "Sogd", "Sogd-tr" },
= { "Sogo", "Sogo-tr" },
= { "sux" },
= { "Ugar" },
= { default = "el", Mani = "Mani" },
= { default = "Mani" },
= { default = "Chrs" },
= { "Sarb", "Sarb" },
= { "yah-Cyrl"},
-- = { "" },
}
return data