Allow the dashboard widget inspector and report widget to be translated.

This commit is contained in:
Paul Wilde 2014-08-09 01:29:19 +01:00
parent 3fe08dfaf4
commit de98451148
5 changed files with 41 additions and 22 deletions

View File

@ -48,6 +48,21 @@ return [
'widget_label' => 'Widget',
'widget_width' => 'Width',
'add_widget' => 'Add widget',
'widget_inspector_title' => 'Widget configuration',
'widget_inspector_description' => 'Configure the report widget',
'widget_columns_label' => 'Width :columns',
'widget_columns_description' => 'The widget width, a number between 1 and 10.',
'widget_columns_error' => 'Please enter the widget width as a number between 1 and 10.',
'columns' => '{1} column|[2,Inf] columns',
'widget_new_row_label' => 'Force new row',
'widget_new_row_description' => 'Put the widget in a new row.',
'widget_title_label' => 'Widget title',
'widget_title_error' => 'The Widget Title is required.',
'status' => [
'widget_title_default' => 'System status',
'online' => 'online',
'update_available' => '{0} updates available!|{1} update available!|[2,Inf] updates available!',
]
],
'user' => [
'name' => 'Administrator',

View File

@ -6,6 +6,7 @@ use Request;
use Backend\Classes\WidgetManager;
use Backend\Models\UserPreferences;
use File;
use Lang;
/**
* Report Container Widget
@ -282,30 +283,30 @@ class ReportContainer extends WidgetBase
$property = [
'property' => 'ocWidgetWidth',
'title' => 'Width (1-10)',
'description' => 'The widget width, a number between 1 and 10.',
'title' => Lang::get('backend::lang.dashboard.widget_columns_label', ['columns' => '(1-10)']),
'description' => Lang::get('backend::lang.dashboard.widget_columns_description'),
'type' => 'dropdown',
'validationPattern' => '^[0-9]+$',
'validationMessage' => 'Please enter the widget width as a number between 1 and 10.',
'validationMessage' => Lang::get('backend::lang.dashboard.widget_columns_error'),
'options' => [
1 => '1 column',
2 => '2 columns',
3 => '3 columns',
4 => '4 columns',
5 => '5 columns',
6 => '6 columns',
7 => '7 columns',
8 => '8 columns',
9 => '9 columns',
10 => '10 columns'
1 => '1 ' . Lang::choice('backend::lang.dashboard.columns', 1),
2 => '2 ' . Lang::choice('backend::lang.dashboard.columns', 2),
3 => '3 ' . Lang::choice('backend::lang.dashboard.columns', 3),
4 => '4 ' . Lang::choice('backend::lang.dashboard.columns', 4),
5 => '5 ' . Lang::choice('backend::lang.dashboard.columns', 5),
6 => '6 ' . Lang::choice('backend::lang.dashboard.columns', 6),
7 => '7 ' . Lang::choice('backend::lang.dashboard.columns', 7),
8 => '8 ' . Lang::choice('backend::lang.dashboard.columns', 8),
9 => '9 ' . Lang::choice('backend::lang.dashboard.columns', 9),
10 => '10 ' . Lang::choice('backend::lang.dashboard.columns', 10)
]
];
$result[] = $property;
$property = [
'property' => 'ocWidgetNewRow',
'title' => 'Force new row',
'description' => 'Put the widget in a new row.',
'title' => Lang::get('backend::lang.dashboard.widget_new_row_label'),
'description' => Lang::get('backend::lang.dashboard.widget_new_row_description'),
'type' => 'checkbox'
];

View File

@ -11,8 +11,8 @@
<a href="javascript:;"
class="oc-icon-cog widget-control edit-widget"
data-inspectable
data-inspector-title="Widget configuration"
data-inspector-description="Configure the report widget"
data-inspector-title="<?= e(trans('backend::lang.dashboard.widget_inspector_title')) ?>"
data-inspector-description="<?= e(trans('backend::lang.dashboard.widget_inspector_description')) ?>"
data-inspector-config="<?= e($this->getWidgetPropertyConfig($widget)) ?>"
data-inspector-class="<?= get_class($widget) ?>"
data-inspector-offset="-3"

View File

@ -4,6 +4,7 @@ use System\Models\Parameters;
use System\Classes\UpdateManager;
use Backend\Classes\ReportWidgetBase;
use Exception;
use Lang;
/**
* System status report widget.
@ -32,11 +33,11 @@ class Status extends ReportWidgetBase
{
return [
'title' => [
'title' => 'Widget title',
'default' => 'System status',
'title' => Lang::get('backend::lang.dashboard.widget_title_label'),
'default' => Lang::get('backend::lang.dashboard.status.widget_title_default'),
'type' => 'string',
'validationPattern' => '^.+$',
'validationMessage' => 'The Widget Title is required.'
'validationMessage' => Lang::get('backend::lang.dashboard.widget_title_error')
]
];
}

View File

@ -4,11 +4,13 @@
<?php if (!isset($error)): ?>
<ul class="status-list">
<li>
<span class="status circle success"></span> online
<span class="status circle success"></span>
<?= e(trans('backend::lang.dashboard.status.online')) ?>
</li>
<li>
<a href="<?= Backend::url('system/updates') ?>">
<span class="status primary"><?= $updates ?></span> <?= Str::plural('update', $updates) ?> available!
<span class="status primary"><?= $updates ?></span>
<?= e(trans_choice('backend::lang.dashboard.status.update_available', $updates)) ?>
</a>
</li>
</ul>