I was asking in previous post about folder structure and now cames out a question about organizing languages structure. I would be really happy if anybody can comment if the following is a common way for language versions.
settings.php if(empty($_SESSION[lang])){
include_once '/languages/lang_en.php';
}else{
include_once '/languages/lang_'.$_SESSION[lang].'.php';
}
lang_en.php $profileUpdated="Profile has been sucesfully changed";
$writeProfileInfo="Please submit your information";
$needFirstName="Missing first name";
$needFirstName="Missing last name";
$from[profile]="from";
$from[home]="cooming from";
lang_si.php $profileUpdated="Profil je bil uspešno spremenjen";
$writeProfileInfo="Prosimo izpolnite vaš profil";
$needFirstName="Manjka ime";
$needFirstName="Manjka priimek";
$from[profile]="iz";
$from[home]="prihaja iz";
profile.php
<?
include_once 'settings.php'
if(isset($_POST[submit])){
if(empty($_POST[firstName])){
$error[]=$needFirstName;
}elseif(empty($_POST[lastName])){
$error[]=$needLastName;
}else{
$msg=$profileUpdated;
}
}
//...
?>
<html>
<body>
<div id="msg">
<?
if(isset($msg)){
echo $msg;
}
?>
</div>
<div id="profile">
<?
echo $writeProfileInfo;
echo '<br />';
echo $firstName;
echo '<input type="text" name="firstName" />';
echo '<br />';
?>
</div>
<div id="friends">
<?
echo $friendFullName[1]." ".$from[profile]." ".$friendLocation[1];
?>
</div>
</body>
</html>