Skip to content

Commit

Permalink
Merge pull request #7 from Laravel-Backpack/rename
Browse files Browse the repository at this point in the history
Rename to Translation Manager
  • Loading branch information
tabacitu authored Apr 2, 2024
2 parents 50c1194 + 10145cb commit 801f772
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 114 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `LanguageManager` will be documented in this file.
All notable changes to `TranslationManager` will be documented in this file.

## Version 1.0

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backpack/language-manager",
"description": "Language Manager for Backpack",
"name": "backpack/translation-manager",
"description": "Translation Manager for Backpack",
"license": "MIT",
"authors": [
{
Expand All @@ -14,9 +14,9 @@
"homepage": "https://backpackforlaravel.com"
}
],
"homepage": "https://github.com/backpack/language-manager",
"homepage": "https://github.com/backpack/translation-manager",
"keywords": [
"Laravel", "Backpack", "Backpack for Laravel", "Backpack Addon", "LanguageManager"
"Laravel", "Backpack", "Backpack for Laravel", "Backpack Addon", "TranslationManager"
],
"require": {
"backpack/crud": "^6.7",
Expand All @@ -31,12 +31,12 @@
},
"autoload": {
"psr-4": {
"Backpack\\LanguageManager\\": "src/"
"Backpack\\TranslationManager\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Backpack\\LanguageManager\\Tests\\": "tests"
"Backpack\\TranslationManager\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -48,7 +48,7 @@
"extra": {
"laravel": {
"providers": [
"Backpack\\LanguageManager\\AddonServiceProvider"
"Backpack\\TranslationManager\\AddonServiceProvider"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
lang_path(),
],

// Allow create new language lines
// Allow create new translation lines
'create' => false,

// This will limit the available groups when creating a new language line
// This will limit the available groups when creating a new translation line
// If you want to allow all groups, just leave it empty
// It's only applied if create is set to true
'groups' => [
//
],

// Display source column
// Adds a column to the language lines table to show the source, either database or file
// Adds a column to the translation lines table to show the source, either database or file
'display_source' => false,

// If you have Editable Columns addon, Backpack will use it in the translations table.
Expand Down
4 changes: 2 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing

Contributions are welcome and will be fully credited:
- code contributions are accepted via Pull Requests to [this Github repo](https://github.com/backpack/language-manager);
- code contributions are accepted via Pull Requests to [this Github repo](https://github.com/backpack/translation-manager);
- financial contributions are usually in the form of [donations](), [projects]() or [jobs]();
- documentation contributions are accepted via Pull Requests to [this Github repo](https://github.com/backpack/language-manager);
- documentation contributions are accepted via Pull Requests to [this Github repo](https://github.com/backpack/translation-manager);
- other contributions are most likely welcome in the way you see fit;

# Things you could do
Expand Down
26 changes: 12 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Language Manager
# Translation Manager

[![Total Downloads][ico-downloads]][link-downloads]
[![The Whole Fruit Manifesto](https://img.shields.io/badge/writing%20standard-the%20whole%20fruit-brightgreen)](https://github.com/the-whole-fruit/manifesto)

Language Manager provides a simple user interface to help you deal with translations in your Backpack application.
Translation Manager provides a simple user interface to help you deal with translations in your Backpack application.
At a quick glance, some of the most relevant features are:

- View a list of all translations present in your application's language files (including vendor translations).
Expand All @@ -19,7 +19,7 @@ This package uses the battle tested [spatie/laravel-translation-loader](https://

## Demo

Try it right now, edit some translations in [our online demo](https://demo.backpackforlaravel.com/admin/language-manager).
Try it right now, edit some translations in [our online demo](https://demo.backpackforlaravel.com/admin/translation-manager).

## Installation

Expand All @@ -28,7 +28,7 @@ In your Laravel + Backpack project:
**1) Install the package using Composer**:

```bash
composer require backpack/language-manager
composer require backpack/translation-manager
```

**2) Configure the application**
Expand All @@ -53,14 +53,14 @@ php artisan migrate
3.1) Add a menu item to `menu_items.blade.php` for easy access:

```bash
php artisan backpack:add-menu-content "<x-backpack::menu-item title=\"Language Manager\" icon=\"la la-stream\" :link=\"backpack_url('language-manager')\" />"
php artisan backpack:add-menu-content "<x-backpack::menu-item title=\"Translation Manager\" icon=\"la la-stream\" :link=\"backpack_url('translation-manager')\" />"
```

3.2) Publish the config files:

```bash
php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="config"
php artisan vendor:publish --provider="Backpack\LanguageManager\AddonServiceProvider" --tag="config"
php artisan vendor:publish --provider="Backpack\TranslationManager\AddonServiceProvider" --tag="config"
```

**NOTE:** We highly recommend you to use this package alongside [Language Switcher](https://github.com/Laravel-Backpack/language-switcher) package, so that you can easily switch between languages in your panel.
Expand All @@ -72,7 +72,7 @@ php artisan vendor:publish --provider="Backpack\LanguageManager\AddonServiceProv

![](https://private-user-images.githubusercontent.com/1032474/318216122-88996f7c-6807-4c54-a3f8-10ab18afaa24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE4MjI3NTcsIm5iZiI6MTcxMTgyMjQ1NywicGF0aCI6Ii8xMDMyNDc0LzMxODIxNjEyMi04ODk5NmY3Yy02ODA3LTRjNTQtYTNmOC0xMGFiMThhZmFhMjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMzBUMTgxNDE3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWFjNWMzMGEyOWZhMmUwYjQ5OGVhNmRiYTZlNjJiYmE1ZTk0NTllMDk4MTkyMjcxMjIwNjQ3NjNhMjdhNzdmNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.VSr1PIyGkrb13awM5kA9tJK4vf8SPwcVyA1mFpHIUd4)

The list view displays a comprehensive list of all translations within your application. By default, all translations including vendor translations are displayed in the list view. If you don't want to see vendor translations, you can set the config option `load_all_registered_translation_paths` to `false` in `config/backpack/language-manager.php`.
The list view displays a comprehensive list of all translations within your application. By default, all translations including vendor translations are displayed in the list view. If you don't want to see vendor translations, you can set the config option `load_all_registered_translation_paths` to `false` in `config/backpack/translation-manager.php`.

Additionally, if you have [Backpack Pro](https://backpackforlaravel.com/products/pro-for-unlimited-projects) installed, your admin can also see and use the filters, to quickly narrow down translations.

Expand All @@ -90,11 +90,9 @@ Once edited, the changes are saved to the database for persistence. All translat

If you have the [Editable Columns](https://backpackforlaravel.com/products/editable-columns) package installed, the admin can directly edit translations within the List View. This provides an excellent UX - because they can translate everything much much faster, without having to switch pages.

If you don't want that behavior you can disable it in the `config/backpack/language-manager.php` file by setting `use_editable_columns => false`.
If you don't want that behavior you can disable it in the `config/backpack/translation-manager.php` file by setting `use_editable_columns => false`.
If you don't find that file, see above the optional steps to publish the config files.

Once edited, the changes are saved to the database for persistence. All translations on the database have priority over the ones in the language files. This means that you can safely let your admin edit translations, in production. Your auto-deploys will continue working, because no files get edited, only DB entries.

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Expand All @@ -108,11 +106,11 @@ If you discover any security related issues, please email cristian.tabacitu@back

## License

This project was released under MIT License, so you can install it on top of any Backpack & Laravel project. Please see the [license file](https://backpackforlaravel.com/products/language-manager/license.md) for more information.
This project was released under MIT License, so you can install it on top of any Backpack & Laravel project. Please see the [license file](https://backpackforlaravel.com/products/translation-manager/license.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/backpack/language-manager.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/backpack/language-manager.svg?style=flat-square
[ico-version]: https://img.shields.io/packagist/v/backpack/translation-manager.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/backpack/translation-manager.svg?style=flat-square

[link-author]: https://github.com/laravel-backpack
[link-contributors]: ../../contributors
[link-downloads]: https://packagist.org/packages/backpack/language-manager
[link-downloads]: https://packagist.org/packages/backpack/translation-manager
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

return [
'language_line' => 'language line',
'language_lines' => 'language lines',
'translation_line' => 'translation line',
'translation_lines' => 'translation lines',

'group' => 'group',
'key' => 'key',
Expand All @@ -15,7 +15,7 @@
'database' => 'database',
'file' => 'file',

'show-all-languages' => 'show all languages',
'show_all_languages' => 'show all languages',
'revert' => 'revert',

'revert_confirm' => 'Are you sure you want to revert this translation?',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

return [
'language_line' => 'tradução',
'language_lines' => 'traduções',
'translation_line' => 'tradução',
'translation_lines' => 'traduções',

'group' => 'grupo',
'key' => 'chave',
Expand All @@ -15,7 +15,7 @@
'database' => 'base de dados',
'file' => 'ficheiro',

'show-all-languages' => 'mostrar todos os idiomas',
'show_all_languages' => 'mostrar todos os idiomas',
'revert' => 'reverter',

'revert_confirm' => 'Tem a certeza que quer reverter esta tradução?',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/admin/details_row.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@include('backpack.language-manager::columns.language-preview-table')
@include('backpack.translation-manager::columns.translation-preview-table')
16 changes: 8 additions & 8 deletions resources/views/buttons/revert.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<span onclick="revertEntry(this)" data-route="{{ url($crud->route.'/'.$entry->getKey()) }}" class="btn btn-sm btn-link" data-button-type="revert">
<span>
<i class="la la-undo"></i>
{{ ucfirst(trans('backpack.language-manager::language_manager.revert')) }}
{{ ucfirst(trans('backpack.translation-manager::translation_manager.revert')) }}
</span>
</span>
@endif

@push('after_scripts') @if (request()->ajax()) @endpush @endif
@bassetBlock('backpack/language-manager/buttons/revert-button-'.app()->getLocale().'.js')
@bassetBlock('backpack/translation-manager/buttons/revert-button-'.app()->getLocale().'.js')
<script>
if (typeof revertEntry !== 'function') {
function revertEntry(button) {
let trans = {
warning: '{!! addslashes(ucfirst(trans("backpack::base.warning"))) !!}',
cancel: '{!! addslashes(ucfirst(trans("backpack::crud.cancel"))) !!}',
revert: '{!! addslashes(ucfirst(trans("backpack.language-manager::language_manager.revert"))) !!}',
revert_confirm: '{!! addslashes(trans("backpack.language-manager::language_manager.revert_confirm")) !!}',
revert_confirmation_title: '{!! addslashes(trans("backpack.language-manager::language_manager.revert_confirmation_title")) !!}',
revert_confirmation_message: '{!! addslashes(trans("backpack.language-manager::language_manager.revert_confirmation_message")) !!}',
revert_confirmation_not_title: '{!! addslashes(trans("backpack.language-manager::language_manager.revert_confirmation_not_title")) !!}',
revert_confirmation_not_message: '{!! addslashes(trans("backpack.language-manager::language_manager.revert_confirmation_not_message")) !!}',
revert: '{!! addslashes(ucfirst(trans("backpack.translation-manager::translation_manager.revert"))) !!}',
revert_confirm: '{!! addslashes(trans("backpack.translation-manager::translation_manager.revert_confirm")) !!}',
revert_confirmation_title: '{!! addslashes(trans("backpack.translation-manager::translation_manager.revert_confirmation_title")) !!}',
revert_confirmation_message: '{!! addslashes(trans("backpack.translation-manager::translation_manager.revert_confirmation_message")) !!}',
revert_confirmation_not_title: '{!! addslashes(trans("backpack.translation-manager::translation_manager.revert_confirmation_not_title")) !!}',
revert_confirmation_not_message: '{!! addslashes(trans("backpack.translation-manager::translation_manager.revert_confirmation_not_message")) !!}',
};
swal({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$locales = config('backpack.crud.locales');
@endphp

<div language-edit-field data-init-function="bpFieldInitLanguageEditField" class="form-group col-sm-12 mb-3">
<div translation-edit-field data-init-function="bpFieldInitTranslationEditField" class="form-group col-sm-12 mb-3">
<label>{{ $label }}</label>

<div class="align-items-center justify-content-between d-flex mb-2 w-100">
Expand All @@ -16,7 +16,7 @@
</div>
</label>

{{-- Language Switcher --}}
{{-- Translation Switcher --}}
<select
class="form-select">
@foreach($locales as $locale => $name)
Expand All @@ -28,13 +28,13 @@ class="form-select">
{{-- Toggler --}}
<div class="d-inline-flex align-items-center">
<label class="form-switch switch switch-sm switch-label switch-pill switch-primary mb-0">
<input type="checkbox" class="switch-input form-check-input" id="switch_language_edit_field">
<input type="checkbox" class="switch-input form-check-input" id="switch_translation_edit_field">
</label>
<label class="font-weight-normal mb-0 ml-2" for="switch_language_edit_field">{{ ucfirst(__('backpack.language-manager::language_manager.show-all-languages')) }}</label>
<label class="font-weight-normal mb-0 ml-2" for="switch_translation_edit_field">{{ ucfirst(__('backpack.translation-manager::translation_manager.show_all_languages')) }}</label>
</div>
</div>

{{-- Language inputs --}}
{{-- Translation inputs --}}
<div inputs>
@foreach($locales as $locale => $name)
<div class="d-none" locale="{{ $locale }}">
Expand All @@ -51,30 +51,30 @@ class="form-control mb-1"
</div>

@push('crud_fields_styles')
@bassetBlock('backpack/language-manager/fields/language-edit.css')
@bassetBlock('backpack/translation-manager/fields/translation-edit.css')
<style>
[language-edit-field] [flags] {
[translation-edit-field] [flags] {
width: 1.5rem;
height: 1.25rem;
}
[language-edit-field] [inputs] svg {
[translation-edit-field] [inputs] svg {
width: 1.8rem;
}
[language-edit-field].show-all-languages div[locale],
[language-edit-field].show-all-languages div[locale] svg {
[translation-edit-field].show-all-languages div[locale],
[translation-edit-field].show-all-languages div[locale] svg {
display: block !important;
}
[language-edit-field].show-all-languages [switcher] {
[translation-edit-field].show-all-languages [switcher] {
opacity: 0;
}
</style>
@endBassetBlock
@endpush

@push('crud_fields_scripts')
@bassetBlock('backpack/language-manager/fields/language-edit.js')
@bassetBlock('backpack/translation-manager/fields/translation-edit.js')
<script>
function bpFieldInitLanguageEditField(elem) {
function bpFieldInitTranslationEditField(elem) {
let element = elem[0];
let select = element.querySelector('[switcher] select');
let flags = element.querySelector('[flags]');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

use Backpack\LanguageManager\Http\Controllers\LanguageManagerCrudController;
use Backpack\TranslationManager\Http\Controllers\TranslationManagerCrudController;

/*
|--------------------------------------------------------------------------
| Backpack\LanguageManager Routes
| Backpack\TranslationManager Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are
| handled by the Backpack\LanguageManager package.
| handled by the Backpack\TranslationManager package.
|
*/
Route::group([
'prefix' => config('backpack.base.route_prefix', 'admin'),
'middleware' => ['web', config('backpack.base.middleware_key', 'admin')],
], function () {
Route::crud('language-manager', LanguageManagerCrudController::class);
Route::crud('translation-manager', TranslationManagerCrudController::class);
});
6 changes: 3 additions & 3 deletions src/AddonServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Backpack\LanguageManager;
namespace Backpack\TranslationManager;

use Backpack\LanguageManager\AutomaticServiceProvider;
use Backpack\TranslationManager\AutomaticServiceProvider;
use Illuminate\Support\ServiceProvider;

class AddonServiceProvider extends ServiceProvider
{
use AutomaticServiceProvider;

protected $vendorName = 'backpack';
protected $packageName = 'language-manager';
protected $packageName = 'translation-manager';
protected $commands = [];
}
2 changes: 1 addition & 1 deletion src/AutomaticServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Backpack\LanguageManager;
namespace Backpack\TranslationManager;

use Backpack\CRUD\ViewNamespaces;

Expand Down
Loading

0 comments on commit 801f772

Please sign in to comment.