Skip to content

Commit

Permalink
Added translatables
Browse files Browse the repository at this point in the history
  • Loading branch information
eluhr committed Feb 4, 2022
1 parent 5c249b7 commit 99cf654
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 25 deletions.
6 changes: 4 additions & 2 deletions src/controllers/RbacController.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function renderRoles()

foreach ($_gs as $groupName => $g) {
$groupMmd = implode("\n", $g);
if ($groupName != '__NONE__') {
if ($groupName !== '__NONE__') {
$rolesMmd .= $this->renderAsSubgraph($groupName, $groupMmd);
} else {
$rolesMmd .= $groupMmd;
Expand All @@ -148,7 +148,9 @@ private function renderRoles()

private function renderAssignments($item)
{
if (in_array($item->name, $this->module->rbacDiagramExcludeRoles)) return;
if (in_array($item->name, $this->module->rbacDiagramExcludeRoles, true)) {
return;
}

$assignmentsMmd = '';
foreach ($this->_manager->getChildren($item->name) as $child) {
Expand Down
5 changes: 3 additions & 2 deletions src/views/config/_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<br/>
<?php
foreach (Metadata::getControllerActions($controller[0]) as $action) {

echo Html::a($action['route'], $action['route']).'<br/>';
}
?>
Expand All @@ -38,6 +37,8 @@
</div>
<?php else: ?>
<div class="alert alert-warning">
Unable to detect controllers for <b><?= $model['name'] ?></b>
<?php echo Yii::t('backend-module', 'Unable to detect controllers for <b>{moduleName}</b>', [
'moduleName' => $model['name']
])?>
</div>
<?php endif; ?>
8 changes: 8 additions & 0 deletions src/views/config/view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/**
* @var \yii\data\DataProviderInterface $loadedModulesDataProvider
* @var array $params
* @var array $components
* @var array $modules
* @var array $env
*/

namespace _;

use insolita\wgadminlte\Box;
Expand Down
21 changes: 14 additions & 7 deletions src/views/default/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php

/**
* @var array $items
*/

use yii\helpers\Url;

$this->params['breadcrumbs'][] = ['label' => Yii::t('backend-module', 'Dashboard')];
$this->title = Yii::t('backend-module', 'Dashboard');
?>
Expand All @@ -25,7 +32,7 @@
<div class="icon">
<i class="ion ion-home"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['/']) ?>" class="small-box-footer">
<a href="<?= Yii::$app->getHomeUrl() ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Homepage')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand Down Expand Up @@ -54,7 +61,7 @@
<div class="icon">
<i class="ion ion-person"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['/user/admin']) ?>" class="small-box-footer">
<a href="<?= Url::to(['/user/admin/index']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Manage')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand All @@ -76,7 +83,7 @@
<div class="icon">
<i class="ion ion-stats-bars"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['/backend/config/view']) ?>" class="small-box-footer">
<a href="<?= Url::to(['/backend/config/view']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Configuration')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand All @@ -99,7 +106,7 @@
<div class="icon">
<i class="ion ion-grid"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['/audit']) ?>" class="small-box-footer">
<a href="<?= Url::to(['/audit']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Audit')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand All @@ -120,7 +127,7 @@
<div class="icon">
<i class="ion ion-grid"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['rbac/diagram']) ?>" class="small-box-footer">
<a href="<?= Url::to(['rbac/diagram']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Diagram')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand All @@ -142,7 +149,7 @@
<div class="icon">
<i class="ion ion-grid"></i>
</div>
<a href="<?= \yii\helpers\Url::to(['rbac/assignments']) ?>" class="small-box-footer">
<a href="<?= Url::to(['rbac/assignments']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Assignments')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand All @@ -164,7 +171,7 @@
<div class="icon">
<i class="ion ion-grid"></i>
</div>
<a data-confirm="<?=Yii::t('backend-module', 'Are you sure?')?>" href="<?= \yii\helpers\Url::to(['cache/flush']) ?>" class="small-box-footer">
<a data-confirm="<?=Yii::t('backend-module', 'Are you sure?')?>" href="<?= Url::to(['cache/flush']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Flush')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/views/layouts/_sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@


<?php

echo Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget' => 'tree'],
'encodeLabels' => false,
'items' => ArrayHelper::merge(
['items' => ['label' => 'Backend navigation', 'options' => ['class' => 'header']]],
['items' => ['label' => Yii::t('backend-module', 'Backend navigation') , 'options' => ['class' => 'header']]],
$menuItems
),
]
Expand Down
4 changes: 2 additions & 2 deletions src/views/layouts/box.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @var string $content
*/
?>

<?php $this->beginContent('@vendor/dmstr/yii2-backend-module/src/views/layouts/main.php'); ?>

<div class="box box-solid">
<div class="box-body">

<?= $content ?>

</div>
<!-- /.box-body -->
</div>
Expand Down
17 changes: 8 additions & 9 deletions src/views/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

<header class="main-header">
<!-- Logo -->
<a href="<?= Url::to(['/backend']) ?>" class="logo">
<a href="<?= Url::to(['/backend/default/index']) ?>" class="logo">
<?= FA::icon($navBarIcon) ?>
<span class="title"></span><?= getenv('APP_TITLE') ?>
</a>
Expand Down Expand Up @@ -186,12 +186,12 @@
<li class="user-footer">
<div class="pull-left">
<a href="<?= Url::to(['/user/settings/profile']) ?>"
class="btn btn-default btn-flat">Profile</a>
class="btn btn-default btn-flat"><?php echo Yii::t('backend-module', 'Profile') ?></a>
</div>
<div class="pull-right">
<a href="<?= Url::to(['/user/security/logout']) ?>"
target="_top"
class="btn btn-default btn-flat" data-method="post">Sign out</a>
class="btn btn-default btn-flat" data-method="post"><?php echo Yii::t('backend-module', 'Sign out') ?></a>
</div>
</li>
</ul>
Expand Down Expand Up @@ -259,12 +259,11 @@ class="btn btn-default btn-flat" data-method="post">Sign out</a>
<?= $this->blocks['extra-content'] ?>

<!-- /.content-wrapper -->
<footer class="main-footer">
<strong>
<?= getenv('APP_NAME') ?>-<?= APP_VERSION ?></strong>
built with
<a href="http://phundament.com" target="_blank">phd</a>
</footer>
<footer class="main-footer"><?php echo Yii::t('backend-module', '<strong>{appName}-{appVersion}</strong> build with {phdLink}', [
'appName' => getenv('APP_NAME'),
'appVersion' => APP_VERSION,
'phdLink' => '<a href="https://phundament.com" target="_blank">phd</a>'
]) ?></footer>

<?= $this->render('_control-sidebar') ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/views/modal.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{{ Html.a(
FA.icon(FA._ARROW_CIRCLE_LEFT),
Url.to(['/backend']),
Url.to(['/backend/default/index']),
{
'target': app.params['backend.iframe.name'],
'class': 'btn btn-xs btn-default btn-primary',
Expand Down

0 comments on commit 99cf654

Please sign in to comment.