#Weird Issue with lang folder and recaptcha packages

29 messages · Page 1 of 1 (latest)

exotic glen
#

I use different folder that the default resources/langs folder (I need it to for some packages).
using this line in the appServiceProvider
app()->useLangPath(base_path('lang'));

and it works fine and good ever since.

but after I needed recaptcha I installed this package https://github.com/anhskohbo/no-captcha and all translations got back to resources/lang as if the code in the app service provider doesn't work

to double check uninstalled the packages. Everything got back ok.
Installed another recaptcha package https://github.com/biscolab/laravel-recaptcha and the same thing returned.

Why is there a conflict in the code app()->useLangPath(base_path('lang')); and recaptcha packages???

I really need recaptch and to use different lang folder (while the resources/lang also exists)

Thanks

glacial cloud
#

3rd party packages might assume the lang files are in the default location. I don't know if that's the case here, but it might be.

#

A quick and dirty workaround would be to add a relative symlink at resources/lang. Then the files would be available at both.

exotic glen
#

I don't want any translation from the packages, I just want my normal translations to work
It just these two recaptcha packages that make this line of code like it didn't exits! app()->useLangPath(base_path('lang'));

#

I cant use symlink because I need some data in the default resource/lang. thats the problem. Or I would have deleted the folder and everything will be happy

#

I just one of the core maintainers to check this behavior and tell us the weird reason!

glacial cloud
#

FYI I can't reproduce the issue.

  • With no resources/lang folder, default lang path is /lang
  • Adding resources/lang folder, default lang path is /resources/lang
  • Adding $this->app->useLangPath(base_path('lang')); to AppServiceProvider::register(), default lang path is /lang
  • Installing either of those two packages doesn't set app()->langPath() to /resources/lang
exotic glen
#

really! when you install the package you still get translations from lang not resources/lang?

#

try json files not php files, to double check thank you

glacial cloud
#

I just checked what app()->langPath() was set to. What does yours say?

exotic glen
#

yes, mine says lang not resource/lang but all translation gone

#

I doubled check, It didn't even take translations form resource/lang

#

it just take the default text in __() function

#

thats crazy

glacial cloud
#

I don't have experience with json translations. If I were you I'd step through it with xdebug.

exotic glen
#

It did take translation from json and php files I tested more , mistake before
but from resources/lang

#

It still ignores lang and take everything from resource/lang

#

weather php or json

#

how ever the output of app()->langPath() is lang not resource/lang

glacial cloud
#

what does app('path.lang') say?

exotic glen
#

I can't understand why, please test the translation not eh output of langPath()

exotic glen
glacial cloud
#

Can't afford to spend any more time on it, sorry. At work.

exotic glen
#

ok thanks pro, I appreciate it

exotic glen
#

You are right, I created another project and the error didn't appear at all, I will keep digging

#

I installed this package (that exists in the project) in the new project and the error appeared again

#

composer require amamarul/laravel-json-locations-manager

#

I think its conflict between them unfortunately 😢