I am trying to get each file to have it own language file.
I am using a mix of osDate, SMF and my own code. osDate stores the language in the database, but I am not wanting this, I would like each file to have it own language file, so for example register has it own language file at lang/english/register.php.
I will be using Smarty, which is causing me the headache.
I have the below PHP code working, but don't know how to add or get the language side working.
Here is my current code.
tester1.php
<?php
if (!defined('SMARTY_DIR')) {
include_once('init_test.php');
}
$actionArray = array(
'register' => array('Register.php', 'Register'),
);
if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
echo '<a href="?action=register">test</a>';
} else {
require_once($actionArray[$_REQUEST['action']][0]);
call_user_func($actionArray[$_REQUEST['action']][1]);
}
$t->display('index.tpl');
?>
Register.php
<?php
function Register() {
global $t;
$t->assign('rendered_page', $t->fetch('register.tpl'));
}
?>
index.tpl
{$rendered_page}
register.tpl
Test: {$testlang}<br>
Title: {$title}
Language file - lang/english/register.php
<?php
$lang['testlang'] = 'working';
$lang['title'] = 'This is the title';
?>
So in the example Register needs to pass the language from Register.php to display in register.tpl.
I am aware I can assign each language string in the Register.php file, but I was hoping, I would be able to just assign the who register language file and then just call it at random, without having to assign each language string in Register.php
Any code, tips welcome. I have tried Googling, but it hasn't come up with much.