asperhsu/lang-excel-converter

Laravel localization import/export to excel converter

1.0.0 2019-03-23 06:45 UTC

README

Lang Excel Converter

Export localization to Excel. Each sheet is a group contains its' all locales translation. Import Excel to localization files.

Installation

Via Composer

$ composer require asper/langexcelconverter

Usage

Import

Command:

php artisan lang-excel:import {filename=translations.xlsx} {--disk}

Controller:

use Maatwebsite\Excel\Facades\Excel;
use Asper\LangExcelConverter\Imports\TranslationsImport;

Excel::import(new TranslationsImport, 'YOUR FILE');

Export

Command:

php artisan lang-excel:export {filename=translations.xlsx} {--disk}

Controller:

use Maatwebsite\Excel\Facades\Excel;
use Asper\LangExcelConverter\Exports\TranslationsExport;

// store
Excel::store(new TranslationsExport, 'YOUR FILE NAME');

// send download response
return Excel::download(new TranslationsExport, 'YOUR FILE NAME');

more Excel Facade usage: Maatwebsite/Laravel-Excel

Demo Project

asperhsu/langexcelconverter-demo

Troubleshooting

"SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)" when import

  • publish excel config
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
  • change config
[
    ...
    'transactions' => [
        'handler' => null,  // change 'db' to null
    ],
    ...
]