You don't need to include files. Any JS file you put in the script's directory will be loaded automatically.
So if
first.js includes:
code:
var myVar = 'Hello World';
And if another file named
another.js includes:
code:
Debug.Trace(myVar);
You will get the proper output: "Hello World"
--------
Then there is also the
MsgPlus::LoadScriptFile function which loads an external script file (eg: a file in a subdirectory) directly into your current running script.
See the
Plus! Scripting Documentation for more...
--------
But for changing language purposes I really really really suggest you to use variables. Using variables is in fact way more easy.
Also, the
include() approach will simply not work for certain things and is in overall way too slugish. Using such an approach means that you actually will end up with a massive amount of files which all contain the very same script (just in another language). While the proper approach (with variables) is way shorter.
Even in other programming languages the
include() approach is almost never (mis)used for translating purposes since that isn't what it is meant for. The purpose of
include() is to seperate much used declarations and libraries and so that you can easly change that stuff later on without the need to mess in the code files. eg: declaring constants and variables, loading needed libraries (which contain other variables, functions, etc). But the fact that all JScript files in the current script's directory are already automatically loaded makes that you don't need this in Plus! scripting anyways. In PHP only the file you tell the compiler/interpreter to run is executed, other files aren't executed. So that's why it has an
include function, so those other files are executed (aka included in the current executing code) too.
The approach of
if(language=="english"){ var ... = "..."; } is not the best approach either though. Instead, store your translated lines in a data file and simply read in that data file and use like a kind of ID for each string you want to translate in the JScript code itself. This involves arrays, XML or INI or the registry, etc...
Good examples can be found on the forums and/or in various existing scripts.
--------
PS: seeing your questions lately, I really suggest to forget about PHP and trying to mimic all its functions. First skim (well, not skim, actually read
) the official
Plus! Scripting Documentation and first look at the code of some scripts for how things are done. Learning by example and documentation works wonders in this case.