Skip to content

Latest commit

 

History

History
164 lines (113 loc) · 5.83 KB

README.md

File metadata and controls

164 lines (113 loc) · 5.83 KB

Logo Laravel-Translations

Introduction | Installation | Usage | Authorization | Upgrade | Roadmap | Changelog

Latest Stable Version Tests Total Downloads PHP from Packagist Laravel Version

Cover

Introduction

Laravel Translations UI is a package that provides a simple and friendly user interface for managing translations in a Laravel app. With this package, you can easily add, edit, delete, and export translations, and use the search function to find specific translations.

📺 Watch a 4-minute video by Povilas Korop showcasing the package.

Requirements

  • PHP 8.1 or higher
  • Laravel 10.x or higher

Features

  • View, create, and delete translations
  • Manage translation keys
  • Filter by translation keys or values
  • Import and export translations
  • Search function to find specific translations
  • and more...

Installation

To install Laravel Translations UI in your Laravel project, run the following command:

composer require outhebox/laravel-translations

Before you can import translations, you'll need to migrate your database. Run the following command to do so:

php artisan migrate

After installing the package, you'll need to publish its assets by running the following command:

php artisan translations:install

Usage

To import your translations, run the following command:

php artisan translations:import

To import and overwrite all previous translations, use the following command:

php artisan translations:import --fresh

To access the translations UI, visit /translations in your browser. If you are using a production environment, you will need to login to your application before accessing the translations UI.

You can customize the authorization gate in the configuration file to control access to the translations UI in non-local environments. For more information, see for more details Authorization.

Exporting Translations

To export your translations, run the following command:

php artisan translations:export

Authorization

By default, the Translations UI dashboard can only be accessed in the local environment. The authorization gate in the app/Providers/TranslationsServiceProvider.php file controls access to the Translations UI dashboard in non-local environments. You can modify this gate as needed to restrict access to your Translations UI installation.

To customize the authorization gate, you can define a closure in the gate method of the TranslationsServiceProvider class:

protected function gate()
{
    Gate::define('viewLaravelTranslationsUI', function ($user) {
        return in_array($user->email, [
            // return true or false based on your authorization logic
        ]);
    });
}

Upgrading

When upgrading to a new major version of Laravel Translations UI, it's important that you carefully review the upgrade guide.

In addition, when upgrading to any new Translations UI version, you should re-publish Translations UI assets:

php artisan translations:publish

To keep the assets up-to-date and avoid issues in future updates, you may add the translations:publish command to the post-update-cmd scripts in your application's composer.json file:

{
    "scripts": {
        "post-update-cmd": [
            "@php artisan translations:publish --ansi"
        ]
    }
}

Roadmap

  • Add tests.
  • Improve the UI.
  • Vendor translations support.
  • Google Translate API integration.
  • Invite collaborators to manage translations.
  • Add revision history.
  • Add more features.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.


Support

Thank you for considering supporting the development of this package! If you'd like to contribute, you can buy me a coffee or sponsor me to help keep me motivated to continue improving this package. You can also support the project by starring ⭐ the repository.

To buy me a coffee, click the button below:

Buy Me A Coffee

Credits

License

The MIT License (MIT). Please see License File for more information.