Back to Course |
Multi-Language Laravel 11: All You Need to Know

MohmmedAshraf/laravel-translations

This package is a UI-based translations manager for your application:

Installation

Full installation guide can be found here but here is a quick summary:

Installing package via composer:

composer require outhebox/laravel-translations --with-all-dependencies

Publishing package assets:

php artisan translations:install

Migrating the database:

php artisan migrate

Importing translations:

php artisan translations:import

Creating a user:

php artisan translations:contributor

And now if you visit your-app.com/translations you should see the UI:


Package Features

There are a few things you can do with this package:

  • Add new languages
  • Manage translations per language

So let's dive into those!

Adding New Languages

To add a new language, click on the New Language + button:

This will open a modal where you can add the language:

Once you click on Add Language the language will be added to the database, and you will see it on the list:

Managing Translations

To manage the translations for a language, click on the language line, and you will be met with a list of all the translations for that language:

You can filter this list using a search box or simply click on the translation string you want to add to the database:

Enter your translation and click on Save. This will save the translation to the database. To publish them - you have two options:

1: Run php artisan translations:export to export all translations to the resources/lang folder. 2: Press the Publish button on the UI.

In both cases, you should see that your translated strings are now available in your application:

That's it! You can now manage your translations using this package.


Conclusion

This package provides a very nice and intuitive UI experience to manage the translations for your application. It's very easy to use, and it has a lot of features that make it a great choice for managing translations. One thing to note is that there are steps that you need to take to protect the UI from unauthorized users. You can read more about that here.


Repository: https://github.com/LaravelDaily/laravel11-localization-course/tree/lesson/packages/MohmmedAshraf-translations