View Single Post
08/30/18, 10:02 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,971
Like written in your other post about it:

Add ReloadUI() after switiching the CVar in your function:
Lua Code:
  1. function AdvancedLanguageSelector:Initialize()
  2.     SetCVar("language.2","en")
  3.         ReloadUI()
  4. end

Without reloadui it will not rebuild the texts and use the game client's language texts.

Explanation:
The game texts are build AFTER login to the client so you see the texts in the addon list (if you are not logged in with a char -> at char selection) already.
If you do not change the language in the Launcher before it won't affect the game anymore.
Even changing the cvar via an adodn won't reload the UI so the texts get rebuild.
That's why you need to add the ReloadUI() call in your addon to force the game to reload the texts "now".

If you use the same command to change the cvar ingame as a script inside the chat, like
/script SetCVar("language.2","en")
the game will automatically do the reloadui for you. But addons behave in a different way if you change the cvars as some need, and many don't need a new reloaded UI.

Last edited by Baertram : 08/30/18 at 10:04 AM.
  Reply With Quote