Skip to content

Commit f97c3bd

Browse files
author
euromark
committed
Use queue domain for i18n.
1 parent 75a983b commit f97c3bd

File tree

8 files changed

+55
-55
lines changed

8 files changed

+55
-55
lines changed

Controller/CronTasksController.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function index() {
3333
*/
3434
public function view($id = null) {
3535
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id))))) {
36-
$this->Common->flashMessage(__('invalid record'), 'error');
36+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
3737
return $this->Common->autoRedirect(array('action' => 'index'));
3838
}
3939
$this->set(compact('cronTask'));
@@ -49,10 +49,10 @@ public function add() {
4949
$this->CronTask->create();
5050
if ($this->CronTask->save($this->request->data)) {
5151
$var = $this->request->data['CronTask']['title'];
52-
$this->Common->flashMessage(__('record add %s saved', h($var)), 'success');
52+
$this->Common->flashMessage(__d('queue', 'record add %s saved', h($var)), 'success');
5353
return $this->Common->postRedirect(array('action' => 'index'));
5454
} else {
55-
$this->Common->flashMessage(__('formContainsErrors'), 'error');
55+
$this->Common->flashMessage(__d('queue', 'formContainsErrors'), 'error');
5656
}
5757
}
5858
}
@@ -65,16 +65,16 @@ public function add() {
6565
*/
6666
public function edit($id = null) {
6767
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id))))) {
68-
$this->Common->flashMessage(__('invalid record'), 'error');
68+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
6969
return $this->Common->autoRedirect(array('action' => 'index'));
7070
}
7171
if ($this->Common->isPosted()) {
7272
if ($this->CronTask->save($this->request->data)) {
7373
$var = $this->request->data['CronTask']['title'];
74-
$this->Common->flashMessage(__('record edit %s saved', h($var)), 'success');
74+
$this->Common->flashMessage(__d('queue', 'record edit %s saved', h($var)), 'success');
7575
return $this->Common->postRedirect(array('action' => 'index'));
7676
} else {
77-
$this->Common->flashMessage(__('formContainsErrors'), 'error');
77+
$this->Common->flashMessage(__d('queue', 'formContainsErrors'), 'error');
7878
}
7979
}
8080
if (empty($this->request->data)) {
@@ -94,16 +94,16 @@ public function delete($id = null) {
9494
throw new MethodNotAllowedException();
9595
}
9696
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id), 'fields' => array('id', 'title'))))) {
97-
$this->Common->flashMessage(__('invalid record'), 'error');
97+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
9898
return $this->Common->autoRedirect(array('action' => 'index'));
9999
}
100100
$var = $cronTask['CronTask']['title'];
101101

102102
if ($this->CronTask->delete($id)) {
103-
$this->Common->flashMessage(__('record del %s done', h($var)), 'success');
103+
$this->Common->flashMessage(__d('queue', 'record del %s done', h($var)), 'success');
104104
return $this->redirect(array('action' => 'index'));
105105
}
106-
$this->Common->flashMessage(__('record del %s not done exception', h($var)), 'error');
106+
$this->Common->flashMessage(__d('queue', 'record del %s not done exception', h($var)), 'error');
107107
return $this->Common->autoRedirect(array('action' => 'index'));
108108
}
109109

@@ -126,7 +126,7 @@ public function admin_index() {
126126
*/
127127
public function admin_view($id = null) {
128128
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id))))) {
129-
$this->Common->flashMessage(__('invalid record'), 'error');
129+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
130130
return $this->Common->autoRedirect(array('action' => 'index'));
131131
}
132132
$this->set(compact('cronTask'));
@@ -142,10 +142,10 @@ public function admin_add() {
142142
$this->CronTask->create();
143143
if ($this->CronTask->save($this->request->data)) {
144144
$var = $this->request->data['CronTask']['title'];
145-
$this->Common->flashMessage(__('record add %s saved', h($var)), 'success');
145+
$this->Common->flashMessage(__d('queue', 'record add %s saved', h($var)), 'success');
146146
return $this->Common->postRedirect(array('action' => 'index'));
147147
} else {
148-
$this->Common->flashMessage(__('formContainsErrors'), 'error');
148+
$this->Common->flashMessage(__d('queue', 'formContainsErrors'), 'error');
149149
}
150150
}
151151
}
@@ -158,16 +158,16 @@ public function admin_add() {
158158
*/
159159
public function admin_edit($id = null) {
160160
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id))))) {
161-
$this->Common->flashMessage(__('invalid record'), 'error');
161+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
162162
return $this->Common->autoRedirect(array('action' => 'index'));
163163
}
164164
if ($this->Common->isPosted()) {
165165
if ($this->CronTask->save($this->request->data)) {
166166
$var = $this->request->data['CronTask']['title'];
167-
$this->Common->flashMessage(__('record edit %s saved', h($var)), 'success');
167+
$this->Common->flashMessage(__d('queue', 'record edit %s saved', h($var)), 'success');
168168
return $this->Common->postRedirect(array('action' => 'index'));
169169
} else {
170-
$this->Common->flashMessage(__('formContainsErrors'), 'error');
170+
$this->Common->flashMessage(__d('queue', 'formContainsErrors'), 'error');
171171
}
172172
}
173173
if (empty($this->request->data)) {
@@ -186,16 +186,16 @@ public function admin_delete($id = null) {
186186
throw new MethodNotAllowedException();
187187
}
188188
if (empty($id) || !($cronTask = $this->CronTask->find('first', array('conditions' => array('CronTask.id' => $id), 'fields' => array('id', 'title'))))) {
189-
$this->Common->flashMessage(__('invalid record'), 'error');
189+
$this->Common->flashMessage(__d('queue', 'invalid record'), 'error');
190190
return $this->Common->autoRedirect(array('action' => 'index'));
191191
}
192192
$var = $cronTask['CronTask']['title'];
193193

194194
if ($this->CronTask->delete($id)) {
195-
$this->Common->flashMessage(__('record del %s done', h($var)), 'success');
195+
$this->Common->flashMessage(__d('queue', 'record del %s done', h($var)), 'success');
196196
return $this->redirect(array('action' => 'index'));
197197
}
198-
$this->Common->flashMessage(__('record del %s not done exception', h($var)), 'error');
198+
$this->Common->flashMessage(__d('queue', 'record del %s not done exception', h($var)), 'error');
199199
return $this->Common->autoRedirect(array('action' => 'index'));
200200
}
201201

Controller/QueueController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public function admin_reset() {
4343
}
4444
$res = $this->QueuedTask->truncate();
4545
if ($res) {
46-
$this->Common->flashMessage('OK', 'success');
46+
$this->Common->flashMessage(__d('queue', 'OK'), 'success');
4747
} else {
48-
$this->Common->flashMessage(__('Error'), 'success');
48+
$this->Common->flashMessage(__d('queue', 'Error'), 'success');
4949
}
5050
return $this->Common->autoPostRedirect(array('action' => 'index'));
5151
}

