eutervogel Posted February 21, 2020 Share Posted February 21, 2020 Hi, when I try to do that in my template: echo "<h2>" . __("Keine Uploads vorhanden") . "</h2>"; I'm running into an error: Fatal Error: Uncaught Error: Call to undefined function __() So I tried to do it this way: echo "<h2>" . $this->_("Keine Uploads vorhanden") . "</h2>"; That doesn't produce an error but the translation is not shown. I used the first version in other websites before and never had an issue; PW-Version: 3.0.148 What could be wrong here? Link to comment Share on other sites More sharing options...
Gadgetto Posted February 21, 2020 Share Posted February 21, 2020 It's hard to tell without getting more informations. The second call will only work inside a class. The first one should work. Where did you place your template file? Did you add the ProcessWire namespace to your template file? Could you provide a little more code? Link to comment Share on other sites More sharing options...
BitPoet Posted February 21, 2020 Share Posted February 21, 2020 2 hours ago, eutervogel said: I'm running into an error: Fatal Error: Uncaught Error: Call to undefined function __() Do you have a namespace declaration in your template? 1 Link to comment Share on other sites More sharing options...
eutervogel Posted February 22, 2020 Author Share Posted February 22, 2020 Thanks guys adding the namespace did it. But I looked into my other websites a there __() works pretty fine without namespace declaration. How is that possible? Link to comment Share on other sites More sharing options...
Gadgetto Posted February 22, 2020 Share Posted February 22, 2020 1 hour ago, eutervogel said: Thanks guys adding the namespace did it. But I looked into my other websites a there __() works pretty fine without namespace declaration. How is that possible? You probably have disabled "Auto file compiler"? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now