meteor / todos

The example app "Todos", written following the Meteor Guide
Other
535 stars 367 forks source link

Understanding {{_ 'layouts.appBody.login'}} #186

Closed mitchswaldman closed 7 years ago

mitchswaldman commented 7 years ago

Hello,

In the app body html file, you use this template helper:

<div class="btns-group">
     <a href="{{pathFor 'signin'}}" class="btn-secondary">
              {{_ 'layouts.appBody.login'}} 
      </a>
      <a href="{{pathFor 'join'}}" class="btn-secondary">
              {{_ 'layouts.appBody.join'}}
      </a>
</div> 

I have two questions.

1) Where does the _ helper function come from? I don't see it defined in the App_body.helpers.

2) This may be answered by the first question, but how is the string 'layouts.appBody.login` able to be resolved to a template? I don't see it declared anywhere in the code.

Thanks!

tmeasday commented 7 years ago

Hi @mitchswaldman - it's i18n via the tap:i18n package: https://guide.meteor.com/ui-ux.html#i18n

mitchswaldman commented 7 years ago

Oh okay cool, so it's just converting a string. Gotcha. Thanks!

LahcenANJAR commented 6 years ago

very useful