Threat Plates

Threat Plates

31M Downloads

Is it possible to add an option to transliterate names written in cyrllic?

DavidPHH opened this issue · 6 comments

commented

I tried digging around to see if I could do it for myself but I'm not familiar enough with addons to do so.
The problem:
Names written with cyrillic appear as [][][][][]
image

Some addons such as grid2 offer an option to transliterate these names, so that something like player named Влади́мир that would usually show up as [][][][][][][][] shows as Vladimir instead.

If anyone knows where something like this could be slotted in (if it's even possible) it would be great

function transliterate(s)
    local sub = 
      {
		["А"] = "A", ["а"] = "a", ["Б"] = "B", ["б"] = "b", ["В"] = "V", ["в"] = "v", ["Г"] = "G", ["г"] = "g", ["Д"] = "D", ["д"] = "d", ["Е"] = "E",
		["е"] = "e", ["Ё"] = "e", ["ё"] = "e", ["Ж"] = "Zh", ["ж"] = "zh", ["З"] = "Z", ["з"] = "z", ["И"] = "I", ["и"] = "i", ["Й"] = "Y", ["й"] = "y",
		["К"] = "K", ["к"] = "k", ["Л"] = "L", ["л"] = "l", ["М"] = "M", ["м"] = "m", ["Н"] = "N", ["н"] = "n", ["О"] = "O", ["о"] = "o", ["П"] = "P",
		["п"] = "p", ["Р"] = "R", ["р"] = "r", ["С"] = "S", ["с"] = "s", ["Т"] = "T", ["т"] = "t", ["У"] = "U", ["у"] = "u", ["Ф"] = "F", ["ф"] = "f",
		["Х"] = "Kh", ["х"] = "kh", ["Ц"] = "Ts", ["ц"] = "ts", ["Ч"] = "Ch", ["ч"] = "ch", ["Ш"] = "Sh", ["ш"] = "sh", ["Щ"] = "Shch",	["щ"] = "shch",
		["Ъ"] = "", ["ъ"] = "", ["Ы"] = "Y", ["ы"] = "y", ["Ь"] = "", ["ь"] = "", ["Э"] = "E", ["э"] = "e", ["Ю"] = "Yu", ["ю"] = "yu", ["Я"] = "Ya",
		["я"] = "ya"
	} 	
    local out,_ = string.gsub(s, "..", sub)
    return out
end
commented

That is already possible you just have to select a font supporting cyrillic characters (Cabin which is default) does not do that.

commented

I'm not looking to change fonts unfortunately. Just looking to see if this is possible to do with tptp, like other addons do. I couldn't find any settext or place where the name is set anywhere (no experience with wow addons) to add that transliterate function in, so I thought to ask here.

Also changing fonts while allowing the characters to be displayed is very different than transliterating it into latin alphabet.

commented

Ok, I understand that better now. Is there an intelligent way to determine in a name should be transliterated? I don't want to do it for every name as most users probably don't need it.

commented

As far as I could find there isn't a way to check something akin to if written_in_cyrillic then ....
However if there is any cyrillic letter then it would be changed by the string.gsub and if there isn't nothing happens to the string. And in wow only russian realms can use names written in cyrillic, and in russian realms names can't be written using the latin alphabet. So there's never a case of a mix between the two within the same name afaik.
It could be a radio button toggle for enabling (disabled by default) and disabling transliterating names, although I'm happy with doing an edit for my own personal usage only if pointed in the right direction.

commented

If it's just about the name, you have to change the following line in TidyPlatesCore.lua:
680: visual.name:SetText(unit.name)
into
680: visual.name:SetText(unit.name:gsub("..", sub)) (I think, did not test it).

For the status text, it's in healthtext.lua
370: customtext:SetText(subtext or "")

It does not work if you use a custom status text (based on LibDogTag).

commented

Works perfectly, exactly what I wanted thank you!! Not only will I no longer see [][][] I'll also be able to actually read the names, it's perfect.
I'm sure there would be plenty of EU users who would appreciate having the option in case you're ever looking for features to add.