Module:Runr-translit
Jump to navigation
Jump to search
- The following documentation is located at Module:Runr-translit/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Runic script in Proto-Norse (gmq-pro
), Old English (ang
) and Old Norse (non
). It is used to transliterate Old English, Proto-Norse, Old High German, and Old Norse.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{xlit}}
.
Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:Runr-translit/testcases.
Functions
tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When the transliteration fails, returns
nil
. - The language code is necessary because some letters are transliterated slightly differently depending on the language.
local export = {}
local letters = {}
local export = {}
local letters = {}
-- Elder futhark
letters["gmq-pro"] = {
["ᚠ"]='f',
["ᚢ"]='u',
["ᚦ"]='þ',
["ᚨ"]='a',
["ᚱ"]='r',
["ᚲ"]='k', ["ᚳ"]='k', ['ᚴ']='k',--transitional period
["ᚷ"]='g',
["ᚹ"]='w',
["ᚺ"]='h', ["ᚻ"]='h',
["ᚾ"]='n',
["ᛁ"]='i',
["ᛃ"]='j', ["ᛡ"]='ᴀ',--transitional period
["ᛇ"]='ï',
["ᛈ"]='p',
["ᛉ"]='ʀ', ["ᛦ"]='ʀ',--transitional period
["ᛊ"]='s', ["ᛋ"]='s',
["ᛏ"]='t',
["ᛒ"]='b',
["ᛖ"]='e',
["ᛗ"]='m',
["ᛚ"]='l',
["ᛜ"]='ŋ', ["ᛝ"]="ŋ",
["ᛟ"]='o',
["ᛞ"]='d',
["᛫"]='·', ["᛬"]=':'
}
-- Old High German
letters["goh"] = {
["ᚠ"]='f',
["ᚢ"]='u',
["ᚦ"]='þ',
["ᚨ"]='a',
["ᚱ"]='r',
["ᚲ"]='k', ["ᚳ"]='k', ['ᚴ']='k',
["ᚷ"]='g',
["ᚹ"]='w',
["ᚺ"]='h', ["ᚻ"]='h',
["ᚾ"]='n',
["ᛁ"]='i',
["ᛃ"]='j',
["ᛇ"]='ï',
["ᛈ"]='p',
["ᛊ"]='s', ["ᛋ"]='s',
["ᛏ"]='t',
["ᛒ"]='b',
["ᛖ"]='e',
["ᛗ"]='m',
["ᛚ"]='l',
["ᛜ"]='ŋ', ["ᛝ"]="ŋ",
["ᛟ"]='o',
["ᛞ"]='d'
}
-- Anglo-Saxon futhorc
letters["ang"] = {
["ᚠ"]="f",
["ᚢ"]="u",
["ᚦ"]="þ",
["ᚩ"]="ó",
["ᚱ"]="r",
["ᚳ"]="c",
["ᚷ"]="ġ",["ᚸ"]="g",
["ᚹ"]="w",
["ᚺ"]='h', ["ᚻ"]='h',
["ᚾ"]="n",
["ᛁ"]="i",
["ᛄ"]="j",
["ᛇ"]="eo",
["ᛈ"]="p",
["ᛉ"]="x",
["ᛋ"]="s",
["ᛏ"]="t",
["ᛒ"]="b",
["ᛖ"]="e",
["ᛗ"]="m",
["ᛚ"]="l",
["ᛜ"]='ŋ', ["ᛝ"]="ŋ",
["ᛟ"]="œ",
["ᛞ"]="d",
["ᚪ"]="a",
["ᚫ"]="æ",
["ᚣ"]="y",
["ᛡ"]="io",
["ᛠ"]="ea"
}
-- Younger futhark, including later stung or otherwise modified variants
letters["non"] = {
["ᚠ"]="f", ["ᚡ"]="v",
["ᚢ"]="u", ["ᚤ"]="y",
["ᚦ"]="þ", ["ᚧ"]="ð",
["ᚬ"]="ą", ["ᚭ"]="ą", ["ᚨ"]="ą", ["ᚮ"]="o", ["ᚯ"]="ø", ["ᚰ"]="ǫ",
["ᚱ"]="r",
["ᚴ"]="k", ["ᚵ"]="g",
["ᚼ"]="h", ["ᚽ"]="h",
["ᚾ"]="n", ["ᚿ"]="n",
["ᛁ"]="i", ["ᛂ"]="e",
["ᛅ"]="a", ["ᛆ"]="a", ["ᛡ"]='ᴀ',
["ᛋ"]="s", ["ᛌ"]="s",
["ᛏ"]="t", ["ᛐ"]="t", ["ᛑ"]="d",
["ᛒ"]="b", ["ᛓ"]="b", ["ᛕ"]="p", ["ᛔ"]="p",
["ᛘ"]="m", ["ᛙ"]="m",
["ᛚ"]="l",
["ᛦ"]="ʀ", ["ᛧ"]="ʀ",
--certain Elder Futhark letters exist in early Old Norse inscriptions
["ᚷ"]='ɢ',
["ᚹ"]='w',
["ᚺ"]='ʜ',
["ᛖ"]='ᴇ',
["ᛗ"]='ᴍ',
["ᛞ"]='ᴅ',
["ᛟ"]='ᴏ'
}
-- Old Danish
letters["gmq-oda"] = {
["ᚠ"]="f", ["ᚡ"]="v",
["ᚢ"]="u", ["ᚤ"]="y",
["ᚦ"]="þ", ["ᚧ"]="ð",
["ᚮ"]="o", ["ᚯ"]="ø",
["ᚱ"]="r",
["ᚴ"]="k", ["ᚵ"]="g",
["ᚼ"]="h", ["ᚽ"]="h",
["ᚾ"]="n", ["ᚿ"]="n",
["ᛁ"]="i", ["ᛂ"]="e",
["ᛅ"]="æ", ["ᛆ"]="a",
["ᛋ"]="s", ["ᛌ"]="s",
["ᛏ"]="t", ["ᛐ"]="t", ["ᛑ"]="d",
["ᛒ"]="b", ["ᛓ"]="b", ["ᛕ"]="p", ["ᛔ"]="p",
["ᛘ"]="m", ["ᛙ"]="m",
["ᛚ"]="l",
["ᛦ"]="y", ["ᛧ"]="ʀ",
}
function export.tr(text, lang, sc)
if letters[lang] then
return (mw.ustring.gsub(text, ".", letters[lang]))
end
return nil
end
return export