Comments (6)
I am also experiencing this error on Ember 3.28 (development mode & tests) with Ember-intl 6.1.2. It seems to occur when using a template helper if the service hasn't been injected anywhere else yet. Injecting @service intl
into my application route seemed to fix it, but doesn't help tests. Lots of failing tests.
This is a very similar error to what you'd receive from updating a @Tracked variable (used in the template) in a constructor() of a glimmer component.
from ember-intl.
To confirm, did you follow the migration guide in https://ember-intl.github.io/ember-intl/docs/guide/migration-5-0-to-6-1#missing-setupintl-results-in-a-runtime-error?
from ember-intl.
@ijlee2 Nope. I would not expect to need to follow a migration / upgrading guide when creating an app for the first time with the latest version. This probably needs to be in the README.
from ember-intl.
For this addon, I don't think the README
is a good place, as there is a dedicated documentation site. https://ember-intl.github.io/ember-intl/versions/v6.1.2/docs/guide/testing shows the syntax for rendering tests. I'll go ahead with closing the issue.
from ember-intl.
If anyone wants to avoid having to add this hook to every test, this instance-initializer worked for me to solve tests. Might be slightly slower than choosing specific tests to add the setupIntl(hooks) but way easier and don't need to always remember to do this when writing new tests:
export default {
initialize: function (application) {
const env = application.resolveRegistration('config:environment');
const intl = application.lookup('service:intl');
if(env === 'test'){
intl.setLocale('en-us');
}
}
};
from ember-intl.
@kdagnan I recommend customizing setupRenderingTest()
instead of an instance initializer. The best way is to call setupIntl()
only when needed, to make the dependencies of a test clear and to avoid deprecated patterns such as an implicit service injection.
from ember-intl.
Related Issues (20)
- When will there be another release? HOT 1
- Type issues from Registry HOT 6
- Type issues from -format-base.d.ts HOT 1
- bump typescript peer dependency to 5 HOT 3
- trailingZeroDisplay not working HOT 2
- FORMAT_ERROR when using the `Intl.RelativeTimeFormat` polyfill with `v6.0.0` of ember-intl HOT 3
- Double `intl.d.ts` cause type errors HOT 8
- Unexpected locale `en-us` after upgrade to ember-intl v6 HOT 6
- Bundle size regression in v6.2.0 HOT 3
- Merge this into formatjs HOT 3
- Incompatible with native `ember-source` types HOT 5
- `allowEmpty` class property not respected in v6.3.1 HOT 1
- Extending helpers like FormatDate has braking changes between v6.2.2 and v6.3.0+ HOT 5
- Basic usage results in: You attempted to update `_locale` [...] infinite revalidation bugs, and performance issues, and is not supported. HOT 4
- How to use `publicOnly: true` in Embroider apps HOT 13
- v6 - Error on valid use of `many`: message cannot be parsed: Unknown plural category: many HOT 1
- Deleted
- Plans for v7 release
- Memory leak regression after upgrading to `>= 6.3.0` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-intl.