Commit a77ceacc074cd9f3356e4a1b1313dd6003bb85e4

Authored by kevin_fourie
1 parent a9dc17b4

KTS-1838

"i18n support for transaction history messages"
Updated.

Reviewed By: Jalaloedien



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6507 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/genpo.sh
... ... @@ -9,5 +9,5 @@ rm -f i18n/templates.c
9 9 find resources -name "*.js" | sort | python ./bin/jsi18n.py > templates/ktcore/javascript_i18n.smarty
10 10 php bin/smarty_to_gettext.php . > i18n/templates.c
11 11 find . -type f -name "*.php" -o -name "*.inc" | sort | xgettext --no-wrap -d knowledgeTree -L PHP -s -f - --keyword=_kt -o i18n/knowledgeTree.pot
12   -echo i18n/templates.c i18n/permissions.c | xargs -n 1 | sort | xgettext --no-wrap -d knowledgeTree -j -s -f - -o i18n/knowledgeTree.pot
  12 +echo i18n/templates.c i18n/transactions.c i18n/permissions.c | xargs -n 1 | sort | xgettext --no-wrap -d knowledgeTree -j -s -f - -o i18n/knowledgeTree.pot
13 13  
... ...
i18n/transactions.c
1   -gettext('Create');
2   -gettext('Update');
3   -gettext('Delete');
4   -gettext('Rename');
5   -gettext('Move');
6   -gettext('Download');
7   -gettext('Check In');
8   -gettext('Check Out');
9   -gettext('Collaboration Step Rollback');
10   -gettext('View');
11   -gettext('Expunge');
12   -gettext('Force CheckIn');
13   -gettext('Email Link');
14   -gettext('Collaboration Step Approve');
15   -gettext('Email Attachment');
16   -gettext('Workflow state transition');
17   -gettext('Permissions changed');
18   -gettext('Role allocations changed');
19   -gettext('Bulk Export');
  1 +gettext("Create");
  2 +gettext("Update");
  3 +gettext("Delete");
  4 +gettext("Rename");
  5 +gettext("Move");
  6 +gettext("Download");
  7 +gettext("Check In");
  8 +gettext("Check Out");
  9 +gettext("Collaboration Step Rollback");
  10 +gettext("View");
  11 +gettext("Expunge");
  12 +gettext("Force CheckIn");
  13 +gettext("Email Link");
  14 +gettext("Collaboration Step Approve");
  15 +gettext("Email Attachment");
  16 +gettext("Workflow state transition");
  17 +gettext("Permissions changed");
  18 +gettext("Role allocations changed");
  19 +gettext("Bulk Export");
... ...
lib/documentmanagement/documentutil.inc.php
... ... @@ -494,7 +494,7 @@ class KTDocumentUtil {
494 494 // $oUploadChannel->sendMessage(new KTUploadGenericMessage(_kt("Creating transaction")));
495 495 $aOptions = array('user' => $oUser);
496 496 //create the document transaction record
497   - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document created", 'ktcore.transactions.create', $aOptions);
  497 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document created'), 'ktcore.transactions.create', $aOptions);
498 498 $res = $oDocumentTransaction->create();
499 499 if (PEAR::isError($res)) {
500 500 $oDocument->delete();
... ... @@ -711,7 +711,7 @@ class KTDocumentUtil {
711 711 return PEAR::raiseError(_kt("There was a problem deleting the document from storage."));
712 712 }
713 713  
714   - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document deleted: " . $sReason, 'ktcore.transactions.delete');
  714 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document deleted: ') . $sReason, 'ktcore.transactions.delete');
715 715 $oDocumentTransaction->create();
716 716  
717 717 $oDocument->setFolderID(1);
... ... @@ -863,11 +863,11 @@ class KTDocumentUtil {
863 863 }
864 864  
865 865  
866   - $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf("Copied to folder \"%s\". %s", $oDestinationFolder->getName(), $sReason), 'ktcore.transactions.copy');
  866 + $oDocumentTransaction = & new DocumentTransaction($oDocument, sprintf(_kt("Copied to folder \"%s\". %s"), $oDestinationFolder->getName(), $sReason), 'ktcore.transactions.copy');
867 867 $oDocumentTransaction->create();
868 868  
869 869 $oSrcFolder = Folder::get($oDocument->getFolderID());
870   - $oDocumentTransaction = & new DocumentTransaction($oNewDocument, sprintf("Copied from original in folder \"%s\". %s", $oSrcFolder->getName(), $sReason), 'ktcore.transactions.copy');
  870 + $oDocumentTransaction = & new DocumentTransaction($oNewDocument, sprintf(_kt("Copied from original in folder \"%s\". %s"), $oSrcFolder->getName(), $sReason), 'ktcore.transactions.copy');
871 871 $oDocumentTransaction->create();
872 872  
873 873 return $oNewDocument;
... ... @@ -902,7 +902,7 @@ class KTDocumentUtil {
902 902 }
903 903  
904 904 // create the document transaction record
905   - $oDocumentTransaction = & new DocumentTransaction($oDocument, 'Document renamed', 'ktcore.transactions.update');
  905 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document renamed'), 'ktcore.transactions.update');
906 906 $oDocumentTransaction->create();
907 907  
908 908 // fire subscription alerts for the checked in document
... ... @@ -945,7 +945,7 @@ class KTDocumentUtil {
945 945 return $res; // we failed, bail.
946 946 }
947 947  
948   - $sMoveMessage = sprintf("Moved from %s/%s to %s/%s. %s",
  948 + $sMoveMessage = sprintf(_kt("Moved from %s/%s to %s/%s. %s"),
949 949 $oOriginalFolder->getFullPath(),
950 950 $oOriginalFolder->getName(),
951 951 $oFolder->getFullPath(),
... ...
lib/foldermanagement/folderutil.inc.php
... ... @@ -78,7 +78,7 @@ class KTFolderUtil {
78 78  
79 79 $oTransaction = KTFolderTransaction::createFromArray(array(
80 80 'folderid' => $oFolder->getId(),
81   - 'comment' => "Folder created",
  81 + 'comment' => _kt('Folder created'),
82 82 'transactionNS' => 'ktcore.transactions.create',
83 83 'userid' => $oUser->getId(),
84 84 'ip' => Session::getClientIP(),
... ... @@ -266,7 +266,7 @@ class KTFolderUtil {
266 266  
267 267 $oTransaction = KTFolderTransaction::createFromArray(array(
268 268 'folderid' => $oFolder->getId(),
269   - 'comment' => sprintf("Renamed from \"%s\" to \"%s\"", $sOldName, $sNewName),
  269 + 'comment' => sprintf(_kt("Renamed from \"%s\" to \"%s\""), $sOldName, $sNewName),
270 270 'transactionNS' => 'ktcore.transactions.rename',
271 271 'userid' => $_SESSION['userID'],
272 272 'ip' => Session::getClientIP(),
... ...
lib/workflow/workflowutil.inc.php
... ... @@ -163,12 +163,12 @@ class KTWorkflowUtil {
163 163  
164 164 $oDocument->setWorkflowId($iWorkflowId);
165 165 $oDocument->setWorkflowStateId($iStartStateId);
166   - $sTransactionComments = "Workflow \"" . $oWorkflow->getHumanName() . "\" started.";
  166 + $sTransactionComments = sprintf(_kt("Workflow \"%s\" started."), $oWorkflow->getHumanName());
167 167  
168 168 } else {
169 169 $oDocument->setWorkflowId(null);
170 170 $oDocument->setWorkflowStateId(null);
171   - $sTransactionComments = "Workflow removed from document.";
  171 + $sTransactionComments = _kt('Workflow removed from document.');
172 172 }
173 173  
174 174 $res = $oDocument->update();
... ... @@ -578,9 +578,10 @@ class KTWorkflowUtil {
578 578 $sTargetState = $oTargetState->getName();
579 579  
580 580 // create the document transaction record
581   - $sTransactionComments = "Workflow state changed from $sSourceState to $sTargetState";
  581 + $sTransactionComments = sprintf(_kt("Workflow state changed from %s to %s"), $sSourceState, $sTargetState);
  582 +
582 583 if ($sComments) {
583   - $sTransactionComments .= "; Reason given was: " . $sComments;
  584 + $sTransactionComments .= _kt("; Reason given was: ") . $sComments;
584 585 }
585 586 $oDocumentTransaction = & new DocumentTransaction($oDocument, $sTransactionComments, 'ktcore.transactions.workflow_state_transition');
586 587 $oDocumentTransaction->create();
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -230,7 +230,7 @@ class KTDocumentViewAction extends KTDocumentAction {
230 230 exit(0);
231 231 }
232 232  
233   - $oDocumentTransaction = & new DocumentTransaction($this->oDocument, 'Document downloaded', 'ktcore.transactions.download', $aOptions);
  233 + $oDocumentTransaction = & new DocumentTransaction($this->oDocument, _kt('Document downloaded'), 'ktcore.transactions.download', $aOptions);
234 234 $oDocumentTransaction->create();
235 235 exit(0);
236 236 }
... ...
plugins/ktcore/KTPermissions.php
... ... @@ -417,7 +417,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
417 417  
418 418 $oTransaction = KTFolderTransaction::createFromArray(array(
419 419 'folderid' => $this->oFolder->getId(),
420   - 'comment' => "Override parent allocation",
  420 + 'comment' => _kt('Override parent allocation'),
421 421 'transactionNS' => 'ktcore.transactions.role_allocations_change',
422 422 'userid' => $_SESSION['userID'],
423 423 'ip' => Session::getClientIP(),
... ... @@ -457,7 +457,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
457 457  
458 458 $oTransaction = KTFolderTransaction::createFromArray(array(
459 459 'folderid' => $this->oFolder->getId(),
460   - 'comment' => "Use parent allocation",
  460 + 'comment' => _kt('Use parent allocation'),
461 461 'transactionNS' => 'ktcore.transactions.role_allocations_change',
462 462 'userid' => $_SESSION['userID'],
463 463 'ip' => Session::getClientIP(),
... ... @@ -640,7 +640,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
640 640  
641 641 $oTransaction = KTFolderTransaction::createFromArray(array(
642 642 'folderid' => $this->oFolder->getId(),
643   - 'comment' => "Set role users",
  643 + 'comment' => _kt('Set role users'),
644 644 'transactionNS' => 'ktcore.transactions.role_allocations_change',
645 645 'userid' => $_SESSION['userID'],
646 646 'ip' => Session::getClientIP(),
... ... @@ -695,7 +695,7 @@ class KTRoleAllocationPlugin extends KTFolderAction {
695 695  
696 696 $oTransaction = KTFolderTransaction::createFromArray(array(
697 697 'folderid' => $this->oFolder->getId(),
698   - 'comment' => "Set role groups",
  698 + 'comment' => _kt('Set role groups'),
699 699 'transactionNS' => 'ktcore.transactions.role_allocations_change',
700 700 'userid' => $_SESSION['userID'],
701 701 'ip' => Session::getClientIP(),
... ...
plugins/ktcore/admin/deletedDocuments.php
... ... @@ -241,7 +241,7 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html';
241 241  
242 242 // create a doc-transaction.
243 243 // FIXME does this warrant a transaction-type?
244   - $oTransaction = new DocumentTransaction($oDoc, 'Restored from deleted state by ' . $this->oUser->getName(), 'ktcore.transactions.update');
  244 + $oTransaction = new DocumentTransaction($oDoc, _kt('Restored from deleted state by ') . $this->oUser->getName(), 'ktcore.transactions.update');
245 245 if (!$oTransaction->create()) {
246 246 ; // do nothing? the state of physicaldocumentmanager...
247 247 }
... ...
plugins/ktcore/admin/documentCheckout.php
... ... @@ -112,7 +112,7 @@ class KTCheckoutAdminDispatcher extends KTAdminDispatcher {
112 112 }
113 113  
114 114 // checkout cancelled transaction
115   - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document checked out cancelled", 'ktcore.transactions.force_checkin');
  115 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document checked out cancelled'), 'ktcore.transactions.force_checkin');
116 116 $res = $oDocumentTransaction->create();
117 117 if (PEAR::isError($res) || ($res == false)) {
118 118 $this->rollbackTransaction();
... ...
plugins/ktcore/folder/Permissions.php
... ... @@ -233,7 +233,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
233 233 function _copyPermissions() {
234 234 $oTransaction = KTFolderTransaction::createFromArray(array(
235 235 'folderid' => $this->oFolder->getId(),
236   - 'comment' => 'Override permissions from parent',
  236 + 'comment' => _kt('Override permissions from parent'),
237 237 'transactionNS' => 'ktcore.transactions.permissions_change',
238 238 'userid' => $_SESSION['userID'],
239 239 'ip' => Session::getClientIP(),
... ... @@ -446,7 +446,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
446 446  
447 447 $oTransaction = KTFolderTransaction::createFromArray(array(
448 448 'folderid' => $this->oFolder->getId(),
449   - 'comment' => 'Updated permissions',
  449 + 'comment' => _kt('Updated permissions'),
450 450 'transactionNS' => 'ktcore.transactions.permissions_change',
451 451 'userid' => $_SESSION['userID'],
452 452 'ip' => Session::getClientIP(),
... ... @@ -479,7 +479,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
479 479 }
480 480 $oTransaction = KTFolderTransaction::createFromArray(array(
481 481 'folderid' => $this->oFolder->getId(),
482   - 'comment' => 'Inherit permissions from parent',
  482 + 'comment' => _kt('Inherit permissions from parent'),
483 483 'transactionNS' => 'ktcore.transactions.permissions_change',
484 484 'userid' => $_SESSION['userID'],
485 485 'ip' => Session::getClientIP(),
... ... @@ -511,7 +511,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
511 511  
512 512 $oTransaction = KTFolderTransaction::createFromArray(array(
513 513 'folderid' => $this->oFolder->getId(),
514   - 'comment' => 'Added dynamic permissions',
  514 + 'comment' => _kt('Added dynamic permissions'),
515 515 'transactionNS' => 'ktcore.transactions.permissions_change',
516 516 'userid' => $_SESSION['userID'],
517 517 'ip' => Session::getClientIP(),
... ... @@ -548,7 +548,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
548 548  
549 549 $oTransaction = KTFolderTransaction::createFromArray(array(
550 550 'folderid' => $this->oFolder->getId(),
551   - 'comment' => 'Removed dynamic permissions',
  551 + 'comment' => _kt('Removed dynamic permissions'),
552 552 'transactionNS' => 'ktcore.transactions.permissions_change',
553 553 'userid' => $_SESSION['userID'],
554 554 'ip' => Session::getClientIP(),
... ...
plugins/ktstandard/KTEmail.php
... ... @@ -164,7 +164,7 @@ function sendEmailDocument($sDestEmailAddress, $sDestUserName, $iDocumentID, $sD
164 164 }
165 165  
166 166 // emailed link transaction
167   - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document link emailed to " . $sDestEmailAddress, 'ktcore.transactions.email_attachment');
  167 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document copy emailed to ') . $sDestEmailAddress, 'ktcore.transactions.email_attachment');
168 168 if ($oDocumentTransaction->create()) {
169 169 $default->log->debug("emailBL.php created email link document transaction for document ID=$iDocumentID");
170 170 } else {
... ... @@ -219,7 +219,7 @@ function sendEmailHyperlink($sDestEmailAddress, $sDestUserName, $iDocumentID, $s
219 219 // need a document to do this.
220 220 $oDocument =& Document::get($iDocumentID);
221 221  
222   - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document link emailed to " . $sDestEmailAddress, 'ktcore.transactions.email_link');
  222 + $oDocumentTransaction = & new DocumentTransaction($oDocument, _kt('Document link emailed to ') . $sDestEmailAddress, 'ktcore.transactions.email_link');
223 223 if ($oDocumentTransaction->create()) {
224 224 $default->log->debug("emailBL.php created email link document transaction for document ID=$iDocumentID");
225 225 } else {
... ...
templates/kt3/view_folder_history.smarty
... ... @@ -17,7 +17,7 @@
17 17 {foreach item=aTransactionRow from=$transactions}
18 18 <tr class="{cycle values=even,odd}">
19 19 <td class="username">{$aTransactionRow.user_name}</td>
20   - <td class="action">{$aTransactionRow.transaction_name}</td>
  20 + <td class="action">{i18n}{$aTransactionRow.transaction_name}{/i18n}</td>
21 21 <td class="date">{$aTransactionRow.datetime}</td>
22 22 <td class="comment">{$aTransactionRow.comment}</td>
23 23 </tr>
... ...