JText was a class name globally available in Joomla 3. It is not available in Joomla 4, as everything moved to namespaces.
You would have to change your syntax to:
Sorry, I did not noticed that in your reply there was an extra syntax, however that's the same class that I´ve refered to in the first comment, that I wouldn´t want to add at every translation.
Could there be a way to add the class to to component itself?
Im saying this because even without Yootheme the problem remains with the use of Cassiopeia and the string inserted directly at the article, here´s the call stack if you find it usefull.
No, you will not be able to use JText (or Text) directly through php (using Sourcerer).
You will have to add the use statement or use the full namespace class.
Use my initial reply to see how. And how you can easily change that in your existing uses.