Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement default dummy translate helper #1123

Closed
xificurk opened this issue May 29, 2013 · 3 comments
Closed

Implement default dummy translate helper #1123

xificurk opened this issue May 29, 2013 · 3 comments

Comments

@xificurk
Copy link
Contributor

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.

@TomasVotruba
Copy link
Contributor

I guess this is outdated in current Latte, see CoreMacros.

@xificurk
Copy link
Contributor Author

This is still relevant, nothing has changed. Shall I prepare PR for nette/application or is this one of those ugly DIY things?

@JanTvrdik
Copy link
Contributor

Send PR.

@dg dg closed this as completed May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants