nikaia / translation-sheet

Translating Laravel languages files using a Google Spreadsheet.
GNU General Public License v3.0
291 stars 60 forks source link

[Question] Is it possible to add a language to the project later on? #15

Closed reense closed 7 years ago

reense commented 7 years ago

I tried adding it to the array in .env, but got the following:


  [ErrorException]                                                          
  array_combine(): Both parameters should have an equal number of elements  

Exception trace:
 () at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Util.php:36
 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
 array_combine() at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Util.php:36
 Nikaia\TranslationSheet\Util::Nikaia\TranslationSheet\{closure}() at n/a:n/a
 array_map() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Support/Collection.php:563
 Illuminate\Support\Collection->map() at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Util.php:37
 Nikaia\TranslationSheet\Util::keyValues() at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Puller.php:47
 Nikaia\TranslationSheet\Puller->getTranslations() at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Puller.php:30
 Nikaia\TranslationSheet\Puller->pull() at /Users/reensem/Projects/Onevision/vendor/nikaia/translation-sheet/src/Commands/Pull.php:16
 Nikaia\TranslationSheet\Commands\Pull->handle() at n/a:n/a
 call_user_func_array() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
 Illuminate\Container\Container->call() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
 Illuminate\Console\Command->execute() at /Users/reensem/Projects/Onevision/vendor/symfony/console/Command/Command.php:266
 Symfony\Component\Console\Command\Command->run() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
 Illuminate\Console\Command->run() at /Users/reensem/Projects/Onevision/vendor/symfony/console/Application.php:856
 Symfony\Component\Console\Application->doRunCommand() at /Users/reensem/Projects/Onevision/vendor/symfony/console/Application.php:203
 Symfony\Component\Console\Application->doRun() at /Users/reensem/Projects/Onevision/vendor/symfony/console/Application.php:127
 Symfony\Component\Console\Application->run() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Console/Application.php:64
 Illuminate\Console\Application->call() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:170
 Illuminate\Foundation\Console\Kernel->call() at /Users/reensem/Projects/Onevision/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:217

It has unequal keys. Example (Good one, and the one that crashes:


array:11 [
  0 => "fullKey"
  1 => "fr"
  2 => "en"
  3 => "ru"
  4 => "es"
  5 => "de"
  6 => "nl"
  7 => "namespace"
  8 => "group"
  9 => "key"
  10 => "sourceFile"
]
array:11 [
  0 => "validation.url"
  1 => ""
  2 => "The :attribute format is invalid."
  3 => ""
  4 => ""
  5 => ":attribute Format ist ungültig. "
  6 => ""
  7 => ""
  8 => "validation"
  9 => "url"
  10 => "{locale}/validation.php"
]
array:11 [
  0 => "fullKey"
  1 => "fr"
  2 => "en"
  3 => "ru"
  4 => "es"
  5 => "de"
  6 => "nl"
  7 => "namespace"
  8 => "group"
  9 => "key"
  10 => "sourceFile"
]
array:10 [
  0 => "validation.size.array"
  1 => ""
  2 => "The :attribute must contain :size items."
  3 => ""
  4 => ""
  5 => ":attribute müssen :size Artikel enthalten."
  6 => ""
  7 => "validation"
  8 => "size.array"
  9 => "{locale}/validation.php"
] ```

Any idea why this is?
nbourguig commented 7 years ago

Hi,

I did not think of such a scenario, but this is what i did and it works :

  1. Added the new language to .env (ie: es)

    TS_LOCALES=fr,en,es
  2. pushed using

    a translation_sheet:push

    image

How did you manage to get this error, can you tell me more about how you did proceed ?