diff --git a/config.php b/config.php
index fdec6c2..e7c0482 100755
--- a/config.php
+++ b/config.php
@@ -45,6 +45,6 @@ Session::checkRight("config", "w");
Plugin::load('example');
Html::header("TITRE",$_SERVER['PHP_SELF'],"config","plugins");
-_e("This is the plugin config page");
+_e("This is the plugin config page", 'example');
Html::footer();
?>
\ No newline at end of file
diff --git a/front/popup.php b/front/popup.php
index 3dedd86..8857a89 100644
--- a/front/popup.php
+++ b/front/popup.php
@@ -49,7 +49,7 @@ if (isset($_SESSION["glpipopup"]["name"])) {
break;
case "show_cache" :
- Html::popHeader(__('Cache informations'),$_SERVER['PHP_SELF']);
+ Html::popHeader(__('Cache information'),$_SERVER['PHP_SELF']);
include "../../../front/rule.cache.php";
break;
}
diff --git a/hook.php b/hook.php
index da87c0e..ba770f7 100644
--- a/hook.php
+++ b/hook.php
@@ -59,7 +59,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", 'example'));
}
@@ -75,7 +75,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', 'example');
}
return $sopt;
}
@@ -263,18 +263,19 @@ function plugin_example_addOrderBy($type,$ID,$order,$key=0) {
//////////////////////////////
////// SPECIFIC MODIF MASSIVE FUNCTIONS ///////
+
// Define actions :
function plugin_example_MassiveActions($type) {
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", 'example'));
// Actions for types provided by the plugin
case 'PluginExampleExample' :
- return array("add_document" => __('Add a document'), // GLPI core one
- "do_nothing" => __('Do Nothing - just for fun')); // Specific one
+ return array("add_document" => _x('button', 'Add a document'), // GLPI core one
+ "do_nothing" => __('Do Nothing - just for fun', 'example')); // Specific one
}
return array();
}
@@ -290,7 +291,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
case "plugin_example_DoIt" :
echo " ".
" ".__('Write in item history');
+ __s('Post')."'> ".__('Write in item history', 'example');
break;
}
break;
@@ -300,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 :)', 'example');
break;
}
break;
@@ -321,8 +322,8 @@ function plugin_example_MassiveActionsProcess($data) {
case 'plugin_example_DoIt' :
if ($data['itemtype'] == 'Computer') {
$comp = new Computer();
- Session::addMessageAfterRedirect(__("Right it is the type I want..."));
- Session::addMessageAfterRedirect(__('Write in item history'));
+ Session::addMessageAfterRedirect(__("Right it is the type I want...", 'example'));
+ Session::addMessageAfterRedirect(__('Write in item history', 'example'));
$changes = array(0, 'old value', 'new value');
foreach ($data['item'] as $key => $val) {
if ($val == 1) {
@@ -342,8 +343,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...", 'example'));
+ Session::addMessageAfterRedirect(__("But... I say I will do nothing for:", 'example'));
foreach ($data['item'] as $key => $val) {
if ($val == 1) {
if ($ex->getFromDB($key)) {
@@ -378,7 +379,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
// Table fields
switch ($table.".".$field) {
case 'glpi_plugin_example_examples.serial' :
- _e("Not really specific - Just for example");
+ _e("Not really specific - Just for example", 'example');
//Html::autocompletionTextField($linkfield,$table,$field);
// Dropdown::showYesNo($linkfield);
// Need to return true if specific display
@@ -389,7 +390,7 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
// Linked Fields
switch ($table.".".$field) {
case "glpi_plugin_example_dropdowns.name" :
- _e("Not really specific - Just for example");
+ _e("Not really specific - Just for example", 'example');
// Need to return true if specific display
return true;
}
@@ -410,7 +411,7 @@ function plugin_example_searchOptionsValues($options=array()) {
// Table fields
switch ($table.".".$field) {
case "glpi_plugin_example_examples.serial" :
- _e("Not really specific - Use your own dropdown - Just for example");
+ _e("Not really specific - Use your own dropdown - Just for example", 'example');
Dropdown::show(getItemTypeForTable($options['searchoption']['table']),
array('value' => $options['value'],
'name' => $options['name'],
@@ -433,14 +434,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", 'example'), true);
}
// Hook done on update item case
function plugin_item_update_example($item) {
- Session::addMessageAfterRedirect(sprintf(__("Update Computer Hook (%s)"),implode(',',$item->updates)), true);
+ Session::addMessageAfterRedirect(sprintf(__("Update Computer Hook (%s)", 'example'),implode(',',$item->updates)), true);
return true;
}
@@ -448,7 +449,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", 'example'),true);
return true;
}
@@ -457,14 +458,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", 'example'),true);
}
// Hook done on delete item case
function plugin_item_delete_example($object) {
- Session::addMessageAfterRedirect(__("Delete Computer Hook"),true);
+ Session::addMessageAfterRedirect(__("Delete Computer Hook", 'example'),true);
return true;
}
@@ -473,14 +474,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", 'example'),true);
}
// Hook done on purge item case
function plugin_item_purge_example($object) {
- Session::addMessageAfterRedirect(__("Purge Computer Hook"),true);
+ Session::addMessageAfterRedirect(__("Purge Computer Hook", 'example'),true);
return true;
}
@@ -489,7 +490,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", 'example'));
}
@@ -497,14 +498,14 @@ 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", 'example'));
}
// Hook done on restore item case
function plugin_item_restore_example($item) {
- Session::addMessageAfterRedirect(__("Restore Computer Hook"));
+ Session::addMessageAfterRedirect(__("Restore Computer Hook", 'example'));
return true;
}
@@ -512,7 +513,7 @@ function plugin_item_restore_example($item) {
// Hook done on restore item case
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(sprintf(__('Transfer Computer Hook %1$s %2$d -> %3$d'),$parm['type'],$parm['id'],
+ Session::addMessageAfterRedirect(sprintf(__('Transfer Computer Hook %1$s %2$d -> %3$d', 'example'),$parm['type'],$parm['id'],
$parm['newID']));
return false;
@@ -648,12 +649,12 @@ function plugin_example_AssignToTicket($types) {
function plugin_example_get_events(NotificationTargetTicket $target) {
- $target->events['plugin_example'] = "Example event";
+ $target->events['plugin_example'] = __("Example event", 'example');
}
function plugin_example_get_datas(NotificationTargetTicket $target) {
- $target->datas['##ticket.example##'] = "Example datas";
+ $target->datas['##ticket.example##'] = __("Example datas", 'example');
}
diff --git a/inc/dropdown.class.php b/inc/dropdown.class.php
index e0cdc53..8b5f8d1 100644
--- a/inc/dropdown.class.php
+++ b/inc/dropdown.class.php
@@ -39,9 +39,9 @@ class PluginExampleDropdown extends CommonDropdown {
static function getTypeName($nb=0) {
if ($nb > 0) {
- return __('Plugin Example Dropdowns');
+ return __('Plugin Example Dropdowns', 'example');
}
- return __('Plugin Example Dropdowns');
+ return __('Plugin Example Dropdowns', 'example');
}
}
?>
diff --git a/inc/example.class.php b/inc/example.class.php
index 9ba1f3c..6bf7d09 100644
--- a/inc/example.class.php
+++ b/inc/example.class.php
@@ -99,8 +99,8 @@ class PluginExampleExample extends CommonDBTM {
switch ($name) {
case 'Sample' :
- return array('description' => __('Cron description for example'),
- 'parameter' => __('Cron parameter for example'));
+ return array('description' => __('Cron description for example', 'example'),
+ 'parameter' => __('Cron parameter for example', 'example'));
}
return array();
}
@@ -157,27 +157,27 @@ class PluginExampleExample extends CommonDBTM {
switch ($item->getType()) {
case 'Profile' :
if ($item->getField('central')) {
- return __('Example');
+ return __('Example', 'example');
}
break;
case 'Phone' :
if ($_SESSION['glpishow_count_on_tabs']) {
- return self::createTabEntry(__('Example'),
+ return self::createTabEntry(__('Example', 'example'),
countElementsInTable($this->getTable()));
}
- return __('Example');
+ return __('Example', 'example');
case 'ComputerDisk' :
case 'Supplier' :
- return array(1 => __("Test PLugin"),
- 2 => __("Test PLugin 2"));
+ return array(1 => __("Test PLugin", 'example'),
+ 2 => __("Test PLugin 2", 'example'));
case 'Computer' :
case 'Central' :
case 'Preference':
case 'Notification':
- return array(1 => __("Test PLugin"));
+ return array(1 => __("Test PLugin", 'example'));
}
}
@@ -189,11 +189,11 @@ class PluginExampleExample extends CommonDBTM {
switch ($item->getType()) {
case 'Phone' :
- _e("Plugin Example on Phone");
+ _e("Plugin Example on Phone", 'example');
break;
case 'Central' :
- _e("Plugin central action");
+ _e("Plugin central action", 'example');
break;
case 'Preference' :
@@ -216,21 +216,21 @@ class PluginExampleExample extends CommonDBTM {
break;
case 'Notification' :
- _e("Plugin mailing action");
+ _e("Plugin mailing action", 'example');
break;
case 'ComputerDisk' :
case 'Supplier' :
if ($tabnum==1) {
- _e('First tab of Plugin example');
+ _e('First tab of Plugin example', 'example');
} else {
- _e('Second tab of Plugin example');
+ _e('Second tab of Plugin example', 'example');
}
break;
default :
//TRANS: %1$s is a class name, %2$d is an item ID
- printf(__('Plugin example CLASS=%1$s id=%2$d'), $item->getType(), $item->getField('id'));
+ printf(__('Plugin example CLASS=%1$s id=%2$d', 'example'), $item->getType(), $item->getField('id'));
break;
}
return true;
@@ -259,7 +259,7 @@ class PluginExampleExample extends CommonDBTM {
$key = $parm["begin"]."$$$"."plugin_example1";
$output[$key]["begin"] = date("Y-m-d 17:00:00");
$output[$key]["end"] = date("Y-m-d 18:00:00");
- $output[$key]["name"] = __("test planning example 1");
+ $output[$key]["name"] = __("test planning example 1", 'example');
// Specify the itemtype to be able to use specific display system
$output[$key]["itemtype"] = "PluginExampleExample";
// Set the ID using the ID of the item in the database to have unique ID
@@ -319,7 +319,7 @@ class PluginExampleExample extends CommonDBTM {
switch($data['linked_action'] - Log::HISTORY_PLUGIN) {
case 0:
- return _('History from plugin example');
+ return __('History from plugin example', 'example');
}
return '';
diff --git a/inc/notificationtargetexample.class.php b/inc/notificationtargetexample.class.php
index 56a3897..14bbfe6 100644
--- a/inc/notificationtargetexample.class.php
+++ b/inc/notificationtargetexample.class.php
@@ -41,7 +41,7 @@ class PluginExampleNotificationTargetExample extends NotificationTarget {
function getDatasForTemplate($event, $options=array()) {
global $DB, $CFG_GLPI;
- $this->datas['##example.name##'] = __('Example');
+ $this->datas['##example.name##'] = __('Example', 'example');
}
}
?>
\ No newline at end of file
diff --git a/inc/ruletest.class.php b/inc/ruletest.class.php
index 2bd6080..cb70df9 100644
--- a/inc/ruletest.class.php
+++ b/inc/ruletest.class.php
@@ -74,7 +74,7 @@ class PluginExampleRuleTest extends Rule {
function getActions() {
$actions = array();
- $actions['softwarecategories_id']['name'] = __('Category (class)');
+ $actions['softwarecategories_id']['name'] = __('Category (class)', 'example');
$actions['softwarecategories_id']['type'] = 'dropdown';
$actions['softwarecategories_id']['table'] = 'glpi_softwarecategories';
return $actions;
diff --git a/locales/glpi.pot b/locales/glpi.pot
index 670c2c9..a5db6a2 100644
--- a/locales/glpi.pot
+++ b/locales/glpi.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-05-29 15:05+0200\n"
+"POT-Creation-Date: 2012-10-16 11:22+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -29,101 +29,101 @@ msgstr ""
msgid "Example plugin"
msgstr ""
-#: hook.php:272
+#: hook.php:273
msgid "plugin_example_DoIt"
msgstr ""
-#: hook.php:276
-msgid "Add a document"
-msgstr ""
-
-#: hook.php:277
+#: hook.php:278
msgid "Do Nothing - just for fun"
msgstr ""
-#: hook.php:293 hook.php:325
+#: hook.php:294 hook.php:326
msgid "Write in item history"
msgstr ""
-#: hook.php:303
+#: hook.php:304
msgid "but do nothing :)"
msgstr ""
-#: hook.php:324 hook.php:345
+#: hook.php:325 hook.php:346
msgid "Right it is the type I want..."
msgstr ""
-#: hook.php:346
+#: hook.php:347
msgid "But... I say I will do nothing for:"
msgstr ""
-#: hook.php:381 hook.php:392
+#: hook.php:382 hook.php:393
msgid "Not really specific - Just for example"
msgstr ""
-#: hook.php:413
+#: hook.php:414
msgid "Not really specific - Use your own dropdown - Just for example"
msgstr ""
-#: hook.php:436
+#: hook.php:437
msgid "Pre Update Computer Hook"
msgstr ""
-#: hook.php:443
+#: hook.php:444
#, php-format
msgid "Update Computer Hook (%s)"
msgstr ""
-#: hook.php:451
+#: hook.php:452
msgid "Empty Computer Hook"
msgstr ""
-#: hook.php:460
+#: hook.php:461
msgid "Pre Delete Computer Hook"
msgstr ""
-#: hook.php:467
+#: hook.php:468
msgid "Delete Computer Hook"
msgstr ""
-#: hook.php:476
+#: hook.php:477
msgid "Pre Purge Computer Hook"
msgstr ""
-#: hook.php:483
+#: hook.php:484
msgid "Purge Computer Hook"
msgstr ""
-#: hook.php:492
+#: hook.php:493
msgid "Pre Restore Computer Hook"
msgstr ""
-#: hook.php:500
+#: hook.php:501
msgid "Pre Restore Phone Hook"
msgstr ""
-#: hook.php:507
+#: hook.php:508
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:515
+#: hook.php:516
#, php-format
msgid "Transfer Computer Hook %1$s %2$d -> %3$d"
msgstr ""
+#: hook.php:652
+msgid "Example event"
+msgstr ""
+
+#: hook.php:657
+msgid "Example datas"
+msgstr ""
+
#: setup.php:67
msgid "Test link"
msgstr ""
-#: setup.php:198
+#: setup.php:201
msgid "Installed / not configured"
msgstr ""
-#: front/popup.php:52
-msgid "Cache informations"
-msgstr ""
-
#: inc/dropdown.class.php:42 inc/dropdown.class.php:44
msgid "Plugin Example Dropdowns"
msgstr ""
@@ -136,50 +136,50 @@ msgstr ""
msgid "Cron parameter for example"
msgstr ""
-#: inc/example.class.php:158 inc/example.class.php:164
-#: inc/example.class.php:167 inc/notificationtargetexample.class.php:44
+#: inc/example.class.php:160 inc/example.class.php:166
+#: inc/example.class.php:169 inc/notificationtargetexample.class.php:44
msgid "Example"
msgstr ""
-#: inc/example.class.php:171 inc/example.class.php:178
+#: inc/example.class.php:173 inc/example.class.php:180
msgid "Test PLugin"
msgstr ""
-#: inc/example.class.php:172
+#: inc/example.class.php:174
msgid "Test PLugin 2"
msgstr ""
-#: inc/example.class.php:190
+#: inc/example.class.php:192
msgid "Plugin Example on Phone"
msgstr ""
-#: inc/example.class.php:194
+#: inc/example.class.php:196
msgid "Plugin central action"
msgstr ""
-#: inc/example.class.php:217
+#: inc/example.class.php:219
msgid "Plugin mailing action"
msgstr ""
-#: inc/example.class.php:223
+#: inc/example.class.php:225
msgid "First tab of Plugin example"
msgstr ""
-#: inc/example.class.php:225
+#: inc/example.class.php:227
msgid "Second tab of Plugin example"
msgstr ""
#. TRANS: %1$s is a class name, %2$d is an item ID
-#: inc/example.class.php:231
+#: inc/example.class.php:233
#, php-format
msgid "Plugin example CLASS=%1$s id=%2$d"
msgstr ""
-#: inc/example.class.php:260
+#: inc/example.class.php:262
msgid "test planning example 1"
msgstr ""
-#: inc/example.class.php:320
+#: inc/example.class.php:322
msgid "History from plugin example"
msgstr ""
diff --git a/setup.php b/setup.php
index 9122590..23df910 100755
--- a/setup.php
+++ b/setup.php
@@ -64,7 +64,7 @@ function plugin_init_example() {
$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']["
"] = '/plugins/example/index.php';
- $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][__s('Test link')] = '/plugins/example/index.php';
+ $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][__s('Test link', 'example')] = '/plugins/example/index.php';
$PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true;
}
@@ -198,7 +198,7 @@ function plugin_example_check_config($verbose=false) {
}
if ($verbose) {
- _e('Installed / not configured');
+ _e('Installed / not configured', 'example');
}
return false;
}
diff --git a/tools/extract_template.sh b/tools/extract_template.sh
index 7b81402..98136c7 100755
--- a/tools/extract_template.sh
+++ b/tools/extract_template.sh
@@ -7,7 +7,11 @@ 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 --keyword=_x:1c,2 --keyword=_ex:1c,2 --keyword=_sx:1c,2 --keyword=_nx:1c,2,3
+# Only strings with domain specified are extracted (use Xt args of keyword param to set number of args needed)
+
+xgettext *.php */*.php -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po \
+ --keyword=_n:1,2,3t --keyword=__s:1,2t --keyword=__:1,2t --keyword=_e:1,2t --keyword=_x:1c,2,3t --keyword=_ex:1c,2,3t \
+ --keyword=_sx:1c,2,3t --keyword=_nx:1c,2,3,4t
### for using tx :