Hacker News new | ask | show | jobs
by mikewhy 4263 days ago
> i18n-js is a js library, which means you have to do the formatting in your js code, then passing the formatted data into the template engine where you have the placeholders for them

Not sure I follow, taken from a React component:

    Component = React.createClass                                                
      render: ->                                                                
        @div null,
          @t('welcomeMessage', username: @props.CurrentUser.displayName)
1 comments

I have nothing against Coffeescript, and use it myself sometimes. But please don't respond to something about "js" and then put down a single coffeescript snippet with no additional context. It's very confusing.

I had to re-read the last line several times before I looked up at the function arrow and realized it was coffeescript, and that the "@" were not part of the i18n library, but rather the syntactic sugar for "this".