Skip to content

Commit

Permalink
Merge pull request #12 from Opekunov/localization-fixes
Browse files Browse the repository at this point in the history
fix localization
  • Loading branch information
lee-to authored Jul 24, 2022
2 parents 3311c95 + 1ee9e39 commit b5c6ec0
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 39 deletions.
24 changes: 23 additions & 1 deletion lang/en/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return [
'dashboard' => 'Dashboard',
'add' => 'Add',
'create' => 'Create',
'save' => 'Save',
'saved' => 'Saved',
Expand All @@ -17,10 +18,19 @@
'export' => 'Export',
'cancel' => 'Cancel',
'confirm' => 'Confirm',
'close' => 'Close',
'confirm_delete' => 'Are you sure?',
'back' => 'Back',
'more' => 'More',
'all_sections' => 'All sections',
'file' => 'File',
'user' => 'User',
'changes' => 'Changes',
'last_changes' => 'Last 5 changes',
'date' => 'Date',
'field' => 'Field',
'before' => 'Before',
'after' => 'After',
'login' => [
'authorization' => 'Authorization',
'remember_me' => 'Remember me',
Expand All @@ -29,4 +39,16 @@
'email' => 'E-mail',
'password' => 'Password',
],
];
'base_resource' => [
'role' => 'Role',
'name' => 'Name',
'email' => 'E-mail',
'password' => 'Password',
'repeat_password' => 'Repeat password',
'avatar' => 'Avatar',
'created_at' => 'Created At',
'admins_title' => 'Admins',
'role_title' => 'Roles',
'role_name' => 'Title',
]
];
25 changes: 23 additions & 2 deletions lang/ru/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

return [
'dashboard' => 'Панель',
'create' => 'Добавить',
'add' => 'Добавить',
'create' => 'Создать',
'save' => 'Сохранить',
'saved' => 'Сохранено',
'saved_error' => 'Произошла ошибка',
Expand All @@ -17,10 +18,19 @@
'export' => 'Экспорт',
'cancel' => 'Отмена',
'confirm' => 'Подтвердить',
'close' => 'Закрыть',
'confirm_delete' => 'Вы уверены, что хотите удалить запись?',
'back' => 'Вернуться назад',
'more' => 'Перейти',
'all_sections' => 'Все разделы',
'file' => 'Файл',
'user' => 'Пользователь',
'changes' => 'Изменения',
'last_changes' => 'Последние 5 изменений',
'date' => 'Дата',
'field' => 'Поле',
'before' => 'До',
'after' => 'После',
'login' => [
'authorization' => 'Авторизация',
'remember_me' => 'Запомнить',
Expand All @@ -29,4 +39,15 @@
'email' => 'E-mail',
'password' => 'Пароль',
],
];
'resource' => [
'role' => 'Роль',
'name' => 'Имя',
'email' => 'E-mail',
'password' => 'Пароль',
'repeat_password' => 'Повторите пароль',
'avatar' => 'Аватар',
'created_at' => 'Дата создания',
'admins_title' => 'Администраторы',
'role_name' => 'Название',
]
];
16 changes: 8 additions & 8 deletions resources/views/base/changelog.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if($item->changeLogs && $item->changeLogs->isNotEmpty())
<div class="my-6 text-lg">Последнии 5 изменений</div>
<div class="my-6 text-lg">@lang('moonshine::ui.last_changes')</div>

<div class="flex flex-col mt-8">
<div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
Expand All @@ -8,13 +8,13 @@
<thead class="bg-whiteblue dark:bg-purple">
<tr>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
Пользователь
@lang('moonshine::ui.user')
</th>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
Изменения
@lang('moonshine::ui.changes')
</th>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
Дата
@lang('moonshine::ui.date')
</th>
</tr>
</thead>
Expand All @@ -33,13 +33,13 @@
<thead class="bg-whiteblue dark:bg-purple">
<tr>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
Поле
@lang('moonshine::ui.field')
</th>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
До
@lang('moonshine::ui.before')
</th>
<th class="px-6 py-3 text-left text-xs leading-4 font-medium uppercase tracking-wider">
После
@lang('moonshine::ui.after')
</th>
</tr>
</thead>
Expand Down Expand Up @@ -72,4 +72,4 @@
</div>
</div>
</div>
@endif
@endif
6 changes: 3 additions & 3 deletions resources/views/base/index/shared/filters.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class="transition ease-in-out duration-300 transform ml-auto relative
flex flex-col overflow-y-auto"
>
<div class="px-4 flex items-center justify-between">
<h2 class="text-lg font-medium">Фильтры</h2>
<h2 class="text-lg font-medium">@lang('moonshine::ui.filters')</h2>

<button @click="filtersOpen = false" type="button" class="-mr-2 w-10 h-10 bg-white text-black dark:bg-purple dark:text-white p-2 rounded-md flex items-center justify-center">
<span class="sr-only">Закрыть</span>
<span class="sr-only">@lang('moonshine::ui.close')</span>

<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
Expand Down Expand Up @@ -71,4 +71,4 @@ class="bg-transparent hover:bg-purple text-purple
</div>


