1
When i was working on my website today i came across a few undefined language variables. Then i started thinking how i could ensure that a lanuage variable is always defined. Thats when i got a very simple solution, i first thought it wasn't going to work but it did (At least on my system).
So this is wat i've done. I replaced the normal if rule:
if ( file_exists( "language/" . $xoopsConfig['language'] . "/main.php" ) ) {
include "language/" . $xoopsConfig['language'] . "/main.php";
}elseif ( file_exists( "language/english/main.php" ) ) {
include "language/english/main.php";
}
with:
if ( file_exists( "language/english/main.php" ) ) {
include "language/english/main.php";
}
if ( file_exists( "language/" . $xoopsConfig['language'] . "/main.php" ) ) {
include "language/" . $xoopsConfig['language'] . "/main.php";
}
This way if a variable isn't defined in a local file, you will get the english text.
Maybe it's crazy, maybe it's not but for me this works.
Maybe if it works on every system, module and core developers could load language file's this way in the future.
Please respond, Dylian.
P.S. Sorry for my bad english.