You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default installation of Latte provides the translation macro, which relies on the existence of translate helper. The helper itself is not implemented, not even as a dummy that spits back what was passed to it.
So, if you want to re-use internationalized latte templates, you need to create the dummy translator and make sure you set it every time internationalized template is used... and that's PITA.
There are more ways how to fix this, I'm not sure what's the best, but I propose to implement similar behavior like in forms - setTranslator should inject translator instance and Template should implement translate method, that decides what to do - whether to pass the request to translator (if set), or simply spit back the message that was passed to it.
The text was updated successfully, but these errors were encountered:
Default installation of Latte provides the translation macro, which relies on the existence of translate helper. The helper itself is not implemented, not even as a dummy that spits back what was passed to it.
So, if you want to re-use internationalized latte templates, you need to create the dummy translator and make sure you set it every time internationalized template is used... and that's PITA.
https://github.com/nette/nette/blob/master/Nette/Templating/Template.php#L269 suggests that you can pass null to setTranslator method. One would naively expect its meaning is the same as for setTranslator(null) on form (elements), but the call fails later on with "Invalid callback." exception.
There are more ways how to fix this, I'm not sure what's the best, but I propose to implement similar behavior like in forms - setTranslator should inject translator instance and Template should implement translate method, that decides what to do - whether to pass the request to translator (if set), or simply spit back the message that was passed to it.
The text was updated successfully, but these errors were encountered: