While our theme was still running on Sage 9x, I had a feature branch that used the DeepL php library and Polylang to add multilingual pages. Both were working as expected. However, I wanted to wait until after our upgrades to Sage 10x before merging them into main trunk.
After the upgrade, I am now getting errors such as :
Undefined function DeepL\Translator
I’ve tried doing \DeepL\Translator and importing to DeepL into my class file, but nothing has worked. The same errors are popping up for PolyLang methods as well.
I believe it’s a namespacing issue, but I have no clue what namespace these plugins belong to.
I’ve searched the documentation and the forum but it seems like no one else is having this issue, so I am assuming I’ve missed a step somewhere.
Some notes on my theme that could be helpful or pointless:
- All classes that handle translating are in a directory under app in the sage directory. Polylang and DeepL are being used in that directory. That directory is being registered in the functions.php by adding the file names to the collect array like so:
collect(['setup', 'filters', 'Translation/AlgoliaTranslationLinks','Translation/FeaturedPostCardTranslationLinks', 'Translation/Languages', 'Translation/Posts', 'Translation/Translate', 'Translation/TranslationSelectBox'])
Side note: I also couldn’t get glob to pull in array of the files under Translation like I could in Sage 9x.
-
The plugins are installed in Bedrock. PolyLang Pro is installed via a zip file. (I’ll add that the admin side polylang plugin is working as expected. I just can’t reference the methods in my codebase.)
-
Acorn is installed at the Bedrock level.