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_label' => 'Widget',
'widget_width' => 'Width', 'widget_width' => 'Width',
'add_widget' => 'Add widget', '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' => [ 'user' => [
'name' => 'Administrator', 'name' => 'Administrator',

View File

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

View File

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

View File

@ -4,6 +4,7 @@ use System\Models\Parameters;
use System\Classes\UpdateManager; use System\Classes\UpdateManager;
use Backend\Classes\ReportWidgetBase; use Backend\Classes\ReportWidgetBase;
use Exception; use Exception;
use Lang;
/** /**
* System status report widget. * System status report widget.
@ -32,11 +33,11 @@ class Status extends ReportWidgetBase
{ {
return [ return [
'title' => [ 'title' => [
'title' => 'Widget title', 'title' => Lang::get('backend::lang.dashboard.widget_title_label'),
'default' => 'System status', 'default' => Lang::get('backend::lang.dashboard.status.widget_title_default'),
'type' => 'string', 'type' => 'string',
'validationPattern' => '^.+$', '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)): ?> <?php if (!isset($error)): ?>
<ul class="status-list"> <ul class="status-list">
<li> <li>
<span class="status circle success"></span> online <span class="status circle success"></span>
<?= e(trans('backend::lang.dashboard.status.online')) ?>
</li> </li>
<li> <li>
<a href="<?= Backend::url('system/updates') ?>"> <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> </a>
</li> </li>
</ul> </ul>