aryehraber / statamic-captcha

Statamic Addon that protects your Statamic forms using a Captcha service.
MIT License
11 stars 8 forks source link

Disclaimer not working in multisite #20

Closed Oleafeon closed 2 years ago

Oleafeon commented 3 years ago

We want to display the disclaimer in 2 languages, but when we use __("disclaimer"); in the config file it returns a error saying target class [translator] does not exist

aryehraber commented 3 years ago

Hi @4kets, thanks for bringing this to my attention! This is the first time hearing about this issue, so I'll need to do some testing on my end to recreate this use case. I'm not entirely sure when I'll be able to look into this so a potential workaround for now is to not use Captcha's disclaimer and to simply add an extra variable as a translatable Global.

Oleafeon commented 3 years ago

Allright thank you!

Oleafeon commented 2 years ago

did you have a change to look into this already "simply add an extra variable as a translatable Global." worked so for me this is closed :D

aryehraber commented 2 years ago

@4kets No, not yet but it definitely sounds like a bug so please leave it open and I'll get to it... someday 😅

Oleafeon commented 2 years ago

Allright thank you

aryehraber commented 2 years ago

Hi @4kets, I finally had a chance to look into this; turns out it's not a bug after all!

It seems you can't use Laravel's translate helper __() inside config files (since config files are one of the first things the framework initialises). I guess within Statamic's context, my suggestion of using Globals is probably still the easiest workaround, though they do mention the trans tag in their docs which I just tried out and works great too: https://statamic.dev/tags/trans

Either way, thanks for reporting anyway, I learned something new by looking into this and now know what to suggest going forward!