Hacker Newsnew | past | comments | ask | show | jobs | submit | caridy's commentslogin

The workflow is, for now, out of the scope of this project, we assume developers will figure how to produce a javascript object that contains key=value pairs, where each value is a message written in ICU message syntax, and where values are feed into the template engine for helpers/methods to use them.

Internally at Yahoo (just like facebook, and other big companies), we have an infrastructure for translation that works based on a source file written in english by developers, and the whole thing just work. But we have no plans to open up any of that. We believe, such system will grow from the community once people realize that ICU is good enough to internationalize their apps.

As for moment.js, you're right, if you will never need to parse a date, or massage a date value, and the only thing you care about is to format a timestamp that is coming from an API, then `formatRelative` helper should be good enough.


The official announcement is now live:

http://yahooeng.tumblr.com/post/100006468771/announcing-form...

hopefully it will help to clarify few of the questions...


Any thoughts on how hard this might be to integrate with Polymer (or web components in general)?


I haven't look into i18n-js library in details, but this is what I can spot so far:

* the message format in i18n-js seems to be compatible with ICU message syntax, the industry standard used in other programming languages and the one used by formatJS as well. we will have to check if they really implemented all the specs, which makes the messages more advanced, e.g.:

``` Cart: {itemCount, plural, =0 {no items} one {one item} other {# items} } ```

including the fact that itemCount from `other` option will be formatted as a number, saying "1,030" in EN, vs "1 030" in FR.

* 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, while FormatJS focuses more on the high-level declarative form that you can use in your templates directly, which makes things simpler, if you use handlebars, you could do: {{formatMessage "Cart" itemCount=numItems}} right in your template.


> 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)


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".


the main benefit of formatjs is that it offers a declarative syntax at the template level, which simplifies things drastically. we don't have an integration for AngularJS or Ember just yet, but we are planning to do so very soon.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: