Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required locale in setupIntl() #1847

Merged
merged 5 commits into from May 13, 2024
Merged

Conversation

ijlee2
Copy link
Contributor

@ijlee2 ijlee2 commented Mar 7, 2024

Why?

We can solve a few issues when we ask end-developers to specify the locale in setupIntl():

Solution?

When I removed lines 123 and 126, I saw that only the tests where I hadn't specified the locale would fail. This led me to conclude that the two lines had been introduced in the past, just so that we could write setupIntl(hooks) (type as few characters as possible).

After removing the two lines, I confirmed that locales no longer lists 'en-us' by default.

By requiring the locale in setupIntl(), I was able to refactor code and simplify the file addon-test-support/setup-intl.ts. There will be a separate pull request, where addTranslations() will also require the locale.

Notes

I traced when we had begun to implicitly set 'en-us' in the intl's service to b75fd17 and b05b510. Furthermore, the bug in #1789 seemed to have appeared after #1530 (when the intl service had been rewritten as a native class).

@ijlee2 ijlee2 added breaking Breaking change will result in a new major version bug Something isn't working labels Mar 7, 2024
@ijlee2 ijlee2 force-pushed the remove-setLocale-from-constructor branch 2 times, most recently from 9998fd0 to 0c1bb9a Compare May 10, 2024 12:35
@ijlee2 ijlee2 changed the title Removed setLocale() from intl service's constructor Required specifying the locale in setupIntl() May 10, 2024
@ijlee2 ijlee2 linked an issue May 10, 2024 that may be closed by this pull request
@ijlee2 ijlee2 changed the title Required specifying the locale in setupIntl() Required locale in setupIntl() May 13, 2024
@ijlee2 ijlee2 force-pushed the remove-setLocale-from-constructor branch from 0c1bb9a to c72aecd Compare May 13, 2024 14:59
@ijlee2 ijlee2 force-pushed the remove-setLocale-from-constructor branch from c72aecd to 9293240 Compare May 13, 2024 15:30
@ijlee2 ijlee2 marked this pull request as ready for review May 13, 2024 15:32
@ijlee2 ijlee2 merged commit e5bf3d1 into main May 13, 2024
32 checks passed
@ijlee2 ijlee2 deleted the remove-setLocale-from-constructor branch May 13, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking change will result in a new major version bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected locale en-us after upgrade to ember-intl v6
1 participant