Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Update translations #76

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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