Closed technic closed 4 years ago
@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.
This is implemented in #14
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.