2
0
forked from Wavyzz/dolibarr

New: Add flag on product translation page.

This commit is contained in:
Laurent Destailleur
2010-02-28 00:27:37 +00:00
parent 1642cbc098
commit dd97ad310b
5 changed files with 20 additions and 28 deletions

View File

@@ -39,6 +39,8 @@ if (file_exists($conffile) && isset($dolibarr_main_url_root))
exit; exit;
} }
$langs->load("admin");
/* /*
* View * View
@@ -54,10 +56,7 @@ print '<img src="../theme/dolibarr_logo.png" alt="Dolibarr logo"><br>';
print DOL_VERSION.'<br><br>'; print DOL_VERSION.'<br><br>';
print '</center>'; print '</center>';
// Propose la langue d'installation // Ask installation language
$langs->load("admin");
$langs_available=$langs->get_available_languages("..");
print '<br><br><center>'; print '<br><br><center>';
print '<table><tr>'; print '<table><tr>';
print '<td>'.$langs->trans("DefaultLanguage").' : </td><td align="left">'; print '<td>'.$langs->trans("DefaultLanguage").' : </td><td align="left">';

View File

@@ -996,7 +996,7 @@ function picto_from_langcode($codelang)
if ($codelang == 'auto') $ret=img_picto('',DOL_URL_ROOT.'/theme/common/flags/int.png','',1); if ($codelang == 'auto') $ret=img_picto('',DOL_URL_ROOT.'/theme/common/flags/int.png','',1);
else { else {
//print $codelang; //print $codelang;
$langtocountryflag=array('fr_CA'=>'mq','ca_ES'=>'catalonia','ar_AR'=>''); $langtocountryflag=array('da_DA'=>'dk','fr_CA'=>'mq','ca_ES'=>'catalonia','ar_AR'=>'');
$tmpcode=''; $tmpcode='';
if (isset($langtocountryflag[$codelang])) $tmpcode=$langtocountryflag[$codelang]; if (isset($langtocountryflag[$codelang])) $tmpcode=$langtocountryflag[$codelang];
else else

View File

@@ -605,20 +605,13 @@ class Product extends CommonObject
/** /**
* \brief Charge toutes les traductions du produit * \brief Load array this->multilangs
*/ */
function getMultiLangs($langue='') function getMultiLangs()
{ {
global $langs; global $langs;
$langs_available = $langs->get_available_languages(); $current_lang = $langs->getDefaultLang();
if ( $langue != '')
foreach ($langs_available as $key => $value)
if ( $key == $langue ) $current_lang = $key; // si $langue est une valeur correcte
if ( !$current_lang )
$current_lang = $langs->getDefaultLang(); // sinon on choisi la langue par defaut
$sql = "SELECT lang, label, description, note"; $sql = "SELECT lang, label, description, note";
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang";

View File

@@ -68,14 +68,14 @@ $_POST["cancel"] != $langs->trans("Cancel") &&
if ( $_POST["lang"] == $current_lang ) if ( $_POST["lang"] == $current_lang )
{ {
$product->libelle = $_POST["libelle"]; $product->libelle = $_POST["libelle"];
$product->description = $_POST["desc"]; $product->description = dol_htmlcleanlastbr($_POST["desc"]);
$product->note = $_POST["note"]; $product->note = dol_htmlcleanlastbr($_POST["note"]);
} }
else else
{ {
$product->multilangs[$_POST["lang"]]["libelle"] = $_POST["libelle"]; $product->multilangs[$_POST["lang"]]["libelle"] = $_POST["libelle"];
$product->multilangs[$_POST["lang"]]["description"] = $_POST["desc"]; $product->multilangs[$_POST["lang"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$product->multilangs[$_POST["lang"]]["note"] = $_POST["note"]; $product->multilangs[$_POST["lang"]]["note"] = dol_htmlcleanlastbr($_POST["note"]);
} }
// sauvegarde en base // sauvegarde en base
@@ -104,14 +104,14 @@ $_POST["cancel"] != $langs->trans("Cancel") &&
if ( $key == $current_lang ) if ( $key == $current_lang )
{ {
$product->libelle = $_POST["libelle-".$key]; $product->libelle = $_POST["libelle-".$key];
$product->description = $_POST["desc-".$key]; $product->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$product->note = $_POST["note-".$key]; $product->note = dol_htmlcleanlastbr($_POST["note-".$key]);
} }
else else
{ {
$product->multilangs[$key]["libelle"] = $_POST["libelle-".$key]; $product->multilangs[$key]["libelle"] = $_POST["libelle-".$key];
$product->multilangs[$key]["description"] = $_POST["desc-".$key]; $product->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$product->multilangs[$key]["note"] = $_POST["note-".$key]; $product->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]);
} }
} }
@@ -292,7 +292,7 @@ if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights-
print '</form>'; print '</form>';
print '<br>';
} }
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@@ -416,9 +416,9 @@ class Translate {
* Parameters of this method must not contains any HTML tags. * Parameters of this method must not contains any HTML tags.
* \param key key of string to translate * \param key key of string to translate
* \param param1 chaine de param1 * \param param1 chaine de param1
* \param param2 chaine de param1 * \param param2 chaine de param2
* \param param3 chaine de param1 * \param param3 chaine de param3
* \param param4 chaine de param1 * \param param4 chaine de param4
* \return string chaine traduite * \return string chaine traduite
*/ */
function transnoentities($key, $param1='', $param2='', $param3='', $param4='') function transnoentities($key, $param1='', $param2='', $param3='', $param4='')