vemcogroup / laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor
MIT License
131 stars 14 forks source link

Q: trim() expects parameter 1 to be string, array given - Key/Value trim error? #6

Closed nea closed 4 years ago

nea commented 4 years ago

Hi there

Thanks for this convenient package.

I added the compsoer package, configured everything and wanted to download our POEditor translations. It kicks off after php artisan translation:download with Preparing to download languages and all looks good but then it fails with trim() expects parameter 1 to be string, array given.

I checked where and it is in the Translation.php line 123. I dumped what is tried to be trimed here, and the input entry is for example

array:1 [
  "teams.tab_button.my" => "My Teams"
]

Isn't that correct? Key and Value as we prepared.

Any hint on what the problem might be would be awesome.

Thanks a lot in advance

eldor commented 4 years ago

Hi @nea

Just tested from our on POEditor, and all went smooth. Could you show me how your terms and translations are setup in POEditor?

It looks like it gets a array from your POEditor instead of a string.

nea commented 4 years ago

Hi @eldor

Thanks for the quick response.

Here is a screenshot. image

Its a term and translation. I do not really know even how to create them differently. Anywhere?

Thanks a lot :)

eldor commented 4 years ago

Hi @nea

I'll try replicate your setup and give you a feedback

eldor commented 4 years ago

Hi @nea

I have made an update that allows for context in POEditor. Could you try the dev version before i tag it?

nea commented 4 years ago

Awesome @eldor Worked! I just updated to dev-master and downloaded, works. Translations have been pulled and files look correct.

Thanks a lot for the quick help!!! ^^

eldor commented 4 years ago

Ok, ill just run the lasts tests in house and on our own projects and the tag a version 2.0.2