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'd like to extend a custom TranslatorExtension from Latte's built-in one. I mainly need to encapsulate the translator function in a class, so that consumers can just do new CustomTranslator() without having to pass in a callback themselves. Like below. Unfortunately, this is currently impossible as TranslatorExtension is marked as final.
I'm assuming there's no specific reason the class can't be extendable. If one wanted to do this, one would have to re-implement all the useful features inside it, like the _ tag and the |translate filter.
Activity
dg commentedon Nov 20, 2023
This is not an optimal use of inheritance. It is better to use either composition or, better yet, factory: