insnsk/laravel-translate-excel

Convert translations to/from a single Excel file

dev-main 2024-06-25 03:03 UTC

This package is auto-updated.

Last update: 2025-04-25 04:43:25 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package converts all PHP translations from Laravel`s "lang" directory a single Excel file with dot-arrayed keys. Each file comes to a separate sheet.

Installation

You can install the package via composer:

composer require insnsk/laravel-translate-excel

You can publish the config file with:

php artisan vendor:publish --tag="laravel-translate-excel-config"

This is the contents of the published config file:

return [
    // this is the default locale which will be used as reference
    'main_locale' => 'en',
    // what locations would you like to have in your file
    'locales' => ['en','de','ru','ja']
];

Usage

Just invoke the artisan console command:

php artisan lang:convert

And get your generated file at 'storage/app/translations.xlsx' You can specify filename as a parameter:

php artisan lang:convert to my_filename.xlsx

After you translate the file in Excel you would probably need to get it back to your app. So put your translated file "my_filename.xlsx" into "storage/app" directory, then run:

php artisan lang:convert from my_filename.xlsx

PHP-translation files will be generated into "storage/lang" folder. Just copy them back to your app root.

Changelog

Readme update & config publish

Security Vulnerabilities

This package was made just for my needs, so it was not tested at all and the code is not perfect also. Use it at your own risk.

Credits

License

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