Die Dokumentation für dieses Modul kann unter Modul:Umschrift/Doku erstellt werden

-- Stand 25. Jul. 2023, 01:13
-- Erzeugt die lateinische Umschrift eines Textes in anderer Schriftart 
local Umschrift = {}

function Umschrift.main(frame)
	Zeichensatz = "homogen" -- Annahme homogener Zeichensatz in Übersetzung
	if (frame.args.Zs ~= nil) then
		if (frame.args.Zs == "inhomogen") then
			Zeichensatz = "inhomogen"
		end
	end
	Sprachkuerzel = frame.args.spr
	if (Sprachkuerzel == "ab") then
		return Umschrift.ab(frame.args[1])
	elseif (Sprachkuerzel == "abq") then
		return Umschrift.abq(frame.args[1])
	elseif (Sprachkuerzel == "ady") then
		return Umschrift.ady(frame.args[1])
	elseif (Sprachkuerzel == "alt") or (Sprachkuerzel == "atv") then
		return Umschrift.alt(frame.args[1])
	elseif (Sprachkuerzel == "av") then
		return Umschrift.av(frame.args[1])
	elseif (Sprachkuerzel == "ba") then
		return Umschrift.ba(frame.args[1])
	elseif (Sprachkuerzel == "be") then
		return Umschrift.be(frame.args[1])
	elseif (Sprachkuerzel == "bg") then
		return Umschrift.bg(frame.args[1])
	elseif (Sprachkuerzel == "bua") or (Sprachkuerzel == "bxr") then
		return Umschrift.bua(frame.args[1])
	elseif (Sprachkuerzel == "ce") then
		return Umschrift.ce(frame.args[1])
	elseif (Sprachkuerzel == "chm") then
		return Umschrift.chm(frame.args[1])
	elseif (Sprachkuerzel == "ckt") then
		return Umschrift.ckt(frame.args[1])
	elseif (Sprachkuerzel == "crh") then
		return Umschrift.crh(frame.args[1])
	elseif (Sprachkuerzel == "cv") then
		return Umschrift.cv(frame.args[1])
	elseif (Sprachkuerzel == "dng") then
		return Umschrift.dng(frame.args[1])
	elseif (Sprachkuerzel == "grc") then
		return Umschrift.grc(frame.args[1])
	elseif (Sprachkuerzel == "kbd") then
		return Umschrift.kbd(frame.args[1])
	elseif (Sprachkuerzel == "kca") then
		return Umschrift.kca(frame.args[1])
	elseif (Sprachkuerzel == "kk") then
		return Umschrift.kk(frame.args[1])
	elseif (Sprachkuerzel == "kv") then
		return Umschrift.kv(frame.args[1])
	elseif (Sprachkuerzel == "ky") then
		return Umschrift.ky(frame.args[1])
	elseif (Sprachkuerzel == "mdf") then
		return Umschrift.mdf(frame.args[1])
	elseif (Sprachkuerzel == "mk") then
		return Umschrift.mk(frame.args[1])
	elseif (Sprachkuerzel == "mn") then
		return Umschrift.mn(frame.args[1])
	elseif (Sprachkuerzel == "os") then
		return Umschrift.os(frame.args[1])
	elseif (Sprachkuerzel == "ru") then
		return Umschrift.ru(frame.args[1])
	elseif (Sprachkuerzel == "sah") then
		return Umschrift.sah(frame.args[1])
	elseif (Sprachkuerzel == "sh") or (Sprachkuerzel == "sr") or
	  (Sprachkuerzel == "bs") then
		return Umschrift.sh(frame.args[1], Sprachkuerzel)
	elseif (Sprachkuerzel == "tg") then
		return Umschrift.tg(frame.args[1])
	elseif (Sprachkuerzel == "tt") then
		return Umschrift.tt(frame.args[1])
	elseif (Sprachkuerzel == "tyv") then
		return Umschrift.tyv(frame.args[1])
	elseif (Sprachkuerzel == "udm") then
		return Umschrift.udm(frame.args[1])
	elseif (Sprachkuerzel == "uk") then
		return Umschrift.uk(frame.args[1])
	end
end

-- Erzeugt die lateinische Umschrift eines Textes in altgriechischer Schrift
-- gemäß DIN 31634 (siehe auch Wikipedia:Griechisches Alphabet)
function Umschrift.grc(str)
  local newstr = ""
  local newcp = 0
  local cp = 1
  local grb = "βΒδΔγΓϊΪκΚλΛμΜνΝπϖΠρῤϱΡσςΣτΤϋΫξΞζΖ;·Ϝϝ"
  local lat = "bBdDgGïÏkKlLmMnNppPrrrRssStTÿŸxXzZ?;Ww"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""
  local possible2 = "y"
  local first = ""
  local second = ""
  local endgef = 0
  local Blank = "%s" -- whitespace
  local blgef = 0
  local pgef = 0

  while cp <= strlen do
-- Blank und Interpunktionen abarbeiten
	first = mw.ustring.sub(str, cp, cp)
	while (cp <= strlen and (first == " " or mw.ustring.find(first, "%p", 1))) do
		if first == ";" then
			newstr = newstr .. "?"
		elseif first == "·" then
			newstr = newstr .. ";"
		else
			newstr = newstr .. first
		end
		cp = cp + 1
		first = mw.ustring.sub(str, cp, cp)
	end
