meteoric:ionic tabs localization with tap:i18n

159 Views Asked by At

I am using in a meteorjs application meteoric:ionic package with tap:i18n package for localization.
Tap:i18n works fine when used in a html template, but I don't how to use it in a template like this:

 {{#ionTabs style="ios"}}
    {{> ionTab title="Welcome" path="tabs.one" iconOff="ios-home-outline" iconOn="ios-home"}}
 {{/ionTabs}}

this doesn't work:

 {{#ionTabs style="ios"}}
      {{> ionTab title={{_ "welcome"}} path="tabs.one" iconOff="ios-home-outline" iconOn="ios-home"}}
 {{/ionTabs}}
1

There are 1 best solutions below

0
On BEST ANSWER

Its not possible to place handlebars inside other handlebars. You have to create a helper. This is quite annoying though since you will have to do it for each one. The issue is more meteoric isn't designed to work with i18n well yet:

Template.yourtemplate.helpers({
    _title: function() {
        return TAPi18n.__('welcome');
    }
});

Where yourtemplate is the template containing the tabs.

Then you can use _title in the spacebars expression:

{{> ionTab title=_title path="tabs.one" iconOff="ios-home-outline" iconOn="ios-home"}}

Meteor is working on supporting statements in spacebars but its not yet released: See: https://meteor.hackpad.com/Blaze-lexical-scope-and-template-arguments-fZP806qG6xQ

More specifically to what you need: https://github.com/meteor/meteor/pull/4101

It should be in the next update as its already on devel. Then you could do:

{{> ionTab title=(_ "welcome") path="tabs.one" iconOff="ios-home-outline" iconOn="ios-home"}}