kg-bot / laravel-localization-to-vue

Make Laravel standard localization files available in format required by various JavaSript localization packages
MIT License
239 stars 35 forks source link

ErrorException: get_object_vars() expects parameter 1 to be object, array given #42

Closed rafatga closed 4 years ago

rafatga commented 5 years ago

Hi, I would like to know if I am the only one getting this error.

Version "kg-bot/laravel-localization-to-vue": "^1.6"

Captura de pantalla de 2019-09-02 08-35-30 Captura de pantalla de 2019-09-02 08-37-22

rafatga commented 5 years ago

When I delete this following two files it wroks again.

Captura de pantalla de 2019-09-02 08-51-46

kg-bot commented 5 years ago

Hi @hi-rafa, sorry for late response, I was very busy. Can you please provide me with ca-ES.json and es-ES.json content so I can check what is giving this error and fix it.

kg-bot commented 5 years ago

I guess we can close this since nobody else reported such issue and looks like one of your files are not valid, and above all that you didn't provide content of files so I'm not able to reproduce this issue and work on fix for it (if this is issue with package at all).

KubqoA commented 4 years ago

Hi, I just experienced a similar issue. If I have in my resources/lang folder a file called sk.json with the following contents:

{
    "Verify Email Address": "Overte vašu emailovú adresu",
    "Please click the button below to verify your email address.": "Prosím, kliknite na tlačidlo nižšie pre overenie vašej emailovej adresy.",
    "If you did not create an account, no further action is required.": "Ak ste si účet nevytvorili nemusíte nič robiť."
}

(for translating the verification email being sent) the get_object_vars() expects parameter 1 to be object, array given errors is thrown.

Ignition tells me the problem is here vendor/kg-bot/laravel-localization-to-vue/src/Classes/ExportLocalizations.php:222.

If I remove said file, everything works fine. Thanks.

kg-bot commented 4 years ago

@KubqoA try to export configuration file for this package and change your laravel-loclization.js.default_locale configuration to sk, or try adding lang/en.json with same translation keys as you have in sk.json.

After that run php artisan cache:clear and try to load the view again.

KubqoA commented 4 years ago

Thanks, adding the en.json file seems to have resolved the issue for me. Sorry for bothering.