Help with translation system (php)

espfutbol98

New Member
Messages
200
Reaction score
2
Points
0
I have been translating my site by echoing variables that are in included files depending on a cookie. Example:
index.php
PHP:
<?php
if (isset($_COOKIE['lang']) && $_COOKIE['lang'] == "hr") {
include "translation_hr.php";
}
else {
include "translation_en.php";
}
?>
<html>
<head>
</head>
<body>
<p><?php echo $t_welcome; ?></p>
</body>
</html>
translation_hr.php
PHP:
<?php
$t_welcome = "Dobrodošli";
?>
translation_en.php
PHP:
<?php
$t_welcome = "Welcome";
?>
But I have noticed, like with phBB, they use arrays for this. Are they better? If so, how are they done?
 
Last edited:
Top