Skip to content

Conversation

@BenjaminHorn
Copy link

Addresses: #1050

@BenjaminHorn BenjaminHorn force-pushed the splat branch 2 times, most recently from e61f186 to 86e85a0 Compare November 2, 2015 15:13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should be on a separate line, probably above i so i and l are declared next to one another.

@kpdecker
Copy link
Collaborator

kpdecker commented Nov 5, 2015

This generally looks very good. A few feedback points that I think we should address before getting in but the bulk of the work looks like it's done and great.

Thanks!

@nathanhammond
Copy link

This PR should be considered a WIP, please ignore until somebody says otherwise. :) (Also, I'll squash at the end, excepting Benjamin's commit so as to preserve his contribution.)

@kpdecker
Copy link
Collaborator

Closing in favor of #1149, since that is complete and reflects the final discussions in #1050. Thanks to @BenjaminHorn and @nathanhammond for doing this initial work!

@kpdecker kpdecker closed this Dec 12, 2015
jamesarosen pushed a commit to jamesarosen/ember-i18n that referenced this pull request Dec 20, 2016
Previously, the `{{t}}` helper, like the `i18n.t` utility, accepted a
translation key and a context hash. This worked when the Handlebars template
had the individual keys and values (or value bindings) for the context,
but didn't when there was a pre-built object that represented the context.

Now it accepts a second ordered (non-hash) argument that represents the
context as an object. Hash context properties override those from
the context object.

```hbs
{{t 'some.key' someObject prop=value}}
```

is approximately the same as

```js
i18n.t('some.key', Object.assign({}, someObject, { prop: value }))
```

This is a workaround for the fact that Handlebars does not yet have a syntax
for splatting an object into hash arguments.

See handlebars-lang/handlebars.js#1050
See handlebars-lang/handlebars.js#1128
See handlebars-lang/handlebars.js#1149
Closes #423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants