mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
gettext for plugin example + tools
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@179 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
4b086c9c08
commit
e53695069b
@ -46,7 +46,6 @@ Session::checkRight("config", "w");
|
|||||||
Plugin::load('example');
|
Plugin::load('example');
|
||||||
|
|
||||||
Html::header("TITRE",$_SERVER['PHP_SELF'],"config","plugins");
|
Html::header("TITRE",$_SERVER['PHP_SELF'],"config","plugins");
|
||||||
echo "This is the plugin config page<br>";
|
_e("This is the plugin config page");
|
||||||
echo $LANG['plugin_example']["test"];
|
|
||||||
Html::footer();
|
Html::footer();
|
||||||
?>
|
?>
|
@ -40,21 +40,21 @@ if (isset($_GET["popup"])) {
|
|||||||
if (isset($_SESSION["glpipopup"]["name"])) {
|
if (isset($_SESSION["glpipopup"]["name"])) {
|
||||||
switch ($_SESSION["glpipopup"]["name"]) {
|
switch ($_SESSION["glpipopup"]["name"]) {
|
||||||
case "test_rule" :
|
case "test_rule" :
|
||||||
Html::popHeader($LANG['buttons'][50],$_SERVER['PHP_SELF']);
|
Html::popHeader(__('Test'),$_SERVER['PHP_SELF']);
|
||||||
include "../../../front/rule.test.php";
|
include "../../../front/rule.test.php";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "test_all_rules" :
|
case "test_all_rules" :
|
||||||
Html::popHeader($LANG['rulesengine'][84],$_SERVER['PHP_SELF']);
|
Html::popHeader(__('Test rules engine'),$_SERVER['PHP_SELF']);
|
||||||
include "../../../front/rulesengine.test.php";
|
include "../../../front/rulesengine.test.php";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "show_cache" :
|
case "show_cache" :
|
||||||
Html::popHeader($LANG['rulesengine'][100],$_SERVER['PHP_SELF']);
|
Html::popHeader(__('Cache informations'),$_SERVER['PHP_SELF']);
|
||||||
include "../../../front/rule.cache.php";
|
include "../../../front/rule.cache.php";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
echo "<div class='center'><br><a href='javascript:window.close()'>".$LANG['buttons'][13]."</a>";
|
echo "<div class='center'><br><a href='javascript:window.close()'>".__('Back')."</a>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
Html::popFooter();
|
Html::popFooter();
|
||||||
}
|
}
|
||||||
|
101
hook.php
101
hook.php
@ -60,7 +60,7 @@ function plugin_example_getDatabaseRelations() {
|
|||||||
// Define Dropdown tables to be manage in GLPI :
|
// Define Dropdown tables to be manage in GLPI :
|
||||||
function plugin_example_getDropdown() {
|
function plugin_example_getDropdown() {
|
||||||
// Table => Name
|
// Table => Name
|
||||||
return array('PluginExampleDropdown' => "Plugin Example Dropdown");
|
return array('PluginExampleDropdown' => __("Plugin Example Dropdown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +69,6 @@ function plugin_example_getDropdown() {
|
|||||||
|
|
||||||
// Define Additionnal search options for types (other than the plugin ones)
|
// Define Additionnal search options for types (other than the plugin ones)
|
||||||
function plugin_example_getAddSearchOptions($itemtype) {
|
function plugin_example_getAddSearchOptions($itemtype) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
$sopt = array();
|
$sopt = array();
|
||||||
if ($itemtype == 'Computer') {
|
if ($itemtype == 'Computer') {
|
||||||
@ -77,7 +76,7 @@ function plugin_example_getAddSearchOptions($itemtype) {
|
|||||||
$sopt[1001]['table'] = 'glpi_plugin_example_dropdowns';
|
$sopt[1001]['table'] = 'glpi_plugin_example_dropdowns';
|
||||||
$sopt[1001]['field'] = 'name';
|
$sopt[1001]['field'] = 'name';
|
||||||
$sopt[1001]['linkfield'] = 'plugin_example_dropdowns_id';
|
$sopt[1001]['linkfield'] = 'plugin_example_dropdowns_id';
|
||||||
$sopt[1001]['name'] = 'Example plugin';
|
$sopt[1001]['name'] = __('Example plugin');
|
||||||
}
|
}
|
||||||
return $sopt;
|
return $sopt;
|
||||||
}
|
}
|
||||||
@ -267,17 +266,16 @@ function plugin_example_addOrderBy($type,$ID,$order,$key=0) {
|
|||||||
|
|
||||||
// Define actions :
|
// Define actions :
|
||||||
function plugin_example_MassiveActions($type) {
|
function plugin_example_MassiveActions($type) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
// New action for core and other plugin types : name = plugin_PLUGINNAME_actionname
|
// New action for core and other plugin types : name = plugin_PLUGINNAME_actionname
|
||||||
case 'Computer' :
|
case 'Computer' :
|
||||||
return array("plugin_example_DoIt" => "plugin_example_DoIt");
|
return array("plugin_example_DoIt" => __("plugin_example_DoIt"));
|
||||||
|
|
||||||
// Actions for types provided by the plugin
|
// Actions for types provided by the plugin
|
||||||
case 'PluginExampleExample' :
|
case 'PluginExampleExample' :
|
||||||
return array("add_document" => $LANG["document"][16], // GLPI core one
|
return array("add_document" => __('Add a document'), // GLPI core one
|
||||||
"do_nothing" => 'Do Nothing - just for fun'); // Specific one
|
"do_nothing" => __('Do Nothing - just for fun')); // Specific one
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
@ -286,7 +284,6 @@ function plugin_example_MassiveActions($type) {
|
|||||||
// How to display specific actions ?
|
// How to display specific actions ?
|
||||||
// options contain at least itemtype and and action
|
// options contain at least itemtype and and action
|
||||||
function plugin_example_MassiveActionsDisplay($options=array()) {
|
function plugin_example_MassiveActionsDisplay($options=array()) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
switch ($options['itemtype']) {
|
switch ($options['itemtype']) {
|
||||||
case 'Computer' :
|
case 'Computer' :
|
||||||
@ -294,7 +291,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
|
|||||||
case "plugin_example_DoIt" :
|
case "plugin_example_DoIt" :
|
||||||
echo " <input type='hidden' name='toto' value='1'>".
|
echo " <input type='hidden' name='toto' value='1'>".
|
||||||
"<input type='submit' name='massiveaction' class='submit' value='".
|
"<input type='submit' name='massiveaction' class='submit' value='".
|
||||||
$LANG["buttons"][2]."'> but do nothing :)";
|
__s('Post')."'> ".__('but do nothing :)');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -304,7 +301,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
|
|||||||
// No case for add_document : use GLPI core one
|
// No case for add_document : use GLPI core one
|
||||||
case "do_nothing" :
|
case "do_nothing" :
|
||||||
echo " <input type='submit' name='massiveaction' class='submit' value='".
|
echo " <input type='submit' name='massiveaction' class='submit' value='".
|
||||||
$LANG["buttons"][2]."'> but do nothing :)";
|
__s('Post')."'> ".__('but do nothing :)');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -315,14 +312,13 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
|
|||||||
|
|
||||||
// How to process specific actions ?
|
// How to process specific actions ?
|
||||||
function plugin_example_MassiveActionsProcess($data) {
|
function plugin_example_MassiveActionsProcess($data) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
switch ($data['action']) {
|
switch ($data['action']) {
|
||||||
case 'plugin_example_DoIt' :
|
case 'plugin_example_DoIt' :
|
||||||
if ($data['itemtype'] == 'Computer') {
|
if ($data['itemtype'] == 'Computer') {
|
||||||
$comp = new Computer();
|
$comp = new Computer();
|
||||||
Session::addMessageAfterRedirect("Right it is the type I want...");
|
Session::addMessageAfterRedirect(__("Right it is the type I want..."));
|
||||||
Session::addMessageAfterRedirect("But... I say I will do nothing for :");
|
Session::addMessageAfterRedirect(__("But... I say I will do nothing for:"));
|
||||||
foreach ($data['item'] as $key => $val) {
|
foreach ($data['item'] as $key => $val) {
|
||||||
if ($val == 1) {
|
if ($val == 1) {
|
||||||
if ($comp->getFromDB($key)) {
|
if ($comp->getFromDB($key)) {
|
||||||
@ -336,8 +332,8 @@ function plugin_example_MassiveActionsProcess($data) {
|
|||||||
case 'do_nothing' :
|
case 'do_nothing' :
|
||||||
if ($data['itemtype'] == 'PluginExampleExample') {
|
if ($data['itemtype'] == 'PluginExampleExample') {
|
||||||
$ex = new PluginExampleExample();
|
$ex = new PluginExampleExample();
|
||||||
Session::addMessageAfterRedirect("Right it is the type I want...");
|
Session::addMessageAfterRedirect(__("Right it is the type I want..."));
|
||||||
Session::addMessageAfterRedirect("But... I say I will do nothing for :");
|
Session::addMessageAfterRedirect(__("But... I say I will do nothing for:"));
|
||||||
foreach ($data['item'] as $key => $val) {
|
foreach ($data['item'] as $key => $val) {
|
||||||
if ($val == 1) {
|
if ($val == 1) {
|
||||||
if ($ex->getFromDB($key)) {
|
if ($ex->getFromDB($key)) {
|
||||||
@ -364,7 +360,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
|
|||||||
// Table fields
|
// Table fields
|
||||||
switch ($table.".".$field) {
|
switch ($table.".".$field) {
|
||||||
case 'glpi_plugin_example_examples.serial' :
|
case 'glpi_plugin_example_examples.serial' :
|
||||||
echo "Not really specific - Just for example ";
|
_e("Not really specific - Just for example");
|
||||||
//Html::autocompletionTextField($linkfield,$table,$field);
|
//Html::autocompletionTextField($linkfield,$table,$field);
|
||||||
// Dropdown::showYesNo($linkfield);
|
// Dropdown::showYesNo($linkfield);
|
||||||
// Need to return true if specific display
|
// Need to return true if specific display
|
||||||
@ -375,7 +371,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
|
|||||||
// Linked Fields
|
// Linked Fields
|
||||||
switch ($table.".".$field) {
|
switch ($table.".".$field) {
|
||||||
case "glpi_plugin_example_dropdowns.name" :
|
case "glpi_plugin_example_dropdowns.name" :
|
||||||
echo "Not really specific - Just for example ";
|
_e("Not really specific - Just for example");
|
||||||
// Need to return true if specific display
|
// Need to return true if specific display
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -389,15 +385,14 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
|
|||||||
// options must contain at least itemtype and options array
|
// options must contain at least itemtype and options array
|
||||||
// MUST Use a specific AddWhere & $tab[X]['searchtype'] = 'equals'; declaration
|
// MUST Use a specific AddWhere & $tab[X]['searchtype'] = 'equals'; declaration
|
||||||
function plugin_example_searchOptionsValues($options=array()) {
|
function plugin_example_searchOptionsValues($options=array()) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
$table = $options['searchoption']['table'];
|
$table = $options['searchoption']['table'];
|
||||||
$field = $options['searchoption']['field'];
|
$field = $options['searchoption']['field'];
|
||||||
|
|
||||||
// Table fields
|
// Table fields
|
||||||
switch ($table.".".$field) {
|
switch ($table.".".$field) {
|
||||||
case "glpi_plugin_example_examples.serial" :
|
case "glpi_plugin_example_examples.serial" :
|
||||||
echo "Not really specific - Use your own dropdown - Just for example ";
|
_e("Not really specific - Use your own dropdown - Just for example");
|
||||||
Dropdown::show(getItemTypeForTable($options['searchoption']['table']),
|
Dropdown::show(getItemTypeForTable($options['searchoption']['table']),
|
||||||
array('value' => $options['value'],
|
array('value' => $options['value'],
|
||||||
'name' => $options['name'],
|
'name' => $options['name'],
|
||||||
@ -420,14 +415,14 @@ function plugin_pre_item_update_example($item) {
|
|||||||
}
|
}
|
||||||
$item->input['comment'] .= addslashes("\nUpdate: ".date('r'));
|
$item->input['comment'] .= addslashes("\nUpdate: ".date('r'));
|
||||||
*/
|
*/
|
||||||
Session::addMessageAfterRedirect("Pre Update Computer Hook", true);
|
Session::addMessageAfterRedirect(__("Pre Update Computer Hook"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on update item case
|
// Hook done on update item case
|
||||||
function plugin_item_update_example($item) {
|
function plugin_item_update_example($item) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Update Computer Hook (".implode(',',$item->updates).")", true);
|
Session::addMessageAfterRedirect(sprintf(__("Update Computer Hook (%s)"),implode(',',$item->updates)), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +430,7 @@ function plugin_item_update_example($item) {
|
|||||||
// Hook done on get empty item case
|
// Hook done on get empty item case
|
||||||
function plugin_item_empty_example($item) {
|
function plugin_item_empty_example($item) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Empty Computer Hook",true);
|
Session::addMessageAfterRedirect(__("Empty Computer Hook"),true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,14 +439,14 @@ function plugin_item_empty_example($item) {
|
|||||||
function plugin_pre_item_delete_example($object) {
|
function plugin_pre_item_delete_example($object) {
|
||||||
|
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
Session::addMessageAfterRedirect("Pre Delete Computer Hook",true);
|
Session::addMessageAfterRedirect(__("Pre Delete Computer Hook"),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on delete item case
|
// Hook done on delete item case
|
||||||
function plugin_item_delete_example($object) {
|
function plugin_item_delete_example($object) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Delete Computer Hook",true);
|
Session::addMessageAfterRedirect(__("Delete Computer Hook"),true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,14 +455,14 @@ function plugin_item_delete_example($object) {
|
|||||||
function plugin_pre_item_purge_example($object) {
|
function plugin_pre_item_purge_example($object) {
|
||||||
|
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
Session::addMessageAfterRedirect("Pre Purge Computer Hook",true);
|
Session::addMessageAfterRedirect(__("Pre Purge Computer Hook"),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on purge item case
|
// Hook done on purge item case
|
||||||
function plugin_item_purge_example($object) {
|
function plugin_item_purge_example($object) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Purge Computer Hook",true);
|
Session::addMessageAfterRedirect(__("Purge Computer Hook"),true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +471,7 @@ function plugin_item_purge_example($object) {
|
|||||||
function plugin_pre_item_restore_example($item) {
|
function plugin_pre_item_restore_example($item) {
|
||||||
|
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
Session::addMessageAfterRedirect("Pre Restore Computer Hook");
|
Session::addMessageAfterRedirect(__("Pre Restore Computer Hook"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -484,23 +479,23 @@ function plugin_pre_item_restore_example($item) {
|
|||||||
function plugin_pre_item_restore_example2($item) {
|
function plugin_pre_item_restore_example2($item) {
|
||||||
|
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
Session::addMessageAfterRedirect("Pre Restore Phone Hook");
|
Session::addMessageAfterRedirect(__("Pre Restore Phone Hook"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on restore item case
|
// Hook done on restore item case
|
||||||
function plugin_item_restore_example($item) {
|
function plugin_item_restore_example($item) {
|
||||||
|
|
||||||
Session::addMessageAfterRedirect("Restore Computer Hook");
|
Session::addMessageAfterRedirect(__("Restore Computer Hook"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on restore item case
|
// Hook done on restore item case
|
||||||
function plugin_item_transfer_example($parm) {
|
function plugin_item_transfer_example($parm) {
|
||||||
|
//TRANS: %1$s is the source type, %2$d is the source ID, %3$d is the destination ID
|
||||||
Session::addMessageAfterRedirect("Transfer Computer Hook ".$parm['type']." ".$parm['id']." -> ".
|
Session::addMessageAfterRedirect(sprintf(__('Transfer Computer Hook %1$s %2$d -> %3$d'),$parm['type'],$parm['id'],
|
||||||
$parm['newID']);
|
$parm['newID']));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -518,7 +513,7 @@ function plugin_planning_populate_example($parm) {
|
|||||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["plugin"] = "example";
|
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["plugin"] = "example";
|
||||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"] = date("Y-m-d 17:00:00");
|
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"] = date("Y-m-d 17:00:00");
|
||||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"] = date("Y-m-d 18:00:00");
|
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"] = date("Y-m-d 18:00:00");
|
||||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["name"] = "test planning example 1 ";
|
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["name"] = __("test planning example 1");
|
||||||
// Set the ID using the ID of the item in the database to have unique ID
|
// Set the ID using the ID of the item in the database to have unique ID
|
||||||
$ID = date("Ymd"); // Current date for example
|
$ID = date("Ymd"); // Current date for example
|
||||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["planningID"] = "plugin_example".$ID;
|
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["planningID"] = "plugin_example".$ID;
|
||||||
@ -529,27 +524,34 @@ function plugin_planning_populate_example($parm) {
|
|||||||
|
|
||||||
// Display the planning item
|
// Display the planning item
|
||||||
function plugin_display_planning_example($parm) {
|
function plugin_display_planning_example($parm) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
// $parm["type"] say begin end in or from type
|
// $parm["type"] say begin end in or from type
|
||||||
// Add items in the items fields of the parm array
|
// Add items in the items fields of the parm array
|
||||||
switch ($parm["type"]) {
|
switch ($parm["type"]) {
|
||||||
case "in" :
|
case "in" :
|
||||||
echo date("H:i",strtotime($parm["begin"]))." -> ".date("H:i", strtotime($parm["end"])).": ";
|
//TRANS: %1$s is the start time of a planned item, %2$s is the end and %3$s is its name
|
||||||
|
printf(__('From %1$s to %2$s: %3$s'),date("H:i",strtotime($parm["begin"])),
|
||||||
|
date("H:i",strtotime($parm["end"])),
|
||||||
|
Html::resume_text($parm["name"],80)) ;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "from" :
|
case "through" :
|
||||||
|
echo Html::resume_text($val["name"],80);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "begin" :
|
case "begin" :
|
||||||
echo $LANG["buttons"][33]." ".date("H:i", strtotime($parm["begin"])).": ";
|
//TRANS: %1$s is the start time of a planned item, %2$s is its name
|
||||||
|
printf(__('Start at %1$s: %2$s'),date("H:i",strtotime($parm["begin"])),
|
||||||
|
Html::resume_text($parm["name"],80)) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "end" :
|
case "end" :
|
||||||
echo $LANG["buttons"][32]." ".date("H:i",strtotime($parm["end"])).": ";
|
//TRANS: %1$s is the end time of a planned item and %2$s is its name
|
||||||
break;
|
printf(__('End at %1$s: %2$s'),date("H:i",strtotime($parm["end"])),
|
||||||
|
Html::resume_text($parm["name"],80)) ;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
echo $parm["name"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -560,7 +562,7 @@ function plugin_get_headings_example($item, $withtemplate) {
|
|||||||
case 'Profile' :
|
case 'Profile' :
|
||||||
$prof = new Profile();
|
$prof = new Profile();
|
||||||
if ($item->fields['interface'] == 'central') {
|
if ($item->fields['interface'] == 'central') {
|
||||||
return array(1 => "Test PLugin");
|
return array(1 => __("Test PLugin"));
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
@ -570,20 +572,20 @@ function plugin_get_headings_example($item, $withtemplate) {
|
|||||||
return array();
|
return array();
|
||||||
// Non template case / editing an existing object
|
// Non template case / editing an existing object
|
||||||
}
|
}
|
||||||
return array(1 => "Test PLugin");
|
return array(1 => __("Test PLugin"));
|
||||||
|
|
||||||
case 'ComputerDisk' :
|
case 'ComputerDisk' :
|
||||||
case 'Supplier' :
|
case 'Supplier' :
|
||||||
if ($item->getField('id')) { // Not in create mode
|
if ($item->getField('id')) { // Not in create mode
|
||||||
return array(1 => "Test PLugin",
|
return array(1 => __("Test PLugin"),
|
||||||
2 => "Test PLugin 2");
|
2 => __("Test PLugin 2"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Central' :
|
case 'Central' :
|
||||||
case 'Preference':
|
case 'Preference':
|
||||||
case 'Notification':
|
case 'Notification':
|
||||||
return array(1 => "Test PLugin");
|
return array(1 => __("Test PLugin"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -613,13 +615,12 @@ function plugin_headings_actions_example($item) {
|
|||||||
|
|
||||||
// Example of an action heading
|
// Example of an action heading
|
||||||
function plugin_headings_example($item, $withtemplate=0) {
|
function plugin_headings_example($item, $withtemplate=0) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
if (!$withtemplate) {
|
if (!$withtemplate) {
|
||||||
echo "<div class='center'>";
|
echo "<div class='center'>";
|
||||||
switch (get_class($item)) {
|
switch (get_class($item)) {
|
||||||
case 'Central' :
|
case 'Central' :
|
||||||
echo "Plugin central action ".$LANG['plugin_example']["test"];
|
_e("Plugin central action");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Preference' :
|
case 'Preference' :
|
||||||
@ -642,11 +643,11 @@ function plugin_headings_example($item, $withtemplate=0) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Notification' :
|
case 'Notification' :
|
||||||
echo "Plugin mailing action ".$LANG['plugin_example']["test"];
|
_e("Plugin mailing action");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
echo "Plugin function with headings CLASS=".get_class($item)." id=".$item->getField('id');
|
printf(__("Plugin function with headings CLASS=%1$s id=%1$d"),get_class($item),$item->getField('id'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
@ -38,9 +38,8 @@ class PluginExampleDropdown extends CommonDropdown {
|
|||||||
|
|
||||||
|
|
||||||
static function getTypeName() {
|
static function getTypeName() {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
return "Plugin Example Dropdown";
|
return __('Plugin Example Dropdown');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -63,28 +63,27 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
|
|
||||||
|
|
||||||
function getSearchOptions() {
|
function getSearchOptions() {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
$tab['common'] = "Header Needed";
|
$tab['common'] = "Header Needed";
|
||||||
|
|
||||||
$tab[1]['table'] = 'glpi_plugin_example_examples';
|
$tab[1]['table'] = 'glpi_plugin_example_examples';
|
||||||
$tab[1]['field'] = 'name';
|
$tab[1]['field'] = 'name';
|
||||||
$tab[1]['name'] = $LANG['plugin_example']["name"];
|
$tab[1]['name'] = __('Name');
|
||||||
|
|
||||||
$tab[2]['table'] = 'glpi_plugin_example_dropdowns';
|
$tab[2]['table'] = 'glpi_plugin_example_dropdowns';
|
||||||
$tab[2]['field'] = 'name';
|
$tab[2]['field'] = 'name';
|
||||||
$tab[2]['name'] = 'Dropdown';
|
$tab[2]['name'] = __('Dropdown');
|
||||||
|
|
||||||
$tab[3]['table'] = 'glpi_plugin_example_examples';
|
$tab[3]['table'] = 'glpi_plugin_example_examples';
|
||||||
$tab[3]['field'] = 'serial';
|
$tab[3]['field'] = 'serial';
|
||||||
$tab[3]['name'] = 'Serial';
|
$tab[3]['name'] = __('Serial number');
|
||||||
$tab[3]['usehaving'] = true;
|
$tab[3]['usehaving'] = true;
|
||||||
$tab[3]['searchtype'] = 'equals';
|
$tab[3]['searchtype'] = 'equals';
|
||||||
|
|
||||||
$tab[30]['table'] = 'glpi_plugin_example_examples';
|
$tab[30]['table'] = 'glpi_plugin_example_examples';
|
||||||
$tab[30]['field'] = 'id';
|
$tab[30]['field'] = 'id';
|
||||||
$tab[30]['name'] = $LANG["common"][2];
|
$tab[30]['name'] = __('ID');
|
||||||
|
|
||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
@ -98,12 +97,11 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
* @return array of strings
|
* @return array of strings
|
||||||
*/
|
*/
|
||||||
static function cronInfo($name) {
|
static function cronInfo($name) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'Sample' :
|
case 'Sample' :
|
||||||
return array('description' => $LANG['plugin_example']['test']." (class)",
|
return array('description' => __('Cron description for example'),
|
||||||
'parameter' => $LANG['plugin_example']['test']);
|
'parameter' => __('Cron parameter for example'));
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
@ -148,16 +146,15 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
|
|
||||||
|
|
||||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
if (!$withtemplate) {
|
if (!$withtemplate) {
|
||||||
switch ($item->getType()) {
|
switch ($item->getType()) {
|
||||||
case 'Phone' :
|
case 'Phone' :
|
||||||
if ($_SESSION['glpishow_count_on_tabs']) {
|
if ($_SESSION['glpishow_count_on_tabs']) {
|
||||||
return self::createTabEntry('Example',
|
return self::createTabEntry(__('Example'),
|
||||||
countElementsInTable($this->getTable()));
|
countElementsInTable($this->getTable()));
|
||||||
}
|
}
|
||||||
return 'Example';
|
return __('Example');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@ -173,7 +170,6 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function getSpecificValueToDisplay($field, $values, $options=array()) {
|
static function getSpecificValueToDisplay($field, $values, $options=array()) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
$values = array($field => $values);
|
$values = array($field => $values);
|
||||||
|
@ -40,9 +40,9 @@ class PluginExampleNotificationTargetExample extends NotificationTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDatasForTemplate($event, $options=array()) {
|
function getDatasForTemplate($event, $options=array()) {
|
||||||
global $DB, $LANG, $CFG_GLPI;
|
global $DB, $CFG_GLPI;
|
||||||
|
|
||||||
$this->datas['##example.name##'] = 'Example';
|
$this->datas['##example.name##'] = __('Example');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -62,11 +62,10 @@ class PluginExampleRuleTest extends Rule {
|
|||||||
|
|
||||||
|
|
||||||
function getCriterias() {
|
function getCriterias() {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
$criterias = array();
|
$criterias = array();
|
||||||
$criterias['name']['field'] = 'name';
|
$criterias['name']['field'] = 'name';
|
||||||
$criterias['name']['name'] = $LANG['help'][31];
|
$criterias['name']['name'] = __('Software');
|
||||||
$criterias['name']['table'] = 'glpi_softwares';
|
$criterias['name']['table'] = 'glpi_softwares';
|
||||||
|
|
||||||
return $criterias;
|
return $criterias;
|
||||||
@ -74,10 +73,9 @@ class PluginExampleRuleTest extends Rule {
|
|||||||
|
|
||||||
|
|
||||||
function getActions() {
|
function getActions() {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
$actions['softwarecategories_id']['name'] = $LANG['common'][36];
|
$actions['softwarecategories_id']['name'] = __('Category (class)');
|
||||||
$actions['softwarecategories_id']['type'] = 'dropdown';
|
$actions['softwarecategories_id']['type'] = 'dropdown';
|
||||||
$actions['softwarecategories_id']['table'] = 'glpi_softwarecategories';
|
$actions['softwarecategories_id']['table'] = 'glpi_softwarecategories';
|
||||||
return $actions;
|
return $actions;
|
||||||
|
BIN
locales/en_GB.mo
Normal file
BIN
locales/en_GB.mo
Normal file
Binary file not shown.
177
locales/en_GB.po
Normal file
177
locales/en_GB.po
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: GLPI Project - example plugin\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2011-12-20 10:59+0100\n"
|
||||||
|
"PO-Revision-Date: 2011-12-20 09:32+0000\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: en_GB\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||||
|
|
||||||
|
#: config.php:49
|
||||||
|
msgid "This is the plugin config page"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:63 inc/dropdown.class.php:42
|
||||||
|
msgid "Plugin Example Dropdown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:79
|
||||||
|
msgid "Example plugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:273
|
||||||
|
msgid "plugin_example_DoIt"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:277
|
||||||
|
msgid "Add a document"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:278
|
||||||
|
msgid "Do Nothing - just for fun"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:294 hook.php:304
|
||||||
|
msgid "but do nothing :)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:320 hook.php:335
|
||||||
|
msgid "Right it is the type I want..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:321 hook.php:336
|
||||||
|
msgid "But... I say I will do nothing for:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:363 hook.php:374
|
||||||
|
msgid "Not really specific - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:395
|
||||||
|
msgid "Not really specific - Use your own dropdown - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:418
|
||||||
|
msgid "Pre Update Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:425
|
||||||
|
#, php-format
|
||||||
|
msgid "Update Computer Hook (%s)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:433
|
||||||
|
msgid "Empty Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:442
|
||||||
|
msgid "Pre Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:449
|
||||||
|
msgid "Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:458
|
||||||
|
msgid "Pre Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:465
|
||||||
|
msgid "Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:474
|
||||||
|
msgid "Pre Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:482
|
||||||
|
msgid "Pre Restore Phone Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:489
|
||||||
|
msgid "Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. TRANS: %1$s is the source type, %2$d is the source ID, %3$d is the
|
||||||
|
#. destination ID
|
||||||
|
#: hook.php:497
|
||||||
|
#, php-format
|
||||||
|
msgid "Transfer Computer Hook %1$s %2$d -> %3$d"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:516
|
||||||
|
msgid "test planning example 1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:565 hook.php:575 hook.php:580 hook.php:588
|
||||||
|
msgid "Test PLugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:581
|
||||||
|
msgid "Test PLugin 2"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:623
|
||||||
|
msgid "Plugin central action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:646
|
||||||
|
msgid "Plugin mailing action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:66
|
||||||
|
msgid "Test link"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:196
|
||||||
|
msgid "Installed / not configured"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:48
|
||||||
|
msgid "Test rules engine"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:53
|
||||||
|
msgid "Cache informations"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:76
|
||||||
|
msgid "Dropdown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:80
|
||||||
|
msgid "Serial number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:103
|
||||||
|
msgid "Cron description for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:104
|
||||||
|
msgid "Cron parameter for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:154 inc/example.class.php:157
|
||||||
|
#: inc/notificationtargetexample.class.php:45
|
||||||
|
msgid "Example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:68
|
||||||
|
msgid "Software"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:78
|
||||||
|
msgid "Category (class)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
BIN
locales/fr_FR.mo
Normal file
BIN
locales/fr_FR.mo
Normal file
Binary file not shown.
178
locales/fr_FR.po
Normal file
178
locales/fr_FR.po
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
#
|
||||||
|
# Translators:
|
||||||
|
# DOMBRE Julien <moyo@indepnet.net>, 2011.
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: GLPI Project - example plugin\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2011-12-20 10:59+0100\n"
|
||||||
|
"PO-Revision-Date: 2011-12-20 09:59+0000\n"
|
||||||
|
"Last-Translator: DOMBRE Julien <moyo@indepnet.net>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: fr_FR\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
|
||||||
|
|
||||||
|
#: config.php:49
|
||||||
|
msgid "This is the plugin config page"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:63 inc/dropdown.class.php:42
|
||||||
|
msgid "Plugin Example Dropdown"
|
||||||
|
msgstr "Dropdown du plugin example"
|
||||||
|
|
||||||
|
#: hook.php:79
|
||||||
|
msgid "Example plugin"
|
||||||
|
msgstr "Plugin Example"
|
||||||
|
|
||||||
|
#: hook.php:273
|
||||||
|
msgid "plugin_example_DoIt"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:277
|
||||||
|
msgid "Add a document"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:278
|
||||||
|
msgid "Do Nothing - just for fun"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:294 hook.php:304
|
||||||
|
msgid "but do nothing :)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:320 hook.php:335
|
||||||
|
msgid "Right it is the type I want..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:321 hook.php:336
|
||||||
|
msgid "But... I say I will do nothing for:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:363 hook.php:374
|
||||||
|
msgid "Not really specific - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:395
|
||||||
|
msgid "Not really specific - Use your own dropdown - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:418
|
||||||
|
msgid "Pre Update Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:425
|
||||||
|
#, php-format
|
||||||
|
msgid "Update Computer Hook (%s)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:433
|
||||||
|
msgid "Empty Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:442
|
||||||
|
msgid "Pre Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:449
|
||||||
|
msgid "Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:458
|
||||||
|
msgid "Pre Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:465
|
||||||
|
msgid "Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:474
|
||||||
|
msgid "Pre Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:482
|
||||||
|
msgid "Pre Restore Phone Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:489
|
||||||
|
msgid "Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. TRANS: %1$s is the source type, %2$d is the source ID, %3$d is the
|
||||||
|
#. destination ID
|
||||||
|
#: hook.php:497
|
||||||
|
#, php-format
|
||||||
|
msgid "Transfer Computer Hook %1$s %2$d -> %3$d"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:516
|
||||||
|
msgid "test planning example 1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:565 hook.php:575 hook.php:580 hook.php:588
|
||||||
|
msgid "Test PLugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:581
|
||||||
|
msgid "Test PLugin 2"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:623
|
||||||
|
msgid "Plugin central action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:646
|
||||||
|
msgid "Plugin mailing action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:66
|
||||||
|
msgid "Test link"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:196
|
||||||
|
msgid "Installed / not configured"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:48
|
||||||
|
msgid "Test rules engine"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:53
|
||||||
|
msgid "Cache informations"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:76
|
||||||
|
msgid "Dropdown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:80
|
||||||
|
msgid "Serial number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:103
|
||||||
|
msgid "Cron description for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:104
|
||||||
|
msgid "Cron parameter for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:154 inc/example.class.php:157
|
||||||
|
#: inc/notificationtargetexample.class.php:45
|
||||||
|
msgid "Example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:68
|
||||||
|
msgid "Software"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:78
|
||||||
|
msgid "Category (class)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
174
locales/glpi.pot
Normal file
174
locales/glpi.pot
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2011-12-20 10:59+0100\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: config.php:49
|
||||||
|
msgid "This is the plugin config page"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:63 inc/dropdown.class.php:42
|
||||||
|
msgid "Plugin Example Dropdown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:79
|
||||||
|
msgid "Example plugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:273
|
||||||
|
msgid "plugin_example_DoIt"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:277
|
||||||
|
msgid "Add a document"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:278
|
||||||
|
msgid "Do Nothing - just for fun"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:294 hook.php:304
|
||||||
|
msgid "but do nothing :)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:320 hook.php:335
|
||||||
|
msgid "Right it is the type I want..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:321 hook.php:336
|
||||||
|
msgid "But... I say I will do nothing for:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:363 hook.php:374
|
||||||
|
msgid "Not really specific - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:395
|
||||||
|
msgid "Not really specific - Use your own dropdown - Just for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:418
|
||||||
|
msgid "Pre Update Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:425
|
||||||
|
#, php-format
|
||||||
|
msgid "Update Computer Hook (%s)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:433
|
||||||
|
msgid "Empty Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:442
|
||||||
|
msgid "Pre Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:449
|
||||||
|
msgid "Delete Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:458
|
||||||
|
msgid "Pre Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:465
|
||||||
|
msgid "Purge Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:474
|
||||||
|
msgid "Pre Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:482
|
||||||
|
msgid "Pre Restore Phone Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:489
|
||||||
|
msgid "Restore Computer Hook"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. TRANS: %1$s is the source type, %2$d is the source ID, %3$d is the destination ID
|
||||||
|
#: hook.php:497
|
||||||
|
#, php-format
|
||||||
|
msgid "Transfer Computer Hook %1$s %2$d -> %3$d"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:516
|
||||||
|
msgid "test planning example 1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:565 hook.php:575 hook.php:580 hook.php:588
|
||||||
|
msgid "Test PLugin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:581
|
||||||
|
msgid "Test PLugin 2"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:623
|
||||||
|
msgid "Plugin central action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: hook.php:646
|
||||||
|
msgid "Plugin mailing action"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:66
|
||||||
|
msgid "Test link"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: setup.php:196
|
||||||
|
msgid "Installed / not configured"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:48
|
||||||
|
msgid "Test rules engine"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: front/popup.php:53
|
||||||
|
msgid "Cache informations"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:76
|
||||||
|
msgid "Dropdown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:80
|
||||||
|
msgid "Serial number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:103
|
||||||
|
msgid "Cron description for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:104
|
||||||
|
msgid "Cron parameter for example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/example.class.php:154 inc/example.class.php:157
|
||||||
|
#: inc/notificationtargetexample.class.php:45
|
||||||
|
msgid "Example"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:68
|
||||||
|
msgid "Software"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: inc/ruletest.class.php:78
|
||||||
|
msgid "Category (class)"
|
||||||
|
msgstr ""
|
20
setup.php
20
setup.php
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
// Init the hooks of the plugins -Needed
|
// Init the hooks of the plugins -Needed
|
||||||
function plugin_init_example() {
|
function plugin_init_example() {
|
||||||
global $PLUGIN_HOOKS,$LANG,$CFG_GLPI;
|
global $PLUGIN_HOOKS,$CFG_GLPI;
|
||||||
|
|
||||||
// Params : plugin name - string type - ID - Array of attributes
|
// Params : plugin name - string type - ID - Array of attributes
|
||||||
// No specific information passed so not needed
|
// No specific information passed so not needed
|
||||||
@ -62,8 +62,8 @@ function plugin_init_example() {
|
|||||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['search'] = '/plugins/example/front/example.php';
|
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['search'] = '/plugins/example/front/example.php';
|
||||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['add'] = '/plugins/example/front/example.form.php';
|
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['add'] = '/plugins/example/front/example.form.php';
|
||||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['config'] = '/plugins/example/index.php';
|
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['config'] = '/plugins/example/index.php';
|
||||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']["<img src='".$CFG_GLPI["root_doc"]."/pics/menu_showall.png' title='".$LANG['plugin_example']["test"]."' alt='".$LANG['plugin_example']["test"]."'>"] = '/plugins/example/index.php';
|
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']["<img src='".$CFG_GLPI["root_doc"]."/pics/menu_showall.png' title='".__s('Show all')."' alt='".__s('Show all')."'>"] = '/plugins/example/index.php';
|
||||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][$LANG['plugin_example']["test"]] = '/plugins/example/index.php';
|
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][__s('Test link')] = '/plugins/example/index.php';
|
||||||
|
|
||||||
$PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true;
|
$PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true;
|
||||||
}
|
}
|
||||||
@ -165,11 +165,11 @@ function plugin_init_example() {
|
|||||||
function plugin_version_example() {
|
function plugin_version_example() {
|
||||||
|
|
||||||
return array('name' => 'Plugin Example',
|
return array('name' => 'Plugin Example',
|
||||||
'version' => '5.0',
|
'version' => '6.0',
|
||||||
'author' => 'Julien Dombre',
|
'author' => 'GLPI developer team',
|
||||||
'license' => 'GPLv2+',
|
'license' => 'GPLv2+',
|
||||||
'homepage' => 'https://forge.indepnet.net/projects/example',
|
'homepage' => 'https://forge.indepnet.net/projects/example',
|
||||||
'minGlpiVersion' => '0.83');// For compatibility / no install in version < 0.80
|
'minGlpiVersion' => '0.84');// For compatibility / no install in version < 0.80
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,8 +177,8 @@ function plugin_version_example() {
|
|||||||
function plugin_example_check_prerequisites() {
|
function plugin_example_check_prerequisites() {
|
||||||
|
|
||||||
// Strict version check (could be less strict, or could allow various version)
|
// Strict version check (could be less strict, or could allow various version)
|
||||||
if (version_compare(GLPI_VERSION,'0.83','lt') || version_compare(GLPI_VERSION,'0.84','ge')) {
|
if (version_compare(GLPI_VERSION,'0.84','lt') /*|| version_compare(GLPI_VERSION,'0.84','gt')*/) {
|
||||||
echo "This plugin requires GLPI >= 0.83";
|
echo "This plugin requires GLPI >= 0.84";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -188,14 +188,12 @@ function plugin_example_check_prerequisites() {
|
|||||||
// Check configuration process for plugin : need to return true if succeeded
|
// Check configuration process for plugin : need to return true if succeeded
|
||||||
// Can display a message only if failure and $verbose is true
|
// Can display a message only if failure and $verbose is true
|
||||||
function plugin_example_check_config($verbose=false) {
|
function plugin_example_check_config($verbose=false) {
|
||||||
global $LANG;
|
|
||||||
|
|
||||||
if (true) { // Your configuration check
|
if (true) { // Your configuration check
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verbose) {
|
if ($verbose) {
|
||||||
echo $LANG['plugins'][2];
|
_e('Installed / not configured');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
18
tools/extract_template.sh
Executable file
18
tools/extract_template.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
soft='GLPI - Example plugin'
|
||||||
|
version='0.84'
|
||||||
|
email=glpi-translation@gna.org
|
||||||
|
copyright='INDEPNET Development Team'
|
||||||
|
|
||||||
|
#xgettext *.php */*.php -copyright-holder='$copyright' --package-name=$soft --package-version=$version --msgid-bugs-address=$email -o locales/en_GB.po -L PHP --from-code=UTF-8 --force-po -i --keyword=_n:1,2 --keyword=__ --keyword=_e
|
||||||
|
|
||||||
|
xgettext *.php */*.php --exclude-file=../../locales/glpi.pot -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po --keyword=_n:1,2 --keyword=__s --keyword=__ --keyword=_e
|
||||||
|
|
||||||
|
|
||||||
|
### for using tx :
|
||||||
|
##tx set --execute --auto-local -r GLPI.glpipot 'locales/<lang>.po' --source-lang en --source-file locales/glpi.pot
|
||||||
|
## tx push -s
|
||||||
|
## tx pull -a
|
||||||
|
|
||||||
|
|
29
tools/update_mo.pl
Executable file
29
tools/update_mo.pl
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
if (@ARGV!=0){
|
||||||
|
print "USAGE update_mo.pl\n\n";
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n";
|
||||||
|
foreach (readdir(DIRHANDLE)){
|
||||||
|
if ($_ ne '..' && $_ ne '.'){
|
||||||
|
|
||||||
|
if(!(-l "$dir/$_")){
|
||||||
|
if (index($_,".po",0)==length($_)-3) {
|
||||||
|
$lang=$_;
|
||||||
|
$lang=~s/\.po//;
|
||||||
|
|
||||||
|
`msgfmt locales/$_ -o locales/$lang.mo`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir DIRHANDLE;
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
30
tools/update_po.pl
Executable file
30
tools/update_po.pl
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
if (@ARGV!=2){
|
||||||
|
print "USAGE update_po.pl transifex_login transifex_password\n\n";
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$user = $ARGV[0];
|
||||||
|
$password = $ARGV[1];
|
||||||
|
|
||||||
|
opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n";
|
||||||
|
foreach (readdir(DIRHANDLE)){
|
||||||
|
if ($_ ne '..' && $_ ne '.'){
|
||||||
|
|
||||||
|
if(!(-l "$dir/$_")){
|
||||||
|
if (index($_,".po",0)==length($_)-3) {
|
||||||
|
$lang=$_;
|
||||||
|
$lang=~s/\.po//;
|
||||||
|
|
||||||
|
`wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.net/api/2/project/GLPI_example/resource/glpipot/translation/$lang/?file=$_`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir DIRHANDLE;
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
Loading…
x
Reference in New Issue
Block a user