Fix translation of module descriptions

This commit is contained in:
Laurent Destailleur 2017-10-27 13:06:14 +02:00
parent dd6ccf5095
commit a40bebec40
3 changed files with 29 additions and 22 deletions

View File

@ -575,7 +575,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
return $langs->trans("Module".$this->name."Name");
}
// Last change with simple product label
// Last chance with simple label
return $langs->trans($this->name);
}
}
@ -606,6 +606,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
if ($val) $langs->load($val);
}
}
if ($langs->trans("Module".$this->name."Desc") != ("Module".$this->name."Desc"))
{
// If module name translation exists
return $langs->trans("Module".$this->name."Desc");
}
// Last chance with simple label
return $langs->trans($this->description);
}
}
@ -671,16 +679,27 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/
function getDescLongReadmeFound()
{
global $langs;
$filefound= false;
// Define path to file README.md.
// First check README-la_LA.md then README.md
// First check README-la_LA.md then README-la.md then README.md
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$langs->defaultlang.'.md', 0);
if (dol_is_file($pathoffile))
{
$filefound = true;
}
if (! $filefound)
{
$tmp=explode('_', $langs->defaultlang);
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$tmp[0].'.md', 0);
if (dol_is_file($pathoffile))
{
$filefound = true;
}
}
if (! $filefound)
{
$pathoffile = dol_buildpath(strtolower($this->name).'/README.md', 0);
if (dol_is_file($pathoffile))

View File

@ -72,19 +72,13 @@ $page_name = "MyModuleAbout";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule');
// Configuration header
$head = mymoduleAdminPrepareHead();
dol_fiche_head(
$head,
'about',
$langs->trans("ModuleMyModuleName"),
0,
'mymodule@mymodule'
);
dol_fiche_head($head, 'about', '', 0, 'mymodule@mymodule');
dol_include_once('/mymodule/core/modules/modMyModule.class.php');
$tmpmodule = new modMyModule($db);

View File

@ -52,7 +52,7 @@ if (! $user->admin) accessforbidden();
// Parameters
$action = GETPOST('action', 'alpha');
$arrayofparameters=array('MYMODULE_MYPARAM1'=>'1', 'MYMODULE_MYPARAM2'=>'2');
$arrayofparameters=array('MYMODULE_MYPARAM1'=>array('css'=>'minwidth200'), 'MYMODULE_MYPARAM2'=>array('css'=>'minwidth500'));
/*
@ -72,17 +72,11 @@ llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule');
// Configuration header
$head = mymoduleAdminPrepareHead();
dol_fiche_head(
$head,
'settings',
$langs->trans("ModuleMyModuleName"),
-1,
"mymodule@mymodule"
);
dol_fiche_head($head, 'settings', '', -1, "mymodule@mymodule");
// Setup page goes here
echo $langs->trans("MyModuleSetupPage");
@ -101,7 +95,7 @@ if ($action == 'edit')
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td><input class="flat" name="'.$key.'" size="3" value="' . $conf->global->$key . '"></td></tr>';
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
}
print '</table>';