-
Notifications
You must be signed in to change notification settings - Fork 190
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
locale #47
Comments
In my opinion, option 2 is undesirable because it is a non-standard extension of the grammar (and not very flexible), and option 3 is undesirable because it introduces a global variable without the template author's knowledge. I am not sure what option 1 means, so I won't comment. The redundancy of explicitly passing in the locale as a variable is not a big deal. |
Actually option #2 is not quite so problematic. Django allows custom tags (see So in addition to the above if custom tag handling implementation is extended so that the compiler would check if a custom-tag handling module exports What do you think about this? It sounds to me that this would be a completely backward compatible addition that wouldn't require to hard code handling of the |
I think that:
|
Ok, I'll submit a patch that implements it. |
As a word of warning, please consider the API change carefully. E.g., are there other things we should be passing in? TranslationFun maybe? I haven't thought about it much, but I think any change needs to be carefully considered. |
In templates I frequently need access to the CurrentLocale variable that is passed to the template's
render/3
function as{locale, CurrentLocale}
parameter. However, it's not available for access and can only be made available if one also passes it in the list of bound variables, which is redundant.I can see three ways to solve it:
{% locale %}
{{ locale }}
which will resolve to current locale if the variable with the same name is not passed by the user.I believe solution #2 is the best, though it extends the Django grammar, and if that's a problem than #3 is the best.
Upon getting your feedback, I'll submit a patch with this implementation as I believe this feature would be useful for other users of erlydtl.
Thoughts?
The text was updated successfully, but these errors were encountered: