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
I need to put same language argument in all function invocation in the Tera template. This looks like unnecessary boilerplate, because the language argument is always the same. Ideally the language should be a global variable of FluentLoader (or its "successor"). Then the language can be set before call to render function of tera template.
Unfortunately I don't think that it is possible to access context of tera template from the tera function, so we need to have another mutable state on the side.
The text was updated successfully, but these errors were encountered:
@technic Thank you for your issue! I've also thought about this as well. I would be willing to accept a PR that changes tera helper to optionally accept a default language on initialisation that makes lang optional. You'll have to rebuild the helper if you want to change the default, but I feel like that is an acceptable compromise since most people will only set it once.
* Default lang argument in Tera templates
this makes lang argument optional by providing global default value
See #13
* generate tests only for enabled features
before this commit tests generated for disabled features were empty
* add tests for defautlt lang feature
* documentation for with_default_lang
Hi,
I need to put same language argument in all function invocation in the Tera template. This looks like unnecessary boilerplate, because the language argument is always the same. Ideally the language should be a global variable of
FluentLoader
(or its "successor"). Then the language can be set before call torender
function of tera template.Unfortunately I don't think that it is possible to access
context
of tera template from the tera function, so we need to have another mutable state on the side.The text was updated successfully, but these errors were encountered: