mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-28 10:26:02 +00:00
api: add option to change language
This commit is contained in:
@@ -22,6 +22,7 @@ end
|
||||
|
||||
function pfUI:LoadConfig()
|
||||
-- MODULE SUBGROUP ENTRY VALUE
|
||||
pfUI:UpdateConfig("global", nil, "language", GetLocale())
|
||||
pfUI:UpdateConfig("global", nil, "profile", "default")
|
||||
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
|
||||
pfUI:UpdateConfig("global", nil, "offscreen", "0")
|
||||
|
||||
@@ -572,6 +572,20 @@ pfUI:RegisterModule("gui", function ()
|
||||
-- initialize dropdown menus
|
||||
pfUI.gui.dropdowns = { }
|
||||
|
||||
pfUI.gui.dropdowns.languages = {
|
||||
-- "deDE:German",
|
||||
-- "enGB:British English",
|
||||
"enUS:English",
|
||||
--"esES:Spanish (European)",
|
||||
--"esMX:Spanish (Latin American)",
|
||||
"frFR:French",
|
||||
"koKR:Korean",
|
||||
-- "ruRU:Russian",
|
||||
"zhCN:Chinese (simplified; China)",
|
||||
"zhTW:Chinese (traditional; Taiwan)",
|
||||
-- http://wowprogramming.com/docs/api/GetLocale
|
||||
}
|
||||
|
||||
-- dropdown menu items
|
||||
pfUI.gui.dropdowns.fonts = {
|
||||
"Interface\\AddOns\\pfUI\\fonts\\BigNoodleTitling.ttf:BigNoodleTitling",
|
||||
@@ -698,6 +712,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui.tabs.settings.tabs.general = pfUI.gui.tabs.settings.tabs:CreateChildFrame(T["General"], 70)
|
||||
pfUI.gui.tabs.settings.tabs.general:SetScript("OnShow", function()
|
||||
if not this.setup then
|
||||
CreateConfig(this, T["Language"], C.global, "language", "dropdown", pfUI.gui.dropdowns.languages)
|
||||
CreateConfig(this, T["Enable Region Compatible Font"], C.global, "force_region", "checkbox")
|
||||
CreateConfig(this, T["Standard Text Font"], C.global, "font_default", "dropdown", pfUI.gui.dropdowns.fonts)
|
||||
CreateConfig(this, T["Standard Text Font Size"], C.global, "font_size")
|
||||
|
||||
@@ -76,7 +76,13 @@ pfUI:SetScript("OnEvent", function()
|
||||
pfUI.env._G = getfenv(0)
|
||||
pfUI.env.C = pfUI_config
|
||||
pfUI.env.L = pfUI_locale[GetLocale()] or pfUI_locale["enUS"]
|
||||
pfUI.env.T = setmetatable(pfUI_translation[GetLocale()] or {}, { __index = function(tab,key)
|
||||
|
||||
local language = GetLocale()
|
||||
if pfUI_config.global.language and pfUI_translation[pfUI_config.global.language] then
|
||||
language = pfUI_config.global.language
|
||||
end
|
||||
|
||||
pfUI.env.T = setmetatable(pfUI_translation[language] or {}, { __index = function(tab,key)
|
||||
local value = tostring(key)
|
||||
rawset(tab,key,value)
|
||||
return value
|
||||
|
||||
@@ -22,10 +22,12 @@ env\locales_zhCN.lua
|
||||
env\locales_ruRU.lua
|
||||
env\locales_koKR.lua
|
||||
|
||||
# translations
|
||||
env\translations_enUS.lua
|
||||
env\translations_frFR.lua
|
||||
env\translations_deDE.lua
|
||||
env\translations_zhCN.lua
|
||||
env\translations_zhTW.lua
|
||||
env\translations_ruRU.lua
|
||||
env\translations_koKR.lua
|
||||
|
||||
|
||||
Reference in New Issue
Block a user