GithubHelp home page GithubHelp logo

Comments (6)

jasonmit avatar jasonmit commented on May 22, 2024

That's using the Ember.get accessor. The intl-get handlebar helper is not the same as intl.get

Are you trying to access the a locale's message object directly?

It would be this: $E.intl._getLocaleInstance('en').get('messages.phone')

The service doesn't expose this in an of API that behaves like intl-get, which walks over all the "active" locale(s) and stops at the first one that has the key.

from ember-intl.

terryroe avatar terryroe commented on May 22, 2024

I was trying to do a message lookup, thinking there was an analogous function to the intl-get helper. It seems like this is needed if you want to be able to retrieve locale message strings in code in order to be able to format them with formatMessage. Could a function like this be added? Is there more information I could provide?

from ember-intl.

jasonmit avatar jasonmit commented on May 22, 2024

For the sake of not blocking you until I publish another release, you can move these two functions to an Ember.Mixin and then you'll get the behavior you're looking for.

https://github.com/yahoo/ember-intl/blob/master/app/helpers/intl-get.js#L9-L33

from ember-intl.

terryroe avatar terryroe commented on May 22, 2024

Thanks Jason. We're still in heavy development, so we can wait for the next published release. I used your suggested code from your first response as a temporary fix just to get things working. Thanks for being so responsive and helpful. It's much appreciated.

from ember-intl.

jacojoubert avatar jacojoubert commented on May 22, 2024

This would be a great addition. I will move it to a mixin for now.

from ember-intl.

jasonmit avatar jasonmit commented on May 22, 2024

1.2.0 resolves this: https://github.com/yahoo/ember-intl/blob/master/app/services/intl.js#L192-L206

this.intl.getTranslation(key) just note that it returns a promise to handle potential future changes to lazily load translations by default.

from ember-intl.

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.