Coder Social home page Coder Social logo

Comments (1)

heathharrelson avatar heathharrelson commented on June 26, 2024

Sorry for the slow response. I wasn't aware of this macro in ember-i18n, and I like the idea a lot. However, I'm not crazy about the syntax used in ember-i18n, because it doesn't match most computed property macros. Using the example from the documentation above, I would prefer something that looked like this:

import { translationMacro as t } from "ember-i18next";

export default Ember.Component.extend({
  // A simple translation.
  title: t('user.edit.title'),

  followersCount: 1,
  count: Ember.computed.alias('followersCount'),

  // A translation with interpolations. This computed property
  // depends on `count` and will send `{ count: this.get('count') }`
  // in to the translation.
  followersTitle: t('user.followers.title', 'count')
});

The main difference being that the arguments to the macro are dependent property names rather than an options hash.

I'd be happy to accept a PR that matches the example above. No worries if you don't currently have the time; I can quickly implement it myself before the next release.

from ember-i18next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.