Model/CronTask.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ protected function _findProgress($state, $query = array(), $results = array()) {
357357
*/
358358
public static function jobtypes($value = null) {
359359
$options = array(
360-
self::TYPE_TASK => __('Task'),
361-
self::TYPE_MODEL => __('Model (Method)'),
360+
self::TYPE_TASK => __d('queue', 'Task'),
361+
self::TYPE_MODEL => __d('queue', 'Model (Method)'),
362362
);
363363
return parent::enum($value, $options);
364364
}

View/CronTasks/admin_add.ctp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<h2><?php echo __('Add %s', __('Cron Task')); ?></h2>
1+
<h2><?php echo __d('queue', 'Add %s', __d('queue', 'Cron Task')); ?></h2>
22

33
<div class="page form">
44
<?php echo $this->Form->create('CronTask');?>
55
<fieldset>
6-
<legend><?php echo __('Add %s', __('Cron Task')); ?></legend>
6+
<legend><?php echo __d('queue', 'Add %s', __d('queue', 'Cron Task')); ?></legend>
77
<?php
88
echo $this->Form->input('jobtype', array('options'=>CronTask::jobtypes()));
99
echo $this->Form->input('name', array('after'=>'Plugin.Task / Plugin.Model.method'));
1010

1111
echo $this->Form->input('title');
1212
echo $this->Form->input('notbefore', array('dateFormat'=>'DMY', 'timeFormat'=>24));
1313
echo $this->Form->input('interval', array('after'=>'in Minutes'));
14-
echo $this->Form->input('status', array('type'=>'checkbox', 'label'=>__('Active')));
14+
echo $this->Form->input('status', array('type'=>'checkbox', 'label'=>__d('queue', 'Active')));
1515
//echo $this->Form->input('reference');
1616
?>
1717
</fieldset>
18-
<?php echo $this->Form->end(__('Submit'));?>
18+
<?php echo $this->Form->end(__d('queue', 'Submit'));?>
1919
</div>
2020

2121
<br /><br />
2222

2323
<div class="actions">
2424
<ul>
25-
<li><?php echo $this->Html->link(__('List %s', __('Cron Tasks')), array('action' => 'index'));?></li>
25+
<li><?php echo $this->Html->link(__d('queue', 'List %s', __d('queue', 'Cron Tasks')), array('action' => 'index'));?></li>
2626
</ul>
2727
</div>

View/CronTasks/admin_edit.ctp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<h2><?php echo __('Edit %s', __('Cron Task')); ?></h2>
1+
<h2><?php echo __d('queue', 'Edit %s', __d('queue', 'Cron Task')); ?></h2>
22

33
<div class="page form">
44
<?php echo $this->Form->create('CronTask');?>
55
<fieldset>
6-
<legend><?php echo __('Edit %s', __('Cron Task')); ?></legend>
6+
<legend><?php echo __d('queue', 'Edit %s', __d('queue', 'Cron Task')); ?></legend>
77
<?php
88
echo $this->Form->input('id');
99
echo $this->Form->input('jobtype', array('options'=>CronTask::jobtypes()));
@@ -12,17 +12,17 @@
1212
echo $this->Form->input('title');
1313
echo $this->Form->input('notbefore', array('dateFormat'=>'DMY', 'timeFormat'=>24));
1414
echo $this->Form->input('interval', array('after'=>'in Minutes'));
15-
echo $this->Form->input('status', array('type'=>'checkbox', 'label'=>__('Active')));
15+
echo $this->Form->input('status', array('type'=>'checkbox', 'label'=>__d('queue', 'Active')));
1616
?>
1717
</fieldset>
18-
<?php echo $this->Form->end(__('Submit'));?>
18+
<?php echo $this->Form->end(__d('queue', 'Submit'));?>
1919
</div>
2020

2121
<br /><br />
2222

2323
<div class="actions">
2424
<ul>
25-
<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('CronTask.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('CronTask.id'))); ?></li>
26-
<li><?php echo $this->Html->link(__('List %s', __('Cron Tasks')), array('action' => 'index'));?></li>
25+
<li><?php echo $this->Form->postLink(__d('queue', 'Delete'), array('action' => 'delete', $this->Form->value('CronTask.id')), null, __d('queue', 'Are you sure you want to delete # %s?', $this->Form->value('CronTask.id'))); ?></li>
26+
<li><?php echo $this->Html->link(__d('queue', 'List %s', __d('queue', 'Cron Tasks')), array('action' => 'index'));?></li>
2727
</ul>
2828
</div>

View/CronTasks/admin_index.ctp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="page index">
2-
<h2><?php echo __('Cron Tasks');?></h2>
2+
<h2><?php echo __d('queue', 'Cron Tasks');?></h2>
33

44
<table class="list">
55
<tr>
@@ -9,7 +9,7 @@
99
<th><?php echo $this->Paginator->sort('completed');?></th>
1010
<th><?php echo $this->Paginator->sort('failed');?></th>
1111
<th><?php echo $this->Paginator->sort('status');?></th>
12-
<th class="actions"><?php echo __('Actions');?></th>
12+
<th class="actions"><?php echo __d('queue', 'Actions');?></th>
1313
</tr>
1414
<?php
1515
$i = 0;
@@ -49,7 +49,7 @@ foreach ($cronTasks as $cronTask):
4949
<td class="actions">
5050
<?php echo $this->Html->link($this->Format->icon('view'), array('action'=>'view', $cronTask['CronTask']['id']), array('escape'=>false)); ?>
5151
<?php echo $this->Html->link($this->Format->icon('edit'), array('action'=>'edit', $cronTask['CronTask']['id']), array('escape'=>false)); ?>
52-
<?php echo $this->Form->postLink($this->Format->icon('delete'), array('action'=>'delete', $cronTask['CronTask']['id']), array('escape'=>false), __('Are you sure you want to delete # %s?', $cronTask['CronTask']['id'])); ?>
52+
<?php echo $this->Form->postLink($this->Format->icon('delete'), array('action'=>'delete', $cronTask['CronTask']['id']), array('escape'=>false), __d('queue', 'Are you sure you want to delete # %s?', $cronTask['CronTask']['id'])); ?>
5353
</td>
5454
</tr>
5555
<?php endforeach; ?>
@@ -64,6 +64,6 @@ foreach ($cronTasks as $cronTask):
6464

6565
<div class="actions">
6666
<ul>
67-
<li><?php echo $this->Html->link(__('Add %s', __('Cron Task')), array('action' => 'add')); ?></li>
67+
<li><?php echo $this->Html->link(__d('queue', 'Add %s', __d('queue', 'Cron Task')), array('action' => 'add')); ?></li>
6868
</ul>
6969
</div>

View/CronTasks/admin_view.ctp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<div class="page view">
2-
<h2><?php echo __('Cron Task');?></h2>
2+
<h2><?php echo __d('queue', 'Cron Task');?></h2>
33

44
<h3><?php echo h($cronTask['CronTask']['title']); ?></h3>
55
<dl><?php $i = 0; $class = ' class="altrow"';?>
6-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Jobtype'); ?></dt>
6+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Jobtype'); ?></dt>
77
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
88
<?php echo CronTask::jobtypes($cronTask['CronTask']['jobtype']); ?>
99
&nbsp;
1010
</dd>
11-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Data'); ?></dt>
11+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Data'); ?></dt>
1212
<dd>
1313
<?php echo nl2br(h($cronTask['CronTask']['data'])); ?>
1414
&nbsp;
1515
</dd>
16-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Created'); ?></dt>
16+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Created'); ?></dt>
1717
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
1818
<?php echo $this->Datetime->niceDate($cronTask['CronTask']['created']); ?>
1919
&nbsp;
2020
</dd>
21-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Notbefore'); ?></dt>
21+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Notbefore'); ?></dt>
2222
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
2323
<?php echo $this->Datetime->niceDate($cronTask['CronTask']['notbefore']); ?>
2424
&nbsp;
2525
</dd>
26-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Completed'); ?></dt>
26+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Completed'); ?></dt>
2727
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
2828
<?php echo $this->Datetime->niceDate($cronTask['CronTask']['completed']); ?>
2929
&nbsp;
3030
</dd>
31-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Failed'); ?></dt>
31+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Failed'); ?></dt>
3232
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
3333
<?php echo h($cronTask['CronTask']['failed']); ?>
3434
&nbsp;
3535
</dd>
36-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Failure Message'); ?></dt>
36+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Failure Message'); ?></dt>
3737
<dd>
3838
<?php echo nl2br(h($cronTask['CronTask']['failure_message'])); ?>
3939
&nbsp;
4040
</dd>
41-
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __('Status'); ?></dt>
41+
<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo __d('queue', 'Status'); ?></dt>
4242
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
4343
<?php echo $this->Format->yesNo($cronTask['CronTask']['status']); ?>
4444
&nbsp;
@@ -50,8 +50,8 @@
5050

5151
<div class="actions">
5252
<ul>
53-
<li><?php echo $this->Html->link(__('Edit %s', __('Cron Task')), array('action' => 'edit', $cronTask['CronTask']['id'])); ?> </li>
54-
<li><?php echo $this->Form->postLink(__('Delete %s', __('Cron Task')), array('action' => 'delete', $cronTask['CronTask']['id']), null, __('Are you sure you want to delete # %s?', $cronTask['CronTask']['id'])); ?> </li>
55-
<li><?php echo $this->Html->link(__('List %s', __('Cron Tasks')), array('action' => 'index')); ?> </li>
53+
<li><?php echo $this->Html->link(__d('queue', 'Edit %s', __d('queue', 'Cron Task')), array('action' => 'edit', $cronTask['CronTask']['id'])); ?> </li>
54+
<li><?php echo $this->Form->postLink(__d('queue', 'Delete %s', __d('queue', 'Cron Task')), array('action' => 'delete', $cronTask['CronTask']['id']), null, __d('queue', 'Are you sure you want to delete # %s?', $cronTask['CronTask']['id'])); ?> </li>
55+
<li><?php echo $this->Html->link(__d('queue', 'List %s', __d('queue', 'Cron Tasks')), array('action' => 'index')); ?> </li>
5656
</ul>
5757
</div>

View/Queue/admin_index.ctp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div class="page index">
2-
<h2><?php echo __('Queue');?></h2>
2+
<h2><?php echo __d('queue', 'Queue');?></h2>
33

4-
<h3><?php echo __('Status'); ?></h3>
4+
<h3><?php echo __d('queue', 'Status'); ?></h3>
55
<?php if ($status) { ?>
66
<?php
77
$running = (time() - $status['time']) < MINUTE;
88
?>
9-
<?php echo $this->Format->yesNo($running); ?> <?php echo $running ? __('Running') : __('Not running'); ?> (<?php echo __('last %s', $this->Datetime->relLengthOfTime($status['time']))?>)
9+
<?php echo $this->Format->yesNo($running); ?> <?php echo $running ? __d('queue', 'Running') : __d('queue', 'Not running'); ?> (<?php echo __d('queue', 'last %s', $this->Datetime->relLengthOfTime($status['time']))?>)
1010

1111
<?php
1212
echo '<div><small>Currently '.($status['workers']).' worker(s) total.</small></div>';
@@ -15,13 +15,13 @@
1515
n/a
1616
<?php } ?>
1717

18-
<h3><?php echo __('Queued Tasks'); ?></h3>
18+
<h3><?php echo __d('queue', 'Queued Tasks'); ?></h3>
1919
<?php
2020
echo $current;
2121
?> task(s) await processing
2222

2323

24-
<h3><?php echo __('Statistics'); ?></h3>
24+
<h3><?php echo __d('queue', 'Statistics'); ?></h3>
2525
<ul>
2626
<?php
2727
foreach ($data as $item) {
@@ -62,6 +62,6 @@ if (empty($data)) {
6262

6363
<div class="actions">
6464
<ul>
65-
<li><?php echo $this->Form->postLink(__('Reset %s', __('Queue Tasks')), array('action' => 'reset'), array(), __('Sure? This will completely reset the queue.')); ?></li>
65+
<li><?php echo $this->Form->postLink(__d('queue', 'Reset %s', __d('queue', 'Queue Tasks')), array('action' => 'reset'), array(), __d('queue', 'Sure? This will completely reset the queue.')); ?></li>
6666
</ul>
6767
</div>

0 commit comments

Comments
 (0)