par
leakcim51 » 27 juil. 2006, 08:55
Oups j'avais pas fait attention que les fonctions sont dans le logiciel Moregroupware. Voici le code source de ces fonctions si tu en as besoin:
// =====================================================
// A function for parameter based strings
// You can pass the string (which you got most likely
// from the language file) and an array with parameters.
// Then the vars in the string will be replaced with
// the paramters in the array (see language dev. guide)
// =====================================================
function getParmLang($string, $parmarray) {
// add one empty array element at first position because of naming conventions
// in detail: in your language file you start with <$1> and not <$0>
array_unshift($parmarray, "");
return preg_replace("/<\\$([0-9])>/e", '$parmarray[\1]', $string);
}
// 15-01-2002 12:21, rabol : <[email protected]>
// function to get a string from the current language,
// or a string telling you that the string is missing
function getLanguageString($string){
global $hashmap, $myEnv;
if(isset($hashmap[$string])) {
return $hashmap[$string];
} else {
if(SETUP_RUNNING || LANG_DEBUG) { //only true during setup
$filename = ROOTPATH."/" . "missing.".$_SESSION['SETUP']['lang'].".lang";
$missing = $myEnv["module"]." -> ".$string;
if(file_exists($filename)) {
$fp = fopen($filename,"rb");
$content = fread($fp, filesize($filename));
$pos = strpos($content,$missing);
if($pos === false) {
fclose($fp);
$fp = fopen($filename,"a+");
fputs($fp,$missing."\n");
fclose($fp);
}
} else {
$fp = fopen($filename,"w+");
fputs($fp,$missing."\n");
fclose($fp);
}
}
}
return "* " . $string . " * ";
}
Je te conseille de télécharger ce logiciel, le système multi langue est bien fait je trouve.
Bon courage
Oups j'avais pas fait attention que les fonctions sont dans le logiciel Moregroupware. Voici le code source de ces fonctions si tu en as besoin:
[php]
// =====================================================
// A function for parameter based strings
// You can pass the string (which you got most likely
// from the language file) and an array with parameters.
// Then the vars in the string will be replaced with
// the paramters in the array (see language dev. guide)
// =====================================================
function getParmLang($string, $parmarray) {
// add one empty array element at first position because of naming conventions
// in detail: in your language file you start with <$1> and not <$0>
array_unshift($parmarray, "");
return preg_replace("/<\\$([0-9])>/e", '$parmarray[\1]', $string);
}
// 15-01-2002 12:21, rabol : <
[email protected]>
// function to get a string from the current language,
// or a string telling you that the string is missing
function getLanguageString($string){
global $hashmap, $myEnv;
if(isset($hashmap[$string])) {
return $hashmap[$string];
} else {
if(SETUP_RUNNING || LANG_DEBUG) { //only true during setup
$filename = ROOTPATH."/" . "missing.".$_SESSION['SETUP']['lang'].".lang";
$missing = $myEnv["module"]." -> ".$string;
if(file_exists($filename)) {
$fp = fopen($filename,"rb");
$content = fread($fp, filesize($filename));
$pos = strpos($content,$missing);
if($pos === false) {
fclose($fp);
$fp = fopen($filename,"a+");
fputs($fp,$missing."\n");
fclose($fp);
}
} else {
$fp = fopen($filename,"w+");
fputs($fp,$missing."\n");
fclose($fp);
}
}
}
return "* " . $string . " * ";
}
[/php]
Je te conseille de télécharger ce logiciel, le système multi langue est bien fait je trouve.
Bon courage