diff --git a/config.php b/config.php index 1924cc2..a6a1360 100755 --- a/config.php +++ b/config.php @@ -46,7 +46,6 @@ Session::checkRight("config", "w"); Plugin::load('example'); Html::header("TITRE",$_SERVER['PHP_SELF'],"config","plugins"); -echo "This is the plugin config page
"; -echo $LANG['plugin_example']["test"]; +_e("This is the plugin config page"); Html::footer(); ?> \ No newline at end of file diff --git a/front/popup.php b/front/popup.php index 4b53cfa..a7b4179 100644 --- a/front/popup.php +++ b/front/popup.php @@ -40,21 +40,21 @@ if (isset($_GET["popup"])) { if (isset($_SESSION["glpipopup"]["name"])) { switch ($_SESSION["glpipopup"]["name"]) { case "test_rule" : - Html::popHeader($LANG['buttons'][50],$_SERVER['PHP_SELF']); + Html::popHeader(__('Test'),$_SERVER['PHP_SELF']); include "../../../front/rule.test.php"; break; 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"; break; case "show_cache" : - Html::popHeader($LANG['rulesengine'][100],$_SERVER['PHP_SELF']); + Html::popHeader(__('Cache informations'),$_SERVER['PHP_SELF']); include "../../../front/rule.cache.php"; break; } - echo "

".$LANG['buttons'][13].""; + echo "

