question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`IntlService#lookup()` return value changed in v5

See original GitHub issue

https://ember-intl.github.io/ember-intl/docs/guide/service-api#lookup-translationkey-string-optionallocale-string-array-string-optionaloptions-object-string-undefined

We’re currently upgrading our app from v4 to v5 and I found that the return value of IntlService#lookup() has changed.

https://github.com/ember-intl/ember-intl/blob/322d325733146b71d77c5aa6d1724ed514f0b07c/addon/services/intl.js#L116-L136

It used to return the raw translation string, but now it returns an array like:

[{ type: 0, value: "Some translation" }]

Was this change intentional? I don’t think it is.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
buschtoenscommented, Aug 5, 2020

Some side context, I haven’t worked in Ember in a couple years now and am relying entirely on the Ember community to report these bugs as I no longer “dogfood” my own addons. Some things will slip through so I’m thankful to have every early adopter raise these issues ❤

I’m so grateful for you still putting so much work into this great addon. 💖

I suggest we add a private (or public?) lookupAST() method and let lookup() return the raw string again. Or what would you suggest?

1reaction
jasonmitcommented, Aug 5, 2020

We should fix. It wasn’t intentional and thanks for bringing it to my attention.

The internal change was intentional for perf reasons but we should be able to keep it so the public lookup method returns the original string translation and not the AST object. Unfortunately, I unknowingly let this bleed into the public API.

Some side context, I haven’t worked in Ember in a couple years now and am relying entirely on the Ember community to report these bugs as I no longer “dogfood” my own addons. Some things will slip through so I’m thankful to have every early adopter raise these issues ❤

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to return value from function which has Observable ...
A slimmer solution would be using RxJS' .toPromise() instead: function getValueFromObservable() { return this.store.pipe(take(1)) .toPromise() }.
Read more >
about Return - PowerShell | Microsoft Learn
The return keyword exits a function, script, or script block. It can be used to exit a scope at a specific point, to...
Read more >
Function return values - Learn web development | MDN
We are returning the result of the calculation Math.floor(Math.random() * number) each time the function is called. This return value appears at ...
Read more >
Value methods | Think Java | Trinket
Some of the methods we have used, like the Math methods, return values. ... Start with a working program and make small, incremental...
Read more >
Javanotes 9, Section 4.4 -- Return Values
For example, the function TextIO.getln(), with a return type of String, ... In the body of the function, it evaluates Math.sqrt(12.0*12.0 + 5.0*5.0), ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found