themsaid / laravel-langman

Language files manager in your artisan console.
MIT License
876 stars 166 forks source link

Ignore "arrays" when sync #48

Closed Luddinus closed 8 years ago

Luddinus commented 8 years ago

Hi,

I have this lang file e.g

// file lang/users.php
return [
   'tips' => [
      'one' => 'First tip',
      'two' => 'Second tip',
      // etc.
   ]
];

And in a controller or a file inside app directory:

// lang('users.tips') is an array
foreach (lang('users.tips') as $tip) {
   // do something with the texts
}

So the problem is that when I use "langman:sync" command, it writes an empty array in tips.

// file lang/users.php
return [
   'tips' => ''
];

Is this a bug or an expected behauvior?

Anyway, congrats for the package, it rocks.

Luddinus commented 8 years ago

ping @themsaid

themsaid commented 8 years ago

Woops, sorry didn't notice the issue except now :)

Thanks for the report, it seems like a bug and I'll look into it today and get back to you :)

Luddinus commented 8 years ago

Well, from now I'm doing a ugly trick.

I read that dynamic "trans" are ignored so I'm doing this:

$langTrick = '.tips';
foreach ('user'.$langTrick as $tip) {
   echo $tip;
}
themsaid commented 8 years ago

The issue is now fixed :)