I just write simple code to display translated text based on user borowser language. It looks i did something wrong becuase when i use sk.php it display corret SK translate but when it use cs.php it having problem with translate and isntead of any text it just display "s" everywhere.
I was thiking problem can be in translate file so I makde duplicity of sk.php and rename it to cs.php and it didn't help.
Guys is here somebody who can give me an advise where can be a problem?
public function fetchByVinAxnmrss($con) {
$success = false;
if($this->vin){
$lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$_SESSION['lang'] = $lang;
if(isSet($lang))
{
setcookie('lang', $lang, time() + (3600 * 24 * 30));
}
else if(isSet($_COOKIE['lang']))
{
$lang = $_COOKIE['lang'];
}
else
{
$lang = 'cs';
}
switch ($lang)
{
case 'sk':
$lang_file = 'sk.php';
break;
case 'cs':
$lang_file = 'cs.php';
break;
default:
$lang_file = 'cs.php';
}
include_once 'languages/'.$lang_file;
try{
//$sql = "SELECT * FROM `axnmrs_cases` WHERE `vin` = ':vin' ORDER BY STR_TO_DATE(date_created, '%Y-%m-%d %H:%i:%s') LIMIT 30";
$sql = "SELECT * FROM axnmrs_cases WHERE vin = :vin ORDER BY date_created DESC LIMIT 60";
$stmt = $con->prepare( $sql );
$stmt->bindValue( "vin", $this->vin, PDO::PARAM_STR );
$stmt->execute();
while ($row = $stmt->fetch()){
echo $lang_file;
echo "<dd>".$lang['YES']."</dd>"
p.s. I am debuging with that echo $ lang_file to see which file are opening.
EDIT: adding part of my cs.php file:
$lang = array();
//All
$lang['YES'] = 'Ano';
$lang['NO'] = 'Ne';
$lang['NOT_AVALIABLE'] = 'Není k dispozici';
$lang['CURRENCY'] = 'Měna';