LocalizedClassNames

From Wowpedia
Jump to: navigation, search
This is a user-defined function that you can copy and paste into your addon.


*NOTE*

This page is badly outdated and should no longer be used. For localized class names of specific units, use UnitClass. For a generalized list, use the builtin tables LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_FEMALE; the keys are the second return value of UnitClass ('WARLOCK', 'DEATHKNIGHT', etc) and the values are the names in the client locale.

You can use the builtin command /dump LOCALIZED_CLASS_NAMES_MALE in the game client to see the table.

*Original page follows*

Provides a table of class names in the user's locale. Keys are in enUS, values in the current locale.

local locale = GetLocale()
-- Localized class names.  Index == enUS, value == localized
local classnames = locale == "deDE" and {
	["Warlock"] = "Hexenmeister",
	["Warrior"] = "Krieger",
	["Hunter"] = "Jäger",
	["Mage"] = "Magier",
	["Priest"] = "Priester",
	["Druid"] = "Druide",
	["Paladin"] = "Paladin",
	["Shaman"] = "Schamane",
	["Rogue"] = "Schurke",
} or locale == "frFR" and {
	["Warlock"] = "D\195\169moniste",
	["Warrior"] = "Guerrier",
	["Hunter"] = "Chasseur",
	["Mage"] = "Mage",
	["Priest"] = "Pr\195\170tre",
	["Druid"] = "Druide",
	["Paladin"] = "Paladin",
	["Shaman"] = "Chaman",
	["Rogue"] = "Voleur",
} or {
	["Warlock"] = "Warlock",
	["Warrior"] = "Warrior",
	["Hunter"] = "Hunter",
	["Mage"] = "Mage",
	["Priest"] = "Priest",
	["Druid"] = "Druid",
	["Paladin"] = "Paladin",
	["Shaman"] = "Shaman",
	["Rogue"] = "Rogue",
}

A reverse lookup table can also be created simply:

local reverseclassnames = {}
for i,v in pairs(classnames) do reverseclassnames[v] = i end