@endif
@endif
4 changes: 2 additions & 2 deletions resources/views/fields/multi-select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</div>
<div class="w-full px-4">
<div x-show.transition.origin.top="isOpen()" class="absolute shadow-lg top-100 bg-white dark:bg-darkblue z-40 w-full left-0 rounded max-h-select" x-on:click.outside="close">
<input placeholder="Поиск"
<input placeholder="@lang('moonshine::ui.search')"
type="text"
x-on:keydown="filterOptions()"
x-model="search"
Expand Down Expand Up @@ -160,4 +160,4 @@ function multiSelect_{{ $field->id() }}() {
}
}
}
</script>
</script>
4 changes: 2 additions & 2 deletions resources/views/fields/shared/file.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</svg>

<span class="ml-2 flex-1 truncate">
Файл {{ $index ?? '' }}
@lang('moonshine::file') {{ $index ?? '' }}
</span>

@if($canDownload)
Expand All @@ -16,4 +16,4 @@
</div>
@endif
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions resources/views/fields/shared/full-fields.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class="bg-gradient-to-r from-purple to-pink text-white
text-white font-semibold py-2 px-4 rounded"
@click="addNewField()"
>
Добавить
@lang('moonshine::ui.add')
</button>
@else
<button x-show="items.length == 0" type="button"
class="bg-gradient-to-r from-purple to-pink text-white
text-white font-semibold py-2 px-4 rounded"
@click="addNewField()"
>
Создать
@lang('moonshine::ui.create')
</button>
@endif
</div>
Expand All @@ -63,4 +63,4 @@ function handler_{{ $field->id() }}() {
},
}
}
</script>
</script>
6 changes: 3 additions & 3 deletions resources/views/fields/shared/table-fields.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class="bg-gradient-to-r from-purple to-pink text-white
text-white font-semibold py-2 px-4 rounded"
@click="addNewField()"
>
Добавить
@lang('moonshine::ui.add')
</button>
@else
<button x-show="items.length == 0" type="button"
class="bg-gradient-to-r from-purple to-pink text-white
text-white font-semibold py-2 px-4 rounded"
@click="addNewField()"
>
Создать
@lang('moonshine::ui.create')
</button>
@endif
</td>
Expand Down Expand Up @@ -96,4 +96,4 @@ function handler_{{ $field->id() }}() {
},
}
}
</script>
</script>
25 changes: 14 additions & 11 deletions src/Resources/MoonShineUserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,50 @@ class MoonShineUserResource extends Resource
{
public static string $model = MoonshineUser::class;

public static string $title = 'Администраторы';

public string $titleField = 'name';

protected static bool $system = true;

public function title(): string
{
return trans('moonshine::ui.base_resource.admins_title');
}

public function fields(): array
{
return [
ID::make()
->sortable()
->showOnExport(),

BelongsTo::make('Роль', 'moonshine_user_role_id', new MoonShineUserRoleResource())
BelongsTo::make(trans('moonshine::ui.base_resource.role'), 'moonshine_user_role_id', new MoonShineUserRoleResource())
->showOnExport(),

Text::make('Имя', 'name')
Text::make(trans('moonshine::ui.base_resource.name'), 'name')
->required()
->showOnExport(),

Image::make('Аватар', 'avatar')
Image::make(trans('moonshine::ui.base_resource.avatar'), 'avatar')
->removable()
->showOnExport()
->disk(config('filesystems.default'))
->dir('moonshine_users')
->allowedExtensions(['jpg', 'png', 'jpeg', 'gif']),

Date::make('Дата создания', 'created_at')
Date::make(trans('moonshine::ui.base_resource.created_at'), 'created_at')
->format("d.m.Y")
->default(now())
->sortable()
->hideOnForm()
->showOnExport(),

Email::make('E-mail', 'email')
Email::make(trans('moonshine::ui.base_resource.email'), 'email')
->sortable()
->showOnExport()
->required(),

Password::make('Пароль', 'password')->hideOnIndex(),
PasswordRepeat::make('Повторите пароль', 'password_repeat')->hideOnIndex(),
Password::make(trans('moonshine::ui.base_resource.password'), 'password')->hideOnIndex(),
PasswordRepeat::make(trans('moonshine::ui.base_resource.repeat_password'), 'password_repeat')->hideOnIndex(),
];
}

Expand All @@ -84,14 +87,14 @@ public function search(): array
public function filters(): array
{
return [
TextFilter::make('Имя', 'name'),
TextFilter::make(trans('moonshine::ui.base_resource.name'), 'name'),
];
}

public function actions(): array
{
return [
ExportAction::make('Экспорт'),
ExportAction::make(trans('moonshine::ui.export')),
];
}
}
12 changes: 8 additions & 4 deletions src/Resources/MoonShineUserRoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ class MoonShineUserRoleResource extends Resource
{
public static string $model = MoonshineUserRole::class;

public static string $title = 'Роли';

public string $titleField = 'name';

protected static bool $system = true;

public function title(): string
{
return trans('moonshine::ui.base_resource.role');
}

public function fields(): array
{
return [
ID::make()->sortable()->showOnExport(),
Text::make('Название', 'name')->required()->showOnExport(),
Text::make(trans('moonshine::ui.base_resource.role_name'), 'name')
->required()->showOnExport(),
];
}

Expand All @@ -41,7 +45,7 @@ public function search(): array
public function filters(): array
{
return [
TextFilter::make('Название', 'name'),
TextFilter::make(trans('moonshine::ui.base_resource.role_name'), 'name'),
];
}

Expand Down

0 comments on commit b5c6ec0

Please sign in to comment.