MutationDigitale / craft3-translate

Craft CMS plugin for static translations in CP
Other
12 stars 7 forks source link

Cannot use Craft::t() anymore #46

Closed TomDeSmet closed 1 year ago

TomDeSmet commented 1 year ago

We're using this plugin so the client can add their own translations to the website, but I also need translations in the Element API plugin. Using Craft::t("site", "MyString") does not work when this plugin is enabled. So it seems I cannot use translations outside of Twig anymore. I can't find anything in the docs to make this work.

smcyr commented 1 year ago

Did you try to invalidate the "Element API responses" cache here (after adding the translation in /admin/translations-admin)? /admin/utilities/clear-caches

TomDeSmet commented 1 year ago

I'm not caching my Element API responses as it's still in development. And it's not returning old data, it just returns the translation key.

smcyr commented 1 year ago

Would you be able to send the database, composer.json/composer.lock and the config/element-api.php file to support@mutation.io to be able to reproduce the problem? Thanks.

TomDeSmet commented 1 year ago

Sorry for my late answer, I didn't have the time yet to follow this up, BUT I think I just made a stupid mistake. I only added the translation to the PHP file and didn't sync it with the plugin yet. So it seems this is not a bug at all but a human error on my side.