Skip to content

Commit

Permalink
ENH Update translations
Browse files Browse the repository at this point in the history
Also add to transifex
  • Loading branch information
GuySartorelli committed Mar 9, 2023
1 parent 3aae0e2 commit b7f04fa
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[main]
host = https://www.transifex.com

[o:silverstripe:p:silverstripe-crontask:r:master]
file_filter = lang/<lang>.yml
source_file = lang/en.yml
source_lang = en
type = YML


Empty file added lang/_manifest_exclude
Empty file.
18 changes: 18 additions & 0 deletions lang/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
en:
SilverStripe\CronTask\Controllers\CronTaskController:
NO_IMPLEMENTERS: 'There are no implementators of CronTask to run'
WILL_RUN_AT: '{task} will run at {time}.'
WILL_START_NOW: '{task} will start now.'
SilverStripe\CronTask\CronTaskController:
NO_IMPLEMENTERS: 'There are no implementators of CronTask to run'
WILL_RUN_AT: '{task} will run at {time}.'
WILL_START_NOW: '{task} will start now.'
SilverStripe\CronTask\CronTaskStatus:
PLURALNAME: 'Cron Task Statuss'
PLURALS:
one: 'A Cron Task Status'
other: '{count} Cron Task Statuss'
SINGULARNAME: 'Cron Task Status'
db_LastChecked: 'Last checked'
db_LastRun: 'Last run'
db_TaskClass: 'Task class'
13 changes: 10 additions & 3 deletions src/Controllers/CronTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function index(HTTPRequest $request)
// Check each task
$tasks = ClassInfo::implementorsOf(CronTask::class);
if (empty($tasks)) {
$this->output("There are no implementators of CronTask to run", 2);
$this->output(_t(self::class . '.NO_IMPLEMENTERS', 'There are no implementators of CronTask to run'), 2);
return;
}
foreach ($tasks as $subclass) {
Expand All @@ -157,10 +157,17 @@ public function runTask(CronTask $task)
// Update status of this task prior to execution in case of interruption
CronTaskStatus::update_status(get_class($task), $isDue);
if ($isDue) {
$this->output(get_class($task) . ' will start now.');
$this->output(_t(self::class . '.WILL_START_NOW', '{task} will start now.', ['task' => get_class($task)]));
$task->process();
} else {
$this->output(get_class($task) . ' will run at ' . $cron->getNextRunDate()->format('Y-m-d H:i:s') . '.', 2);
$this->output(
_t(
self::class . '.WILL_RUN_AT',
'{task} will run at {time}.',
['task' => get_class($task), 'time' => $cron->getNextRunDate()->format('Y-m-d H:i:s')]
),
2
);
}
}

Expand Down

0 comments on commit b7f04fa

Please sign in to comment.