potsky / laravel-localization-helpers

🎌 Artisan commands to generate and update lang files automatically
GNU General Public License v3.0
187 stars 38 forks source link

When trans() gets an array of strings, the tool thinks it's a missing string #47

Closed arthur-olafsson closed 7 years ago

arthur-olafsson commented 7 years ago

First, thanks for an awesome tool! It's made my life a lot easier.

I ran into a minor issue. Assume there's a translation file called things.php:

'foo' => [
    'bar' => 'bar',
    'baz' => 'baz',
]

Then, somewhere, there's a call to trans('things.foo') and uses the resulting array. When I run the artisan command in dry-run mode, it thinks that things.foo is a missing string.

potsky commented 7 years ago

Hi,

only in dry-run mode? In normal mode, is your array preserved in the translation file?

potsky commented 7 years ago

Ok, it does the same when not running in dry-mode. I will check if the key already exists even if the value is not a string. Will be fixed in the next release.

arthur-olafsson commented 7 years ago

You, sir, are a gentleman and a scholar. Sorry I missed your reply back in November! Thanks a bunch for looking into this and coming up with a fix!