tanmuhittin / laravel-google-translate

Translate translation files to other languages using google translate or another translation api
MIT License
424 stars 71 forks source link

Error on multidimensional arrays #29

Closed briavers closed 4 years ago

briavers commented 4 years ago

Error with multidimensional arrays The file I want to translate

<?php

return [
    'action' => [
        'export_csv' => 'Export Csv',
        'import_csv' => 'Import Csv',
        'field' => [
            'supplier' => 'Supplier',
            'file' => 'File',
        ],
        'sendWebhookAction' => '(Re)-send order information to PlanManager',
    ],
    'tool' => [
        'order_csv_import' => [
            'name' => 'Import Order Csv',
            'success' => 'The file was successfully added to the queue.',
            'error' => 'The file is not valid.',
        ],
    ],
];

The error:

ErrorException  : Array to string conversion

  at /home/brian/code/orderplatform/vendor/tanmuhittin/laravel-google-translate/src/Commands/TranslateFilesCommand.php:231
    227|                 foreach ($to_be_translateds as $key => $to_be_translated) {
    228|                     if (isset($already_translateds[$key]) && $already_translateds[$key] != '' && !$this->force) {
    229|                         $new_lang[$key] = $already_translateds[$key];
    230|                         if ($this->verbose) {
  > 231|                             $this->line('Exists Skipping -> ' . $to_be_translated . ' : ' . $new_lang[$key]);
    232|                         }
    233|                         continue;
    234|                     }
    235|                     $new_lang[$key] = $this->translate_attribute($to_be_translated,$locale);

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()
      /home/brian/code/orderplatform/vendor/tanmuhittin/laravel-google-translate/src/Commands/TranslateFilesCommand.php:231

  2   Tanmuhittin\LaravelGoogleTranslate\Commands\TranslateFilesCommand::translate_php_array_files()
      /home/brian/code/orderplatform/vendor/tanmuhittin/laravel-google-translate/src/Commands/TranslateFilesCommand.php:106