".__('Back').""; echo "
"; Html::popFooter(); } diff --git a/hook.php b/hook.php index aa18a03..7d14c30 100644 --- a/hook.php +++ b/hook.php @@ -60,7 +60,7 @@ function plugin_example_getDatabaseRelations() { // Define Dropdown tables to be manage in GLPI : function plugin_example_getDropdown() { // 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) function plugin_example_getAddSearchOptions($itemtype) { - global $LANG; $sopt = array(); if ($itemtype == 'Computer') { @@ -77,7 +76,7 @@ function plugin_example_getAddSearchOptions($itemtype) { $sopt[1001]['table'] = 'glpi_plugin_example_dropdowns'; $sopt[1001]['field'] = 'name'; $sopt[1001]['linkfield'] = 'plugin_example_dropdowns_id'; - $sopt[1001]['name'] = 'Example plugin'; + $sopt[1001]['name'] = __('Example plugin'); } return $sopt; } @@ -267,17 +266,16 @@ function plugin_example_addOrderBy($type,$ID,$order,$key=0) { // Define actions : function plugin_example_MassiveActions($type) { - global $LANG; switch ($type) { // New action for core and other plugin types : name = plugin_PLUGINNAME_actionname 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 case 'PluginExampleExample' : - return array("add_document" => $LANG["document"][16], // GLPI core one - "do_nothing" => 'Do Nothing - just for fun'); // Specific one + return array("add_document" => __('Add a document'), // GLPI core one + "do_nothing" => __('Do Nothing - just for fun')); // Specific one } return array(); } @@ -286,7 +284,6 @@ function plugin_example_MassiveActions($type) { // How to display specific actions ? // options contain at least itemtype and and action function plugin_example_MassiveActionsDisplay($options=array()) { - global $LANG; switch ($options['itemtype']) { case 'Computer' : @@ -294,7 +291,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) { case "plugin_example_DoIt" : echo " ". " but do nothing :)"; + __s('Post')."'> ".__('but do nothing :)'); break; } break; @@ -304,7 +301,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) { // No case for add_document : use GLPI core one case "do_nothing" : echo "  but do nothing :)"; + __s('Post')."'> ".__('but do nothing :)'); break; } break; @@ -315,14 +312,13 @@ function plugin_example_MassiveActionsDisplay($options=array()) { // How to process specific actions ? function plugin_example_MassiveActionsProcess($data) { - global $LANG; switch ($data['action']) { case 'plugin_example_DoIt' : if ($data['itemtype'] == 'Computer') { $comp = new Computer(); - Session::addMessageAfterRedirect("Right it is the type I want..."); - Session::addMessageAfterRedirect("But... I say I will do nothing for :"); + Session::addMessageAfterRedirect(__("Right it is the type I want...")); + Session::addMessageAfterRedirect(__("But... I say I will do nothing for:")); foreach ($data['item'] as $key => $val) { if ($val == 1) { if ($comp->getFromDB($key)) { @@ -336,8 +332,8 @@ function plugin_example_MassiveActionsProcess($data) { case 'do_nothing' : if ($data['itemtype'] == 'PluginExampleExample') { $ex = new PluginExampleExample(); - Session::addMessageAfterRedirect("Right it is the type I want..."); - Session::addMessageAfterRedirect("But... I say I will do nothing for :"); + Session::addMessageAfterRedirect(__("Right it is the type I want...")); + Session::addMessageAfterRedirect(__("But... I say I will do nothing for:")); foreach ($data['item'] as $key => $val) { if ($val == 1) { if ($ex->getFromDB($key)) { @@ -364,7 +360,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) { // Table fields switch ($table.".".$field) { 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); // Dropdown::showYesNo($linkfield); // Need to return true if specific display @@ -375,7 +371,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) { // Linked Fields switch ($table.".".$field) { 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 return true; } @@ -389,15 +385,14 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) { // options must contain at least itemtype and options array // MUST Use a specific AddWhere & $tab[X]['searchtype'] = 'equals'; declaration function plugin_example_searchOptionsValues($options=array()) { - global $LANG; - + $table = $options['searchoption']['table']; $field = $options['searchoption']['field']; // Table fields switch ($table.".".$field) { 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']), array('value' => $options['value'], 'name' => $options['name'], @@ -420,14 +415,14 @@ function plugin_pre_item_update_example($item) { } $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 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; } @@ -435,7 +430,7 @@ function plugin_item_update_example($item) { // Hook done on get empty item case function plugin_item_empty_example($item) { - Session::addMessageAfterRedirect("Empty Computer Hook",true); + Session::addMessageAfterRedirect(__("Empty Computer Hook"),true); return true; } @@ -444,14 +439,14 @@ function plugin_item_empty_example($item) { function plugin_pre_item_delete_example($object) { // Manipulate data if needed - Session::addMessageAfterRedirect("Pre Delete Computer Hook",true); + Session::addMessageAfterRedirect(__("Pre Delete Computer Hook"),true); } // Hook done on delete item case function plugin_item_delete_example($object) { - Session::addMessageAfterRedirect("Delete Computer Hook",true); + Session::addMessageAfterRedirect(__("Delete Computer Hook"),true); return true; } @@ -460,14 +455,14 @@ function plugin_item_delete_example($object) { function plugin_pre_item_purge_example($object) { // Manipulate data if needed - Session::addMessageAfterRedirect("Pre Purge Computer Hook",true); + Session::addMessageAfterRedirect(__("Pre Purge Computer Hook"),true); } // Hook done on purge item case function plugin_item_purge_example($object) { - Session::addMessageAfterRedirect("Purge Computer Hook",true); + Session::addMessageAfterRedirect(__("Purge Computer Hook"),true); return true; } @@ -476,7 +471,7 @@ function plugin_item_purge_example($object) { function plugin_pre_item_restore_example($item) { // 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) { // Manipulate data if needed - Session::addMessageAfterRedirect("Pre Restore Phone Hook"); + Session::addMessageAfterRedirect(__("Pre Restore Phone Hook")); } // Hook done on restore item case function plugin_item_restore_example($item) { - Session::addMessageAfterRedirect("Restore Computer Hook"); + Session::addMessageAfterRedirect(__("Restore Computer Hook")); return true; } // Hook done on restore item case function plugin_item_transfer_example($parm) { - - Session::addMessageAfterRedirect("Transfer Computer Hook ".$parm['type']." ".$parm['id']." -> ". - $parm['newID']); + //TRANS: %1$s is the source type, %2$d is the source ID, %3$d is the destination ID + Session::addMessageAfterRedirect(sprintf(__('Transfer Computer Hook %1$s %2$d -> %3$d'),$parm['type'],$parm['id'], + $parm['newID'])); 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"]["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"]["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 $ID = date("Ymd"); // Current date for example $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["planningID"] = "plugin_example".$ID; @@ -529,27 +524,34 @@ function plugin_planning_populate_example($parm) { // Display the planning item function plugin_display_planning_example($parm) { - global $LANG; // $parm["type"] say begin end in or from type // Add items in the items fields of the parm array switch ($parm["type"]) { 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; - case "from" : + case "through" : + echo Html::resume_text($val["name"],80); break; 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; case "end" : - echo $LANG["buttons"][32]." ".date("H:i",strtotime($parm["end"])).": "; - break; + //TRANS: %1$s is the end time of a planned item and %2$s is its name + 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' : $prof = new Profile(); if ($item->fields['interface'] == 'central') { - return array(1 => "Test PLugin"); + return array(1 => __("Test PLugin")); } return array(); @@ -570,20 +572,20 @@ function plugin_get_headings_example($item, $withtemplate) { return array(); // Non template case / editing an existing object } - return array(1 => "Test PLugin"); + return array(1 => __("Test PLugin")); case 'ComputerDisk' : case 'Supplier' : if ($item->getField('id')) { // Not in create mode - return array(1 => "Test PLugin", - 2 => "Test PLugin 2"); + return array(1 => __("Test PLugin"), + 2 => __("Test PLugin 2")); } break; case 'Central' : case 'Preference': case 'Notification': - return array(1 => "Test PLugin"); + return array(1 => __("Test PLugin")); } return false; } @@ -613,13 +615,12 @@ function plugin_headings_actions_example($item) { // Example of an action heading function plugin_headings_example($item, $withtemplate=0) { - global $LANG; if (!$withtemplate) { echo "
"; switch (get_class($item)) { case 'Central' : - echo "Plugin central action ".$LANG['plugin_example']["test"]; + _e("Plugin central action"); break; case 'Preference' : @@ -642,11 +643,11 @@ function plugin_headings_example($item, $withtemplate=0) { break; case 'Notification' : - echo "Plugin mailing action ".$LANG['plugin_example']["test"]; + _e("Plugin mailing action"); break; 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; } echo "
"; diff --git a/inc/dropdown.class.php b/inc/dropdown.class.php index 3348c41..739f7b3 100644 --- a/inc/dropdown.class.php +++ b/inc/dropdown.class.php @@ -38,9 +38,8 @@ class PluginExampleDropdown extends CommonDropdown { static function getTypeName() { - global $LANG; - return "Plugin Example Dropdown"; + return __('Plugin Example Dropdown'); } } ?> diff --git a/inc/example.class.php b/inc/example.class.php index a914004..eda54d6 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -63,28 +63,27 @@ class PluginExampleExample extends CommonDBTM { function getSearchOptions() { - global $LANG; $tab = array(); $tab['common'] = "Header Needed"; $tab[1]['table'] = 'glpi_plugin_example_examples'; $tab[1]['field'] = 'name'; - $tab[1]['name'] = $LANG['plugin_example']["name"]; + $tab[1]['name'] = __('Name'); $tab[2]['table'] = 'glpi_plugin_example_dropdowns'; $tab[2]['field'] = 'name'; - $tab[2]['name'] = 'Dropdown'; + $tab[2]['name'] = __('Dropdown'); $tab[3]['table'] = 'glpi_plugin_example_examples'; $tab[3]['field'] = 'serial'; - $tab[3]['name'] = 'Serial'; + $tab[3]['name'] = __('Serial number'); $tab[3]['usehaving'] = true; $tab[3]['searchtype'] = 'equals'; $tab[30]['table'] = 'glpi_plugin_example_examples'; $tab[30]['field'] = 'id'; - $tab[30]['name'] = $LANG["common"][2]; + $tab[30]['name'] = __('ID'); return $tab; } @@ -98,12 +97,11 @@ class PluginExampleExample extends CommonDBTM { * @return array of strings */ static function cronInfo($name) { - global $LANG; switch ($name) { case 'Sample' : - return array('description' => $LANG['plugin_example']['test']." (class)", - 'parameter' => $LANG['plugin_example']['test']); + return array('description' => __('Cron description for example'), + 'parameter' => __('Cron parameter for example')); } return array(); } @@ -148,16 +146,15 @@ class PluginExampleExample extends CommonDBTM { function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { - global $LANG; if (!$withtemplate) { switch ($item->getType()) { case 'Phone' : if ($_SESSION['glpishow_count_on_tabs']) { - return self::createTabEntry('Example', + return self::createTabEntry(__('Example'), countElementsInTable($this->getTable())); } - return 'Example'; + return __('Example'); } } return ''; @@ -173,7 +170,6 @@ class PluginExampleExample extends CommonDBTM { } static function getSpecificValueToDisplay($field, $values, $options=array()) { - global $LANG; if (!is_array($values)) { $values = array($field => $values); diff --git a/inc/notificationtargetexample.class.php b/inc/notificationtargetexample.class.php index 902484e..deb21ac 100644 --- a/inc/notificationtargetexample.class.php +++ b/inc/notificationtargetexample.class.php @@ -40,9 +40,9 @@ class PluginExampleNotificationTargetExample extends NotificationTarget { } function getDatasForTemplate($event, $options=array()) { - global $DB, $LANG, $CFG_GLPI; + global $DB, $CFG_GLPI; - $this->datas['##example.name##'] = 'Example'; + $this->datas['##example.name##'] = __('Example'); } } ?> \ No newline at end of file diff --git a/inc/ruletest.class.php b/inc/ruletest.class.php index a096bfc..84c1e40 100644 --- a/inc/ruletest.class.php +++ b/inc/ruletest.class.php @@ -62,11 +62,10 @@ class PluginExampleRuleTest extends Rule { function getCriterias() { - global $LANG; $criterias = array(); $criterias['name']['field'] = 'name'; - $criterias['name']['name'] = $LANG['help'][31]; + $criterias['name']['name'] = __('Software'); $criterias['name']['table'] = 'glpi_softwares'; return $criterias; @@ -74,10 +73,9 @@ class PluginExampleRuleTest extends Rule { function getActions() { - global $LANG; $actions = array(); - $actions['softwarecategories_id']['name'] = $LANG['common'][36]; + $actions['softwarecategories_id']['name'] = __('Category (class)'); $actions['softwarecategories_id']['type'] = 'dropdown'; $actions['softwarecategories_id']['table'] = 'glpi_softwarecategories'; return $actions; diff --git a/locales/en_GB.mo b/locales/en_GB.mo new file mode 100644 index 0000000..b9ae200 Binary files /dev/null and b/locales/en_GB.mo differ diff --git a/locales/en_GB.po b/locales/en_GB.po new file mode 100644 index 0000000..dfefafd --- /dev/null +++ b/locales/en_GB.po @@ -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 \n" +"Language-Team: LANGUAGE \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 "" + + diff --git a/locales/fr_FR.mo b/locales/fr_FR.mo new file mode 100644 index 0000000..11d22c0 Binary files /dev/null and b/locales/fr_FR.mo differ diff --git a/locales/fr_FR.po b/locales/fr_FR.po new file mode 100644 index 0000000..ee420e3 --- /dev/null +++ b/locales/fr_FR.po @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" + + diff --git a/locales/glpi.pot b/locales/glpi.pot new file mode 100644 index 0000000..efcda1c --- /dev/null +++ b/locales/glpi.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" diff --git a/setup.php b/setup.php index 18348cd..f798faf 100755 --- a/setup.php +++ b/setup.php @@ -35,7 +35,7 @@ // Init the hooks of the plugins -Needed function plugin_init_example() { - global $PLUGIN_HOOKS,$LANG,$CFG_GLPI; + global $PLUGIN_HOOKS,$CFG_GLPI; // Params : plugin name - string type - ID - Array of attributes // 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']['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']["".$LANG["] = '/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("] = '/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; } @@ -165,11 +165,11 @@ function plugin_init_example() { function plugin_version_example() { return array('name' => 'Plugin Example', - 'version' => '5.0', - 'author' => 'Julien Dombre', + 'version' => '6.0', + 'author' => 'GLPI developer team', 'license' => 'GPLv2+', '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() { // 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')) { - echo "This plugin requires GLPI >= 0.83"; + if (version_compare(GLPI_VERSION,'0.84','lt') /*|| version_compare(GLPI_VERSION,'0.84','gt')*/) { + echo "This plugin requires GLPI >= 0.84"; return false; } return true; @@ -188,14 +188,12 @@ function plugin_example_check_prerequisites() { // Check configuration process for plugin : need to return true if succeeded // Can display a message only if failure and $verbose is true function plugin_example_check_config($verbose=false) { - global $LANG; - if (true) { // Your configuration check return true; } if ($verbose) { - echo $LANG['plugins'][2]; + _e('Installed / not configured'); } return false; } diff --git a/tools/extract_template.sh b/tools/extract_template.sh new file mode 100755 index 0000000..fa5fcfc --- /dev/null +++ b/tools/extract_template.sh @@ -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/.po' --source-lang en --source-file locales/glpi.pot +## tx push -s +## tx pull -a + + diff --git a/tools/update_mo.pl b/tools/update_mo.pl new file mode 100755 index 0000000..ed44da6 --- /dev/null +++ b/tools/update_mo.pl @@ -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; + +# +# diff --git a/tools/update_po.pl b/tools/update_po.pl new file mode 100755 index 0000000..ce44ea7 --- /dev/null +++ b/tools/update_po.pl @@ -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; + +# +#