https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39564 --- Comment #7 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Julian Maurice from comment #6)
(In reply to Julian Maurice from comment #5)
(In reply to Jonathan Druart from comment #4)
Did you investigate a way to prevent the addition of the new methods?
[...]
I may have read your comment too quickly. Are you talking about the __d* functions ? For templates, the new methods can be avoided by writing something like this:
[% USE i18n = I18N('Example') %] [% i18n.t('string to translate') %] All that is needed is a `new` method in Koha::Template::Plugin::I18N that stores its textdomain parameter (within $self) so it can be used in t* methods. On the Perl side, it might not be that simple, as it would probably require keeping a "wrapper object" around (the wrapper object would change the default textdomain, call the appropriate function __*, then revert the default textdomain to its original value).
We could guess the caller and set the domain depending on it. I really don't like subroutines that change their behaviour depending on the caller. It makes them more difficult to debug and test.
-- You are receiving this mail because: You are watching all bug changes.