Modulo:ErsetzeZeichen
MODULO | ||
Memtesto ne disponeblas. |
- rilata al germana lingvo, konvertas tekston kun umlaŭtoj por uzo en referencaj ŝablonoj
--[[
Dieses Modul ersetzt in Referenzvorlagen bestimmte Zeichen durch andere,
z.B. die Umlaute ä, ö, ü, Ä, Ö, Ü durch ae, oe, ue, Ae, Oe, Ue
oder das scharfe ß durch ss bzw. sz.
]]
local export = {}
-- this function enables the module to be called from a template
function export.main(frame)
if type(export[frame.args[1]]) == 'function' then
return export[frame.args[1]](frame.args[2], frame.args[3])
else
return export[frame.args[1]][frame.args[2]]
end
end
function export.convert_to_ss(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "ss")
return word
end
function export.convert_to_sz(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "sz")
return word
end
function export.duden(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "sz")
word = mw.ustring.gsub(word, "-", "_")
word = mw.ustring.gsub(word, "%.", "_")
word = mw.ustring.gsub(word, "’", "_")
word = mw.ustring.gsub(word, ",", "_")
word = mw.ustring.gsub(word, " ", "_")
word = mw.ustring.gsub(word, "!", "_")
word = mw.ustring.gsub(word, "à", "a") -- à la carte
word = mw.ustring.gsub(word, "ã", "a") -- São Tomé und Príncipe
word = mw.ustring.gsub(word, "å", "a") -- Bokmål
word = mw.ustring.gsub(word, "é", "e") -- Negligé
word = mw.ustring.gsub(word, "É", "E") -- Belle Époque
word = mw.ustring.gsub(word, "è", "e") -- Hotelière
word = mw.ustring.gsub(word, "î", "i")
word = mw.ustring.gsub(word, "í", "i") -- São Tomé und Príncipe
word = mw.ustring.gsub(word, "ñ", "n") -- Cariñena
word = mw.ustring.gsub(word, "ô", "o") -- Côte d’Ivoire
word = mw.ustring.gsub(word, "Œ", "O") -- Œuvre
word = mw.ustring.gsub(word, "ū", "u")
return word
end
function export.dwds(word)
word = mw.ustring.gsub(word, " ", "+")
word = mw.ustring.gsub(word, "*", "*") -- -bräu
return word
end
function export.gabler(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "ss")
word = mw.ustring.gsub(word, " ", "-")
return word
end
function export.meyers(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "ss")
word = mw.ustring.gsub(word, " ", "_")
return word
end
function export.wissende(word)
word = mw.ustring.gsub(word, "ä", "ae")
word = mw.ustring.gsub(word, "ö", "oe")
word = mw.ustring.gsub(word, "ü", "ue")
word = mw.ustring.gsub(word, "Ä", "Ae")
word = mw.ustring.gsub(word, "Ö", "Oe")
word = mw.ustring.gsub(word, "Ü", "Ue")
word = mw.ustring.gsub(word, "ß", "ss")
word = mw.ustring.gsub(word, " ", "-")
word = mw.ustring.gsub(word, "à", "a") -- à la carte
word = mw.ustring.gsub(word, "ã", "a") -- São Tomé und Príncipe
word = mw.ustring.gsub(word, "é", "e") -- Negligé
word = mw.ustring.gsub(word, "É", "E") -- Belle Époque
word = mw.ustring.gsub(word, "î", "i") -- Maître de Plaisir
word = mw.ustring.gsub(word, "ñ", "n") -- El Niño
word = mw.ustring.gsub(word, "ô", "o") -- Côte d’Ivoire
word = mw.ustring.gsub(word, "Œ", "Oe") -- Œuvre
word = mw.ustring.gsub(word, "ū", "u")
return word
end
function export.bindestr(word) -- Ref-Oxford, Ref-Longman, Ref-MacMillan
word = mw.ustring.gsub(word, " ", "-")
return word
end
function export.iso8859_1(word) -- UTF-8 nach ISO-8859-1 für: Ref-Orðabók Háskólans, Ref-IcelandicOnlineDictionary u.a.
-- 0xC0-CF: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
word = mw.ustring.gsub(word, "À", "%%C0")
word = mw.ustring.gsub(word, "Á", "%%C1")
word = mw.ustring.gsub(word, "Â", "%%C2")
word = mw.ustring.gsub(word, "Ã", "%%C3")
word = mw.ustring.gsub(word, "Ä", "%%C4")
word = mw.ustring.gsub(word, "Å", "%%C5")
word = mw.ustring.gsub(word, "Æ", "%%C6")
word = mw.ustring.gsub(word, "Ç", "%%C7")
word = mw.ustring.gsub(word, "È", "%%C8")
word = mw.ustring.gsub(word, "É", "%%C9")
word = mw.ustring.gsub(word, "Ê", "%%CA")
word = mw.ustring.gsub(word, "Ë", "%%CB")
word = mw.ustring.gsub(word, "Ì", "%%CC")
word = mw.ustring.gsub(word, "Í", "%%CD")
word = mw.ustring.gsub(word, "Î", "%%CE")
word = mw.ustring.gsub(word, "Ï", "%%CF")
-- 0xD0-DF: ÐÑÒÓÔÕÖ ØÙÚÛÜÝÞß
word = mw.ustring.gsub(word, "Ð", "%%D0")
word = mw.ustring.gsub(word, "Ñ", "%%D1")
word = mw.ustring.gsub(word, "Ò", "%%D2")
word = mw.ustring.gsub(word, "Ó", "%%D3")
word = mw.ustring.gsub(word, "Ô", "%%D4")
word = mw.ustring.gsub(word, "Õ", "%%D5")
word = mw.ustring.gsub(word, "Ö", "%%D6")
word = mw.ustring.gsub(word, "Ø", "%%D8")
word = mw.ustring.gsub(word, "Ù", "%%D9")
word = mw.ustring.gsub(word, "Ú", "%%DA")
word = mw.ustring.gsub(word, "Û", "%%DB")
word = mw.ustring.gsub(word, "Ü", "%%DC")
word = mw.ustring.gsub(word, "Ý", "%%DD")
word = mw.ustring.gsub(word, "Þ", "%%DE")
word = mw.ustring.gsub(word, "ß", "%%DF")
-- 0xE0-EF: àáâãäåæçèéêëìíîï
word = mw.ustring.gsub(word, "à", "%%E0")
word = mw.ustring.gsub(word, "á", "%%E1")
word = mw.ustring.gsub(word, "â", "%%E2")
word = mw.ustring.gsub(word, "ã", "%%E3")
word = mw.ustring.gsub(word, "ä", "%%E4")
word = mw.ustring.gsub(word, "å", "%%E5")
word = mw.ustring.gsub(word, "æ", "%%E6")
word = mw.ustring.gsub(word, "ç", "%%E7")
word = mw.ustring.gsub(word, "è", "%%E8")
word = mw.ustring.gsub(word, "é", "%%E9")
word = mw.ustring.gsub(word, "ê", "%%EA")
word = mw.ustring.gsub(word, "ë", "%%EB")
word = mw.ustring.gsub(word, "ì", "%%EC")
word = mw.ustring.gsub(word, "í", "%%ED")
word = mw.ustring.gsub(word, "î", "%%EE")
word = mw.ustring.gsub(word, "ï", "%%EF")
-- 0xF0-FF: ðñòóôõö øùúûüýþÿ
word = mw.ustring.gsub(word, "ð", "%%F0")
word = mw.ustring.gsub(word, "ñ", "%%F1")
word = mw.ustring.gsub(word, "ò", "%%F2")
word = mw.ustring.gsub(word, "ó", "%%F3")
word = mw.ustring.gsub(word, "ô", "%%F4")
word = mw.ustring.gsub(word, "õ", "%%F5")
word = mw.ustring.gsub(word, "ö", "%%F6")
word = mw.ustring.gsub(word, "ø", "%%F8")
word = mw.ustring.gsub(word, "ù", "%%F9")
word = mw.ustring.gsub(word, "ú", "%%FA")
word = mw.ustring.gsub(word, "û", "%%FB")
word = mw.ustring.gsub(word, "ü", "%%FC")
word = mw.ustring.gsub(word, "ý", "%%FD")
word = mw.ustring.gsub(word, "þ", "%%FE")
word = mw.ustring.gsub(word, "ÿ", "%%FF")
return word
end
return export