WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   Game locale in toc (https://www.wowinterface.com/forums/showthread.php?t=46579)

Resike 05-29-13 06:31 AM

Game locale in toc
 
Give us an option to get the game's language in the toc file and load files based on that selection. Could speed up loading time a lot.

ravagernl 05-29-13 09:37 AM

You mean something like:
Code:

## Interface: 50300
[<rest of toc headers>]
init.lua
locales\locale.{locale}.lua

and the game should automatically replace {locale}? Or create a new toc header:
Code:

## Interface: 50300
## LoadForLocale: zhTW, zhCN

And then set OptionalDependencies in the actual addon toc to all of these locale addons.

Second option would seriously be spamming the AddOns folder, even tough AddOns like Bigwigs already do this, and I don't see Blizzard implementing option 1 at all.

Blizzard would rather implement interface/addon localization in XML (in a way that a table was inserted as the third argument to vararg ...) i think.

Dridzt 05-29-13 09:52 AM

Or you could put all locales into one file so the game loads just the one....

(and use GetLocale() to process the relevant section)

Loading delays are caused in part by the game seeking to a file (sometimes not finding it and writing to FrameXML.log and so on)

If you use one file to keep all your locales that's not an issue.

Seerah 05-29-13 10:20 AM

Or (if you really really want separate files per locale) you can put in a return at the top of the file. So, even if it loads the file, it won't compile the code unless it's the correct locale.

Lua Code:
  1. if GetLocale() ~= "enUS" then
  2.      return
  3. end

Resike 05-29-13 01:21 PM

Quote:

Originally Posted by Seerah (Post 278935)
Or (if you really really want separate files per locale) you can put in a return at the top of the file. So, even if it loads the file, it won't compile the code unless it's the correct locale.

Lua Code:
  1. if GetLocale() ~= "enUS" then
  2.      return
  3. end

Hmm i havn't tought about that, thats seems to be nice.

Resike 05-29-13 01:22 PM

Quote:

Originally Posted by Dridzt (Post 278933)
Or you could put all locales into one file so the game loads just the one....

(and use GetLocale() to process the relevant section)

Loading delays are caused in part by the game seeking to a file (sometimes not finding it and writing to FrameXML.log and so on)

If you use one file to keep all your locales that's not an issue.

Yeah, i curretly using this method, but still a lot of time seems to go to waste since you wont ever use most of them.

Resike 05-29-13 01:25 PM

Quote:

Originally Posted by ravagernl (Post 278930)
You mean something like:
Code:

## Interface: 50300
[<rest of toc headers>]
init.lua
locales\locale.{locale}.lua

and the game should automatically replace {locale}? Or create a new toc header:
Code:

## Interface: 50300
## LoadForLocale: zhTW, zhCN

And then set OptionalDependencies in the actual addon toc to all of these locale addons.

Second option would seriously be spamming the AddOns folder, even tough AddOns like Bigwigs already do this, and I don't see Blizzard implementing option 1 at all.

Blizzard would rather implement interface/addon localization in XML (in a way that a table was inserted as the third argument to vararg ...) i think.

Well i thing the best method would be like if you have more files for locales:

enUS.lua
enGB.lua

and you could load it from the toc like:

Code:

'gamelocale'.lua
Then you always load only one file, ignore the rest.

rowaasr13 06-24-15 11:59 AM

Quote:

Originally Posted by Seerah (Post 278935)
Or (if you really really want separate files per locale) you can put in a return at the top of the file. So, even if it loads the file, it won't compile the code unless it's the correct locale.

Lua Code:
  1. if GetLocale() ~= "enUS" then
  2.      return
  3. end

Err... no. It certainly WILL compile entire file - chunks are always read and compiled completely and returned to reader and only THEN reader runs resulting code, performs check and bails out of it with return. So the only thing you're saving is object/function/closures instantiation and any run time that might be spent on any heavy loops if you have some bulk processing in your locale files.

Resike 06-24-15 03:05 PM

It's kinda irrelevant now with SSD performances, however it's still kinda bugging me that 50% of your addon's memory usage are useless locale files thats for sure.

And yes the game loads those files into the memory too when you start the game, and i'm not sure they ever get collected to garbage or not.

Nimhfree 06-24-15 03:17 PM

Quote:

Originally Posted by Dridzt (Post 278933)
Or you could put all locales into one file so the game loads just the one....

(and use GetLocale() to process the relevant section)

Loading delays are caused in part by the game seeking to a file (sometimes not finding it and writing to FrameXML.log and so on)

If you use one file to keep all your locales that's not an issue.

Not for me. If you put all my different locale files into one file Blizzard cannot parse it as there is too much data. Therefore, I separate my files out by locale. I would love to have the option in the TOC to only load the locales that are actually being used.

Resike 06-24-15 04:16 PM

I'm pretty sure it could be done tho, lets say in CurseClient/Minion you set the language you want to use your addons, then the client comments out every other language files from the toc or even don't even download those files, just like how the nolib strip works:

Toc Code:
  1. #@no-lib-strip@
  2. # embeds.xml
  3. #@end-no-lib-strip@

It would not just speed up the download processes and save a fuckloads of traffic, but remove a lot of clutter and even slightly speed up the addon loading process.

rowaasr13 06-25-15 02:49 AM

Quote:

Originally Posted by Resike (Post 309369)
It's kinda irrelevant now with SSD performances, however it's still kinda bugging me that 50% of your addon's memory usage are useless locale files thats for sure.

And yes the game loads those files into the memory too when you start the game, and i'm not sure they ever get collected to garbage or not.

If you use early returns the data is not even instantiated. Otherwise it all depends on how you programmed if you just build big table of all localization and never throw it away - it will stay in memory because, well, you put it here and didn't dispose it. Just don't do that.

There also source text and outer function bytecode itself - only Blizzard can tell if those are retained in memory after processing or not.

Resike 06-25-15 07:05 AM

Quote:

Originally Posted by rowaasr13 (Post 309389)
If you use early returns the data is not even instantiated. Otherwise it all depends on how you programmed if you just build big table of all localization and never throw it away - it will stay in memory because, well, you put it here and didn't dispose it. Just don't do that.

There also source text and outer function bytecode itself - only Blizzard can tell if those are retained in memory after processing or not.

Try to login with the game with 5k "L" tables in every localization, then try to log in with only one set of tables, then compare the memory usage:

Lua Code:
  1. local AddonName, Addon = ...
  2.  
  3. local L = setmetatable({ }, {__index = function(t, k)
  4.     local v = tostring(k)
  5.     rawset(t, k, v)
  6.     return v
  7. end})
  8.  
  9. Addon.L = L
  10.  
  11. local locale = GetLocale()
  12.  
  13. if locale == "enUS" or locale == "enGB" then
  14.    
  15. elseif locale == "deDE" then
  16.    
  17. elseif locale == "esES" then
  18.    
  19. elseif locale == "esMX" then
  20.    
  21. elseif locale == "frFR" then
  22.    
  23. elseif locale == "itIT" then
  24.    
  25. elseif locale == "koKR" then
  26.    
  27. elseif locale == "ptBR" then
  28.    
  29. elseif locale == "ruRU" then
  30.    
  31. elseif locale == "zhCN" then
  32.    
  33. elseif locale == "zhTW" then
  34.    
  35. end

It doesn't really matter if your code doesn't run, if you put a file in the toc, then it will get loaded into the memory at least once per login/reload. My guess is that memory eventually will get garbaged, but it's still unnecessary loading time.


All times are GMT -6. The time now is 05:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI