I'm going ahead to develop the localization files for my project and i am not sure if i am doing the good choice.
<?php
$translation= array(
"sentence" => array ("fr" => "phrase", "it" => "frase")
);
function _($toTranslate = '', $lang = 'en'){
if($toTranslate != ''){
if(!array_key_exists($toTranslate[$lang], $translation))
return $toTranslate;
else
return ${$lang}[$toTranslate];
}
}
?>
I clearly no idea to know if i am doing it well.