Giter VIP home page Giter VIP logo

Comments (6)

rapheld avatar rapheld commented on May 28, 2024

Couldn't you use the {{t}} helper within your content?

{{#view MyView}}
  {{t blah}}
{{/view}}

from ember-i18n.

joefiorini avatar joefiorini commented on May 28, 2024

From what I've seen you cannot concatenate strings to pass into Handlebars,
but I need to dynamically generate the key based on an attribute of my
view. Therefore, I need to pass it using nameBinding and let the
valueTranslation live in my view. But then I get a value attribute in
the DOM, which I absolutely do not want.

On Wed, Feb 20, 2013 at 3:07 PM, Nathan Rapheld [email protected]:

Couldn't you use the {{t}} helper within your content?

{{#view MyView}}
{{t blah}}
{{/view}}


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-13853345.

from ember-i18n.

rapheld avatar rapheld commented on May 28, 2024

If you need dynamic keys, you'll have to do that in the view. I'm not 100% clear about what you're trying to accomplish, but hopefully this example is relevant:

I18n:

Em.I18n.Translations = {
  translation.token.alpha: "ay",
  translation.token.beta: "bee",
  translation.token.gamma: "gee",
};

View:

var MyView = Ember.extend({
  foobarBinding: 'controller.someValue',

  myTranslatedString: function() {
    return I18n.t('translation.token.%@'.fmt(this.get('foobar')));
  }.property('foobar')
});

Template:

{{#view MyView}}
  {{view.myTranslatedString}}
{{/view}}

from ember-i18n.

jamesarosen avatar jamesarosen commented on May 28, 2024

If you want the translated text to show up as the <div>'s content, you want the t helper:

{{#view MyView nameTranslation="blah"}}{{t "foozle"}}{{/view}}

from ember-i18n.

vanthome avatar vanthome commented on May 28, 2024

@joefiorini Can you share how you've solved the dynamic keys thing pls?
I have the same issue.

from ember-i18n.

joefiorini avatar joefiorini commented on May 28, 2024

I'm actually not using the plugin anymore. The project I was using it on
got canned. If we revisit it and I figure it out I'll be sure to post
something here.

On Mon, Jul 1, 2013 at 9:23 AM, Thomas [email protected] wrote:

@joefiorini https://github.com/joefiorini Can you share how you've
solved the dynamic keys thing pls?
I have the same issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-20281113
.

from ember-i18n.

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.