-- Zahlschrift überprüfen
	if cp <= strlen - 1 then
		blgef = mw.ustring.find(mw.ustring.sub(str, cp, strlen), Blank, 1)
		pgef = mw.ustring.find(mw.ustring.sub(str, cp, strlen), "%p", 1)
		endgef = strlen + 1
		if (blgef) then endgef = cp + blgef - 1 end
		if (pgef) then
			if pgef < endgef then endgef = cp + pgef - 1 end
		end
		local cpend = endgef - 1
		if (mw.ustring.sub(str, cpend, cpend) == "ʹ" or
			mw.ustring.sub(str, cp, cp) == "͵") then
			-- Zahlschrift ermitteln
			newstr = newstr .. Umschrift.grcZZ(mw.ustring.sub(str, cp, cpend))
			cp = endgef
		end
	end
-- zweistellige Buchstabenkominationen
	if (cp + 1 <= strlen and possible2 == "y") then
		element = (mw.ustring.sub(str, cp, cp+1))
		first = (mw.ustring.sub(str, cp, cp))
		second = (mw.ustring.sub(str, cp+1, cp+1))
  		if (first == "α" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "au"
			cp = cp + 2
	  	elseif (first == "Α" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "Au" 
			cp = cp + 2
		elseif (element == "αϋ") then
	  		newstr = newstr .. "aÿ"
			cp = cp + 2
		elseif (element == "Αϋ") then
  			newstr = newstr .. "Aÿ"
			cp = cp + 2
		elseif (first == "α" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "hai"
			cp = cp + 2
		elseif (first == "Α" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "Hai"
			cp = cp + 2
		elseif (first == "ε" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "hei"
			cp = cp + 2
		elseif (first == "Ε" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "Hei"
			cp = cp + 2
		elseif (first == "ε" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
			newstr = newstr .. "heu"
			cp = cp + 2
		elseif (first == "Ε" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
			newstr = newstr .. "Heu" 
			cp = cp + 2
		elseif (first == "ε" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "eu"
			cp = cp + 2
		elseif (first == "Ε" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "Eu" 
			cp = cp + 2
  		elseif (element == "ηυ") then
			newstr = newstr .. "ēu"
			cp = cp + 2
	  	elseif (element == "Ηυ") then
			newstr = newstr .. "Ēu" 
			cp = cp + 2
		elseif (element == "γγ") then
			newstr = newstr .. "ng"
			cp = cp + 2
		elseif (element == "Γγ") then
			newstr = newstr .. "Ng"
			cp = cp + 2
		elseif (element == "γκ") then
			if (cp == 1 or (cp > 1 and mw.ustring.sub(str, cp-1, cp-1) == " ")) then
				newstr = newstr .. "gk"
			else
				newstr = newstr .. "nk"
			end
			cp = cp + 2
		elseif (element == "Γk") then
			if (cp == 1 or (cp > 1 and mw.ustring.sub(str, cp-1, cp-1) == " ")) then
				newstr = newstr .. "Gk"
			else
				newstr = newstr .. "Nk"
			end
			cp = cp + 2
		elseif (element == "γξ") then
	  		newstr = newstr .. "nx"
			cp = cp + 2
		elseif (element == "Γξ") then
	  		newstr = newstr .. "Nx"
			cp = cp + 2
		elseif (element == "γχ") then
	  		newstr = newstr .. "nch"
	  		cp = cp + 2
		elseif (element == "Γχ") then
	  		newstr = newstr .. "Nch"
	  		cp = cp + 2
		elseif (element == "ηυ") then
	  		newstr = newstr .. "ēu"
	  		cp = cp + 2
		elseif (element == "Ηυ") then
	  		newstr = newstr .. "Ēu"
	  		cp = cp + 2
		elseif (first == "η" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
	  		newstr = newstr .. "hēu"
	  		cp = cp + 2
		elseif (first == "Η" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
	  		newstr = newstr .. "Hēu"
	  		cp = cp + 2
		elseif (first == "ο" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "hoi"
			cp = cp + 2
		elseif (first == "Ο" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "Hoi"
			cp = cp + 2
		elseif (first == "ο" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
	  		newstr = newstr .. "hu"
	  		cp = cp + 2
		elseif (first == "Ο" and mw.ustring.find("ὑὕὓὗ", second, 1, true)) then
	  		newstr = newstr .. "Hu"
	  		cp = cp + 2
		elseif (first == "ο" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "u"
			cp = cp + 2
		elseif (first == "Ο" and mw.ustring.find("υύὺῠῡὐὔὒῦὖ", second, 1, true)) then
			newstr = newstr .. "U"
			cp = cp + 2
		elseif (first == "υ" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "hyi"
			cp = cp + 2
		elseif (first == "Υ" and mw.ustring.find("ἱἵἳἷ", second, 1, true)) then
			newstr = newstr .. "Hyi"
			cp = cp + 2
		elseif (element == "ῤῥ") then
	  		newstr = newstr .. "rrh"
	  		cp = cp + 2
	  	else
	  		possible2 = "n"
		end
	elseif (cp <= strlen) then
-- einzelne Buchstaben
		local h_erwartet = ""
		element = mw.ustring.sub(str, cp, cp)
		if (cp == 1) then
			h_erwartet = "j"
		else
			local zuvor = mw.ustring.sub(str, cp-1, cp-1)
			if (zuvor == " " or mw.ustring.find(zuvor, "%p", 1)) then
				h_erwartet = "j"
			end
		end
		if (element == "θ" or element == "ϑ") then
			newstr = newstr .. "th"
		elseif (element == "Θ" or element == "ϴ") then
			newstr = newstr .. "Th"
		elseif (mw.ustring.find("αάὰᾰᾱᾷἀἄἂᾆᾶᾳᾴᾲἆᾀᾄᾂ", element, 1, true)) then
			newstr = newstr .. "a"
		elseif (mw.ustring.find("ΑΆᾺᾸᾹἈἌἊᾎᾼἎᾈᾌᾊ", element, 1, true)) then
			newstr = newstr .. "A"
		elseif (mw.ustring.find("εέὲἐἔἒ", element, 1, true)) then
			newstr = newstr .. "e"
		elseif (mw.ustring.find("ΕΈῈἘἜἚ", element, 1, true)) then
			newstr = newstr .. "E"
		elseif (mw.ustring.find("ηήὴῇἠἤἢᾖῆῃῄῂἦᾐᾔᾒ", element, 1, true)) then
			newstr = newstr .. "ē"
		elseif (mw.ustring.find("ΗΉῊἨἬἪᾞῌἮᾘᾜᾚ", element, 1, true)) then
			newstr = newstr .. "Ē"
		elseif (mw.ustring.find("ἁἅἃᾇἇᾁᾅᾃ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "ha"
			else
				newstr = newstr .. "a"
			end
		elseif (mw.ustring.find("ἉἍἋᾏἏᾉᾍᾋ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "Ha"
			else
				newstr = newstr .. "A"
			end
		elseif (mw.ustring.find("ἑἕἓ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "he"
			else
				newstr = newstr .. "e"
			end
		elseif (mw.ustring.find("ἙἝἛ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "He"
			else
				newstr = newstr .. "E"
			end
		elseif (mw.ustring.find("ἡἥἣᾗἧᾑᾕᾓ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "hē"
			else
				newstr = newstr .. "ē"
			end
		elseif (mw.ustring.find("ἩἭἫᾟἯᾙᾝᾛ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "Hē"
			else
				newstr = newstr .. "Ē"
			end
		elseif (mw.ustring.find("ἱἵἳἷ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "hi"
			else
				newstr = newstr .. "i"
			end
		elseif (mw.ustring.find("ἹἽἻἿ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "Hi"
			else
				newstr = newstr .. "I"
			end
		elseif (mw.ustring.find("ὁὅὃ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "ho"
			else
				newstr = newstr .. "o"
			end
		elseif (mw.ustring.find("ὉὍὋ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "Ho"
			else
				newstr = newstr .. "O"
			end
		elseif (mw.ustring.find("ὡὥὣᾧὧᾡᾥᾣ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "hō"
			else
				newstr = newstr .. "ō"
			end
		elseif (mw.ustring.find("ὩὭὫᾯὯᾩᾭᾫ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "Hō"
			else
				newstr = newstr .. "Ō"
			end
		elseif (mw.ustring.find("ὑὕὓὗ", element, 1, true)) then
			if (h_erwartet ~= "") then
				newstr = newstr .. "hy"
			else
				newstr = newstr .. "y"
			end
		elseif (mw.ustring.find("ὙὝὛὟ", element, 1, true)) then
			if (cp == 1) then
				newstr = newstr .. "Hy"
			else
				newstr = newstr .. "Y"
			end
		elseif (mw.ustring.find("ιίὶῐῑἰἴἲῖἶ", element, 1, true)) then
			newstr = newstr .. "i"
		elseif (mw.ustring.find("ΙΊῚῘῙἸἼἺἾ", element, 1, true)) then
			newstr = newstr .. "I"
		elseif (mw.ustring.find("ΐῒῗ", element, 1, true)) then
			newstr = newstr .. "ï"
		elseif (mw.ustring.find("οόὸὀὄὂ", element, 1, true)) then
			newstr = newstr .. "o"
		elseif (mw.ustring.find("ΟΌῸὈὌὊ", element, 1, true)) then
			newstr = newstr .. "O"
		elseif (mw.ustring.find("ωώὼῷὠὤὢᾦῶῳῴὦᾠᾤᾢ", element, 1, true)) then
			newstr = newstr .. "ō"
		elseif (mw.ustring.find("ΩΏῺὨὬὪᾮῼὮᾨᾬᾪ", element, 1, true)) then
			newstr = newstr .. "Ō"
		elseif (element == "φ") then
			newstr = newstr .. "ph"
		elseif (element == "Φ") then
			newstr = newstr .. "Ph"
		elseif (element == "χ") then
			newstr = newstr .. "ch"
		elseif (element == "Χ") then
			newstr = newstr .. "Ch"
		elseif (element == "ψ") then
			newstr = newstr .. "ps"
		elseif (element == "Ψ") then
			newstr = newstr .. "Ps"
		elseif (element == "ῥ") then
			newstr = newstr .. "rh"
		elseif (element == "Ῥ") then
			newstr = newstr .. "Rh"
		elseif (mw.ustring.find("υύὺῠῡὐὔὒῦὖ", element, 1, true)) then
			newstr = newstr .. "y"
		elseif (mw.ustring.find("ΥΎῪῨῩ", element, 1, true)) then
			newstr = newstr .. "Y"
		elseif (mw.ustring.find("ϋΰῢῧ", element, 1, true)) then
			newstr = newstr .. "ÿ"
		else
			newcp = mw.ustring.find(grb, element, 1, true)
	  		if (newcp) then
	  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
	  		else
	  			j = mw.ustring.find(element, "%a", 1)
	  			if (j and Zeichensatz == "homogen") then
	  				newstr = newstr .. "■"
	  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Altgriechisch)]]"
	  			else	
	  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  			end
	  		end
		end
		cp = cp + 1
		possible2 = "y"
    end
  end
  return newstr .. Kat
end
-- Umschlüsselung altgriechischer Zahlzeichen in arabische Ziffern 
function Umschrift.grcZZ(str)
	local ZZ = "ΑΒΓΔΕϚΖΗΘΙΚΛΜΝΞΟΠϞΡΣΤΥΦΧΨΩϠ"
	local Zahlen = {1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900}
	local Suche = ""
	local strlen = mw.ustring.len(str)
	local mio = 0
	local tsd = 0
	local ezh = 0 -- Einer, Zehner, Hunderter
	local Summe = 0
	local Potenz_zuvor = -1
	local Potenz = 0
	local go_on = true
	local endcp = strlen
	local Bereich = ""
	local index = 0
	local cp = strlen
	if (mw.ustring.sub(str, cp, cp) == "ʹ") then
		cp = cp - 1
		while (cp >= 1 and go_on) do
			Suche = mw.ustring.upper(mw.ustring.sub(str,cp,cp))
			index = mw.ustring.find(ZZ, Suche, 1, true)
			if (index == nil) then
				if Suche == "Ϙ" then
					index = 18
				end
			end
			if (index) then
				Potenz = math.floor((index-1)/9)
				if Potenz_zuvor < 0 then
					ezh = Zahlen [index]
					cp = cp - 1
					Potenz_zuvor = Potenz
				elseif (Potenz > Potenz_zuvor) then
					if (cp == 1 or (cp > 1 and mw.ustring.sub(str, cp-1, cp-1) ~= "͵")) then
						ezh = ezh + Zahlen [index]
						cp = cp - 1
						Potenz_zuvor = Potenz
					else
						go_on = false -- Tausender- oder Million-Kennzeichen
					end
				else
					go_on = false -- vermutlicher Tausender-/Millionen-Wert 
				end
			else
				return "Falsches Zahlzeichen: " .. mw.ustring.sub(str,cp,cp)
			end
		end
		endcp = cp -- letztes Zeichen von Millionen oder Tausender
	end
	if cp >= 1 then
		cp = 1
		if mw.ustring.sub(str, 1, 1) ~= "͵" then
			return "Fehlendes Stellenwertsymbol am Beginn"
		end
	end
	while (cp > 0 and cp <= endcp) do
		if (mw.ustring.sub(str, cp, cp+1) == "͵͵" or 
			(mw.ustring.sub(str, cp, cp) ~= "͵" and Bereich == "M")) then -- Millionen
			if (mw.ustring.sub(str, cp, cp+1) == "͵͵") then cp = cp + 2 end
			Bereich = "M"
			Suche = mw.ustring.upper(mw.ustring.sub(str,cp,cp))
			index = mw.ustring.find(ZZ, Suche, 1, true)
			if (index == nil) then
				if Suche == "Ϙ" then
					index = 18
				end
			end
			if (index) then
				mio = mio + Zahlen [index]
				cp = cp + 1
			else
				return "Falsches Zahlzeichen: " .. mw.ustring.sub(str,cp,cp)
			end
		elseif (mw.ustring.sub(str, cp, cp) == "͵" or Bereich == "T") then -- Tausender
			if (mw.ustring.sub(str, cp, cp) == "͵") then cp = cp + 1 end
			Bereich = "T"
			Suche = mw.ustring.upper(mw.ustring.sub(str,cp,cp))
			index = mw.ustring.find(ZZ, Suche, 1, true)
			if (index == nil) then
				if Suche == "Ϙ" then
					index = 18
				end
			end
			if (index) then
				tsd = tsd + Zahlen [index]
				cp = cp + 1
			else
				return "Falsches Zahlzeichen: " .. mw.ustring.sub(str,cp,cp)
			end
		end
	end
	tsd = tsd * 1000
	mio = mio * 1000000
	Summe = mio + tsd + ezh
	Bereich = mw.ustring.format("%d", Summe)
	strlen = mw.ustring.len(Bereich)
	if strlen > 6 then
		return mw.ustring.sub(Bereich, 1, strlen-6) .. "." .. 
		mw.ustring.sub(Bereich, strlen-5, strlen-3) .. "." ..
		mw.ustring.sub(Bereich, strlen-2, strlen)
	elseif strlen > 4 then
		return mw.ustring.sub(Bereich, 1, strlen-3) .. "." ..
		mw.ustring.sub(Bereich, strlen-2, strlen)
	else
		return Bereich
	end
end

-- Erzeugt die lateinische Umschrift eines abasinischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.abq(str)
  local abqkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяӀӏ"
  local abqlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂ⇇"
  return Umschrift.ISO9(str,abqkyr,abqlat,"Abasinisch")
end

-- Erzeugt die lateinische Umschrift eines abchasischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ab(str)
  local abkyr = "АаБбВвГгӶӷДдЕеЖжЗзӠӡИиКкҚқЛлМмНнОоПпԤԥРрСсТтҬҭУуФфХхҲҳЦцЧчҶҷҼҽШшЫыҨҩь"
  local ablat = "AaBbVvGgĞğDdEeŽžZzŹźIiKkĶķLlMmNnOoPpṔṕRrSsTtŢţUuFfHhḨḩCcČčÇçČ芚YyÒòʹ"
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ҟ") then
		newstr = newstr .. "K̄"
	elseif (element == "ҟ") then
		newstr = newstr .. "k̄"
	elseif (element == "Ҵ") then
		newstr = newstr .. "C̄"
	elseif (element == "ҵ") then
		newstr = newstr .. "c̄"
	elseif (element == "Ҿ") then
		newstr = newstr .. "Č̦"
	elseif (element == "ҿ") then
		newstr = newstr .. "č̦"
	elseif (element == "Џ") then
		newstr = newstr .. "D̂"
	elseif (element == "џ") then
		newstr = newstr .. "d̂"
	elseif (element == "ә") then
		newstr = newstr .. "a̋"
	else
	  	newcp = (mw.ustring.find(abkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(ablat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Abchasisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines adygeischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ady(str)
  local adykyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяӀӏ"
  local adylat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂ⇇"
  return Umschrift.ISO9(str,adykyr,adylat,"Adygeisch")
end

-- Erzeugt die lateinische Umschrift eines süd- und nordaltaischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.alt(str)
  local altkyr = "АаБбВвГгДдјЕеЁёЖжЗзИиЙйКкЛлМмНнҤҥОоӦӧПпРрСсТтУуӰӱФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local altlat = "AaBbVvGgDďǰEeË뎞ZzIiJjKkLlMmNnṄṅOoÖöPpRrSsTtUuÜüFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""
  local Sprache = "Altaisch"
  if (Sprachkuerzel == "atv") then Sprache = "Nordaltaisch" end

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ј") then
		newstr = newstr .. "J̌"
	else
	  	newcp = (mw.ustring.find(altkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(altlat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (" .. Sprache .. ")]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines awarischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.av(str)
  local avkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяӀӏ"
  local avlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂ⇇"
  return Umschrift.ISO9(str,avkyr,avlat,"Awarisch")
end

-- Erzeugt die lateinische Umschrift eines weißrussischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe https://de.wikipedia.org/wiki/Kyrillisches_Alphabet#Belarussisch)
function Umschrift.be(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГ㥴ДдЕеЁёЖжЗзІіЙйКкЛлМмНнОоПпРрСсТтУуЎўФфЦцЧчШшЫыЭэ"
  local lat = "AaBbVvHhGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuŬŭFfCcČ芚YyĖė"
  local element = ""
  local j = 0
  local Kat = ""

  for cp = 1, mw.ustring.len(str) do
	element = (mw.ustring.sub(str, cp, cp))
  	if (element == "Ъ") or (element == "ъ") or (element == "’") then
  		newstr = newstr .. '"'
	elseif (element == "Ь") or (element == "ь") then
  		newstr = newstr .. "ʹ"
	elseif (element == "Х") then
  		newstr = newstr .. "Ch"
	elseif (element == "х") then
  		newstr = newstr .. "ch"
	elseif (element == "Ю") then
  		newstr = newstr .. "Ju"
	elseif (element == "ю") then
  		newstr = newstr .. "ju"
	elseif (element == "Я") then
  		newstr = newstr .. "Ja"
	elseif (element == "я") then
  		newstr = newstr .. "ja"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Weißrussisch)]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines baschkirischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ba(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local bakyr = "АаБбВвГгҒғДдЕеЁёЖжЗзИиЙйКкҠҡЛлМмНнҢңОоӨөПпРрСсҪҫТтУуҮүФфХхҺһЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local balat = "AaBbVvGgĠġDdEeË뎞ZzIiJjKkǨǩLlMmNnṆṇOoÔôPpRrSsȘșTtUuÙùFfHhḤḥCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ҙ") then
		newstr = newstr .. "Z̦"
	elseif (element == "ҙ") then
		newstr = newstr .. "z̦"
	elseif (element == "Ә") then
		newstr = newstr .. "A̋"
	elseif (element == "ә") then
		newstr = newstr .. "a̋"
	else
	  	newcp = (mw.ustring.find(bakyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(balat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Baschkirisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end


-- Erzeugt die lateinische Umschrift eines bulgarischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe Wiktionary:Kyrillisches Alphabet#Bulgarisch)
function Umschrift.bg(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГгДдЕеЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфЦцЧчШшЫы"
  local lat = "AaBbVvGgDdEeŽžZzIiJjKkLlMmNnOoPpRrSsTtUuFfCcČ芚Yy"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
  	if (element == "Ъ") then
		newstr = newstr .. "Ă" 
  	elseif (element == "ъ") then
		if (cp == strlen) then
			newstr = newstr .. '"'
		else
			newstr = newstr .. 'ă'
		end
	elseif (element == "Ь") or (element == "ь") then
  		newstr = newstr .. "ʹ"
	elseif (element == "Х") then
  		newstr = newstr .. "Ch"
	elseif (element == "х") then
  		newstr = newstr .. "ch"
	elseif (element == "Щ") then
  		newstr = newstr .. "Št"
	elseif (element == "щ") then
  		newstr = newstr .. "št"
	elseif (element == "Ю") then
  		newstr = newstr .. "Ju"
	elseif (element == "ю") then
  		newstr = newstr .. "ju"
	elseif (element == "Я") then
  		newstr = newstr .. "Ja"
	elseif (element == "я") then
  		newstr = newstr .. "ja"
	elseif (element == "Ѝ" ) then 
  		newstr = newstr .. "Ì"
	elseif (element == "ѝ" ) then 
  		newstr = newstr .. "ì"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Bulgarisch)]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines burjatischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.bua(str)
  local buakyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоӨөПпРрСсТтУуҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяҺһ"
  local bualat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoÔôPpRrSsTtUuÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâḤḥ"
  local Sprache = "Burjatisch"
  if (Sprachkuerzel == "bxr") then Sprache = "Russisches Burjatisch" end
  return Umschrift.ISO9(str,buakyr,bualat,Sprache)
end

-- Erzeugt die lateinische Umschrift eines tschetschenischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ce(str)
  local cekyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяӀӏ"
  local celat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂ⇇"
  return Umschrift.ISO9(str,cekyr,celat,"Tschetschenisch")
end

-- Erzeugt die lateinische Umschrift eines Mari Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.chm(str)
  local chmkyr = "АаӒӓБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнҤҥОоӦӧПпРрСсТтУуӰӱФфХхЦцЧчШшЩщЪъЫыӸӹЬьЭэЮюЯя"
  local chmlat = "AaÄäBbVvGgDdEeË뎞ZzIiJjKkLlMmNnṄṅOoÖöPpRrSsTtUuÜüFfHhCcČ芚ŜŝʺʺYyŸÿʹʹÈèÛûÂâ‵"
  return Umschrift.ISO9(str,chmkyr,chmlat,"Mari")
end

-- Erzeugt die lateinische Umschrift eines tschuktschischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ckt(str)
  local cktkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкӃӄЛлԒԓМмНнӇӈОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяʼ"
  local cktlat = "AaBbVvGgDdEeË뎞ZzIiJjKkḲḳLlĻļMmNnŇňOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYy’’ÈèÛûÂâ‵"
  return Umschrift.ISO9(str,cktkyr,cktlat,"Tschuktschisch")
end

-- Erzeugt die lateinische Umschrift eines krimtatarischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.crh(str)
  local crhkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local crhlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,crhkyr,crhlat,"Krimtatarisch")
end

-- Erzeugt die lateinische Umschrift eines tschuwaschischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.cv(str)
  local cvkyr = "АаӐӑБбВвГгДдЕеЁёӖӗЖжЗзИиЙйКкЛлМмНнОоПпРрСсҪҫТтУуӲӳФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local cvlat = "AaĂăBbVvGgDdEeËëĔĕŽžZzIiJjKkLlMmNnOoPpRrSsÇçTtUuŰűFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,cvkyr,cvlat,"Tschuwaschisch")
end

-- Erzeugt die lateinische Umschrift eines kabardinischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.kbd(str)
  local kbdkyr = "АаЭэБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЮюЯяӀӏ"
  local kbdlat = "AaÈèBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÛûÂ⇇"
  return Umschrift.ISO9(str,kbdkyr,kbdlat,"Kabardinisch")
end

-- Erzeugt die lateinische Umschrift eines chantischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.kca(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kcakyr = "АаӒӓӐӑБбВвГгДдЕеЁёӘәЖжЗзИиЙйКкӃӄЛлԒԓМмНнӇӈОоŎŏӦӧӨөӪӫПпРрСсТтУуӰӱЎўФфХхӼӽЦцЧчҶҷШшЩщЪъЫыЬьЭэЄєЮюЯя"
  local kcalat = "AaÄäĂăBbVvGgDdEeËëÀàŽžZzIiJjKkḲḳLlĻļMmNnṆṇOoŎŏÖöÔôŐőPpRrSsTtUuÜüŬŭFfHhḤḥCcČčÇ犚ŜŝʺʺYyʹʹÈèÊêÛûÂâ"
  kcakyr = kcakyr .. "ҚқӅӆҢңҲҳ" -- alternative Zeichen
  kcalat = kcalat .. "ĶķĻļṆṇḨḩ"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ӛ") then
		newstr = newstr .. "A̋"
	elseif (element == "ӛ") then
		newstr = newstr .. "a̋"
	elseif (element == "Є̈") then
		newstr = newstr .. "Ê̈̋"
	elseif (element == "є̈") then
		newstr = newstr .. "ê̈̋"
	elseif (element == "Ю̆") then
		newstr = newstr .. "Û̆"
	elseif (element == "ю̆") then
		newstr = newstr .. "û̆̋"
	elseif (element == "Я̆") then
		newstr = newstr .. "Û̆"
	elseif (element == "я̆̆") then
		newstr = newstr .. "û̆̋"
	else
	  	newcp = (mw.ustring.find(kcakyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(kcalat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Chantisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end
-- Erzeugt die lateinische Umschrift eines dunganischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.dng(str)
  local dngkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнҢңӘәОоПпРрСсТтУуЎўҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local dnglat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnṆṇÀàOoPpRrSsTtUuŬŭÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Җ") then
		newstr = newstr .. "Ž̧"
	elseif (element == "җ") then
		newstr = newstr .. "ž̧"
	else
	  	newcp = (mw.ustring.find(dngkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(dnglat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Dunganisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines kasachischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.kk(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kkkyr = "АаБбВвГгҒғДдЕеЁёЖжЗзИиЙйКкҚқЛлМмНнҢңОоӨөПпРрСсТтУуҰұҮүФфХхҺһЦцЧчШшЩщЪъЫыІіЬьЭэЮюЯя"
  local kklat = "AaBbVvGgĠġDdEeË뎞ZzIiJjKkĶķLlMmNnṆṇOoÔôPpRrSsTtUuÚúÙùFfHhḤḥCcČ芚ŜŝʺʺYyÌìʹʹÈèÛûÂâ"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ә") then
		newstr = newstr .. "A̋"
	elseif (element == "ә") then
		newstr = newstr .. "a̋"
	else
	  	newcp = (mw.ustring.find(kkkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(kklat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Kasachisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines Komi Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.kv(str)
  local kvkyr = "АаБбВвГгДдЕеЁёЖжЗзИиІіЙйКкЛлМмНнОоӦӧПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local kvlat = "AaBbVvGgDdEeË뎞ZzIiÌìJjKkLlMmNnOoÖöPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,kvkyr,kvlat,"Komi")
end

-- Erzeugt die lateinische Umschrift eines kirgisischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.ky(str)
  local kykyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнҢңОоӨөПпРрСсТтУуҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local kylat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnṆṇOoÔôPpRrSsTtUuÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,kykyr,kylat,"Kirgisisch")
end

-- Erzeugt die lateinische Umschrift eines mazedonischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe Wikipedia:Kyrillisches_Alphabet#Mazedonisch)
function Umschrift.mk(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГгДдЃѓЕеЖжЗзИиЈјКкЛлМмНнОоПпРрСсЌќТтУуФфХхЦцЧчШш"
  local lat = "AaBbVvGgDdǴǵEeŽžZzIiJjKkLlMmNnOoPpRrSsḰḱTtUuFfHhCcČ芚"
  local element = ""
  local j = 0
  local Kat = ""

  for cp = 1, mw.ustring.len(str) do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ѕ") then
  		newstr = newstr .. "Dz"
	elseif (element == "ѕ") then
  		newstr = newstr .. "dz"
	elseif (element == "ʼ") then
		newstr = newstr .. '"'
	elseif (element == "Џ") then
  		newstr = newstr .. "Dž"
	elseif (element == "џ") then
  		newstr = newstr .. "dž"
	elseif (element == "Њ") then
  		newstr = newstr .. "Nj"
	elseif (element == "њ") then
  		newstr = newstr .. "nj"
	elseif (element == "Љ") then
  		newstr = newstr .. "Lj"
	elseif (element == "љ") then
  		newstr = newstr .. "lj"
	elseif (element == "Ѝ" ) then 
  		newstr = newstr .. "Ì"
	elseif (element == "ѝ" ) then 
  		newstr = newstr .. "ì"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Mazedonisch)]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines mokschanischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.mdf(str)
  local mdfkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local mdflat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,mdfkyr,mdflat,"Mokscha")
end

-- Erzeugt die lateinische Umschrift eines mongolischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.mn(str)
  local mnkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоӨөПпРрСсТтУуҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local mnlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoÔôPpRrSsTtUuÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,mnkyr,mnlat,"Mongolisch")
end

-- Erzeugt die lateinische Umschrift eines ossetischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.os(str)
  local oskyr = "АаӔӕБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local oslat = "AaÆæBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,oskyr,oslat,"Ossetisch")
end

-- Erzeugt die lateinische Umschrift eines russischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe Wiktionary:Russisch/Umschrift)
function Umschrift.ru(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфЦцЧчШшЫыЭэ"
  local lat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnOoPpRrSsTtUuFfCcČ芚YyĖė"
  local element = ""
  local j = 0
  local Kat = ""

  for cp = 1, mw.ustring.len(str) do
	element = (mw.ustring.sub(str, cp, cp))
  	if (element == "Ъ") or (element == "ъ")  or (element == "’") then
  		newstr = newstr .. '"'
	elseif (element == "Ь") or (element == "ь") then
  		newstr = newstr .. "ʹ"
	elseif (element == "Х") then
  		newstr = newstr .. "Ch"
	elseif (element == "х") then
  		newstr = newstr .. "ch"
	elseif (element == "Щ") then
  		newstr = newstr .. "Šč"
	elseif (element == "щ") then
  		newstr = newstr .. "šč"
	elseif (element == "Ю") then
  		newstr = newstr .. "Ju"
	elseif (element == "ю") then
  		newstr = newstr .. "ju"
	elseif (element == "Я") then
  		newstr = newstr .. "Ja"
	elseif (element == "я") then
  		newstr = newstr .. "ja"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Russisch)]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines jakutischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.sah(str)
  local sahkyr = "АаБбВвГгҔҕДдЕеЁёЖжЗзИиЙйКкЛлМмНнҤҥОоӨөПпРрСсҺһТтУуҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local sahlat = "AaBbVvGgĞǧDdEeË뎞ZzIiJjKkLlMmNnṄṅOoÔôPpRrSsḤḥTtUuÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,sahkyr,sahlat,"Jakutisch")
end

-- Erzeugt die lateinische Umschrift eines serbokroatischen/serbischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe Wikipedia:Kyrillisches_Alphabet#Serbisch, Serbokroatisch und Montenegrinisch)
function Umschrift.sh(str, lan)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГгДдЂђЕеЖжЗзИиЈјКкЛлМмНнОоПпРрСсЌќТтЋћУуФфХхЦцЧчШш"
  local lat = "AaBbVvGgDdĐđEeŽžZzIiJjKkLlMmNnOoPpRrSsḰḱTtĆćUuFfHhCcČ芚"
  local element = ""
  local j = 0
  local Kat = ""
  local Sprache = ""

  for cp = 1, mw.ustring.len(str) do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Љ") then
  		newstr = newstr .. "Lj"
	elseif (element == "љ") then
  		newstr = newstr .. "lj"
	elseif (element == "Њ") then
  		newstr = newstr .. "Nj"
	elseif (element == "њ") then
  		newstr = newstr .. "nj"
	elseif (element == "Џ") then
  		newstr = newstr .. "Dž"
	elseif (element == "џ") then
  		newstr = newstr .. "dž"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				if (lan == "sr") then Sprache = "Serbisch"
  				elseif (lan == "sh") then Sprache = "Serbokroatisch"
  				elseif (lan == "bs") then Sprache = "Bosnisch"
  				end
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (" .. Sprache ..")]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines tadschikischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.tg(str)
  local tgkyr = "АаБбВвГгҒғДдЕеЁёЖжЗзИиӢӣЙйКкҚқЛлМмНнОоПпРрСсТтУуӮӯФфХхҲҳЧчҶҷШшЪъЭэЮюЯя"
  local tglat = "AaBbVvGgĠġDdEeË뎞ZzIiĪīJjKkĶķLlMmNnOoPpRrSsTtUuŪūFfHhḨḩČčÇ犚ʺʺÈèÛûÂâ"
  return Umschrift.ISO9(str,tgkyr,tglat,"Tadschikisch")
end

-- Erzeugt die lateinische Umschrift eines tatarischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.tt(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local ttkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнҢңОоӨөПпРрСсТтУуҮүФфХхҺһЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local ttlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnṆṇOoÔôPpRrSsTtUuÙùFfHhḤḥCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ә") then
		newstr = newstr .. "A̋"
	elseif (element == "ә") then
		newstr = newstr .. "a̋"
  	elseif (element == "Җ") then
		newstr = newstr .. "Ž̧"
  	elseif (element == "җ") then
		newstr = newstr .. "ž̧"
	else
	  	newcp = (mw.ustring.find(ttkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(ttlat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Tatarisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines tuwinischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.tyv(str)
  local tyvkyr = "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнҢңОоӨөПпРрСсТтУуҮүФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local tyvlat = "AaBbVvGgDdEeË뎞ZzIiJjKkLlMmNnṆṇOoÔôPpRrSsTtUuÙùFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  return Umschrift.ISO9(str,tyvkyr,tyvlat,"Tuwinisch")
end
-- Standardroutine für die Umsetzung von kyrillischen Texten gemäß ISO 9
function Umschrift.ISO9(Text,Kyrillisch,Latein,Sprache)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(Text)
  local j = 0
  local Kat = ""
  
  for cp = 1, strlen do
	element = (mw.ustring.sub(Text, cp, cp))
  	newcp = (mw.ustring.find(Kyrillisch, element, 1, true))
  	if (newcp) then
  		newstr = newstr .. (mw.ustring.sub(Latein, newcp, newcp))
  	else
  		j = mw.ustring.find(element, "%a", 1)
  		if (j and Zeichensatz == "homogen") then
  			newstr = newstr .. "■"
  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (" .. Sprache .. ")]]"
  		else	
  			newstr = newstr .. (mw.ustring.sub(Text, cp, cp))
  		end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines udmurtischen Textes in kyrillischer Schrift
-- gemäß ISO 9 (siehe Wikipedia:ISO 9)
function Umschrift.udm(str)
  local udmkyr = "АаБбВвГгДдЕеЁёЖжЗзИиӤӥЙйКкЛлМмНнОоӦӧПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
  local udmlat = "AaBbVvGgDdEeË뎞ZzIiÎîJjKkLlMmNnOoÖöPpRrSsTtUuFfHhCcČ芚ŜŝʺʺYyʹʹÈèÛûÂâ"
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
  local Kat = ""

  for cp = 1, strlen do
	element = (mw.ustring.sub(str, cp, cp))
	if (element == "Ӝ") then
		newstr = newstr .. "Z̄"
	elseif (element == "ӝ") then
		newstr = newstr .. "z̄"
	elseif (element == "Ӟ") then
		newstr = newstr .. "Z̈"
	elseif (element == "ӟ") then
		newstr = newstr .. "z̈"
	elseif (element == "Ӵ") then
		newstr = newstr .. "C̈"
	elseif (element == "ӵ") then
		newstr = newstr .. "c̈"
	else
	  	newcp = (mw.ustring.find(udmkyr, element, 1, true))
	  	if (newcp) then
	  		newstr = newstr .. (mw.ustring.sub(udmlat, newcp, newcp))
	  	else
	  		j = mw.ustring.find(element, "%a", 1)
	  		if (j and Zeichensatz == "homogen") then
	  			newstr = newstr .. "■"
	  			Kat = "[[Kategorie:Wartung falsche Übersetzungen (Udmurtisch)]]"
	  		else	
	  			newstr = newstr .. (mw.ustring.sub(str, cp, cp))
	  		end
	  	end
  	end
  end
  return newstr .. Kat
end

-- Erzeugt die lateinische Umschrift eines ukrainischen Textes in kyrillischer Schrift
-- gemäß DIN 1460 (siehe Wikipedia Kyrillisches_Alphabet#Ukrainisch)
function Umschrift.uk(str)
  local newstr = ""
  local newcp = 0
  local cp = 0
  local kyr = "АаБбВвГ㥴ДдЕеЁёЖжЗзИиІіЇїЙйКкЛлМмНнОоПпРрСсТтУуФфЦцЧчШш"
  local lat = "AaBbVvHhGgDdEeË뎞ZzYyIiÏïJjKkLlMmNnOoPpRrSsTtUuFfCcČ芚"
  local element = ""
  local j = 0
  local Kat = ""

  for cp = 1, mw.ustring.len(str) do
	element = (mw.ustring.sub(str, cp, cp))
  	if (element == "Ъ") or (element == "ъ")  or (element == "ʼ") then
  		newstr = newstr .. '"'
  	elseif (element == "Є") then
  		newstr = newstr .. "Je"
  	elseif (element == "є") then
  		newstr = newstr .. "je"
	elseif (element == "Ь") or (element == "ь") then
  		newstr = newstr .. "ʹ"
	elseif (element == "Х") then
  		newstr = newstr .. "Ch"
	elseif (element == "х") then
  		newstr = newstr .. "ch"
	elseif (element == "Щ") then
  		newstr = newstr .. "Šč"
	elseif (element == "щ") then
  		newstr = newstr .. "šč"
	elseif (element == "Ю") then
  		newstr = newstr .. "Ju"
	elseif (element == "ю") then
  		newstr = newstr .. "ju"
	elseif (element == "Я") then
  		newstr = newstr .. "Ja"
	elseif (element == "я") then
  		newstr = newstr .. "ja"
  	else
  		newcp = (mw.ustring.find(kyr, element, 1, true))
  		if (newcp) then
  			newstr = newstr .. (mw.ustring.sub(lat, newcp, newcp))
  		else
  			j = mw.ustring.find(element, "%a", 1)
  			if (j and Zeichensatz == "homogen") then
  				newstr = newstr .. "■"
  				Kat = "[[Kategorie:Wartung falsche Übersetzungen (Ukrainisch)]]"
  			else	
  				newstr = newstr .. (mw.ustring.sub(str, cp, cp))
  			end
  		end
    end
  end
  return newstr .. Kat
end

return Umschrift