| |
Okay, the subject is a bit misleading, but there wasn't much I could do with the available space :-(
What I'm trying to do is split my string localisation across multiple files: one file per locale.
Predictably, I'd like to be able to load the file up as follows:
<Script file="'MyMod_Strings_' .. strtoupper (GetLocale ()) .. '.lua'"/>
Then have the localisation strings defined in files called:
MyMod_Strings_USEN.lua
MyMod_Strings_FRFR.lua
MyMod_Strings_DEDE.lua
And so on. Obviously only one of those files is going to get loaded into memory - preferably the one that corresponds to our current locale :-P
This is basically to avoid loading every single localisation string for every single locale into memory at once, considering only a fraction of them are going to actually get used...
Now perhaps the dynamic string isn't the best way to go about it (or maybe it's just not possible, to rework the XML parser to the extent nessecary to allow it). Maybe we could have something like:
<Script file-locale="MyMod_Strings_$L.lua"/>
Just a thought.
Possibly the only real hurdle would be figuring out a way to designate a default locale file to load when the desired one doesn't exist.
---------
How about this:
File list:
MyMod_Strings.lua
MyMod_Strings-deDE.lua
MyMod_Strings-zhTW.lua
XML:
<Script file="MyMod_Strings.lua" loadbylocale="true"/>
Say you're French. The "loadbylocale" bit automatically attempts to concatenate the string "-frFR" to the filename, and thus WoW tries to load the file "MyMod_Strings-frFR.lua" - but that file doesn't exist. So instead, it defaults back to standard behaviour for a <Script file=""/> block and tries to load the file "MyMod_Strings.lua", which should obviously be there).
Thoughts? Suggestions? Rotten tomatoes?
|