You should not use (framework) logic in your views. Views are presentation templates.
Views by default are lazy rendered, which means they are only rendered long after your code has finished. So you can not assume that code in your view runs the moment you create the view.
As for language, the View object stores the language active when the View object is created. In your case, because you use the Template controller, the template View is created by calling parent::before(). Which is before you switch languages.
So, make sure you have the correct language set before your code runs. I do mine in the config file, so my controllers don't have to bother with language issues, they just use whatever language is set.
If you insist doing it this way, make sure the language is set correctly before you create your View objects. In the case of the template, do that before you call parent::before().