backpack/translation-manager

Translation Manager for Backpack

1.0.5 2024-12-02 12:08 UTC

This package is auto-updated.

Last update: 2024-12-02 12:09:06 UTC


README

Total Downloads The Whole Fruit Manifesto

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.
  • Edit translations directly from the interface.
  • Search and filter translations for easy management.

This package uses the battle tested spatie/laravel-translation-loader under the hood.

Preview

lm_list_view

Demo

Try it right now, edit some translations in our online demo.

Installation

In your Laravel + Backpack project:

1) Install the package using Composer:

composer require backpack/translation-manager

2) Configure the application

If you already had spatie/laravel-translation-loader installed and configured, you can skip to the next step. Otherwise, follow along.

2.1) In your config/app.php you must replace Laravel's translation service provider:

-Illuminate\Translation\TranslationServiceProvider::class,
+Spatie\TranslationLoader\TranslationServiceProvider::class,

2.2) You must publish and run the migrations to create the language_lines table:

php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="migrations"
php artisan migrate

3) Optional setup options

3.1) Add a menu item to menu_items.blade.php for easy access:

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:

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

NOTE: We highly recommend you to use this package alongside Language Switcher package, so that you can easily switch between languages in your panel.

Usage

List View:

lm_list_view2

The list view displays a comprehensive list of all translations within your application translation folder (usually lang/). Please do note that translations in lang/vendor/xxx folders are not possible to translate using this package.

Additionally, if you have Backpack Pro installed, your admin can also see and use the filters, to quickly narrow down translations.

Edit View

lm_edit_view

Any translation can be edited by clicking the Edit button. It will open a page where the admin can input the new value, for all languages.

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.

Editable Columns

lm_editable_columns_view

If you have the 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/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.

Security

If you discover any security related issues, please email cristian.tabacitu@backpackforlaravel.com instead of using the issue tracker.

Credits

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 for more information.