veliovgroup/Meteor-Internationalization

Make Template helpers optional

Closed this issue · 3 comments

We use a custom Template helper and would like to omit the internal one, for example by passing helperName: null and helperSettingsName: null. If null is passed then there would be no helper created.

Example would be:

      if (typeof Template !== 'undefined' && Template !== null) {
        if (this.helperName !== null) {
          /**
           * @summary Main `i18n` template helper
           */
          Template.registerHelper(this.helperName, function () {
            return self.get.apply(self, arguments);
          });
        }

        if (this.helperSettingsName !== null) {
          /**
           * @summary Settings `i18n` template helper, might be used to build language switcher (see demo folder).
           */
          Template.registerHelper(this.helperSettingsName, function () {
            return self.getSetting.apply(self, arguments);
          });
        }
      }

what do you think?

@jankapunkt sounds good, I'm glad you're using it.
Would you send a PR?

@dr-dimitru great :-) See #9