Ember-intl: Always update document language

Created on 8 May 2019  路  4Comments  路  Source: ember-intl/ember-intl

Can we always update the document title here at L48?

https://github.com/ember-intl/ember-intl/blob/b9ea8fef81ff05458e182e215016f4d3a2054cbd/addon/services/intl.js#L44-L51

I have a use case that we set different font-family depends on html[lang] attribute. The problem is, on the first time the page gets loading, this.updateDocumentLanguage don't have a chance to run if you set 'en-us' as the current locale. I believe we should always call this.updateDocumentLanguage when we set a new locale, or if we want to avoid to set the same value multiple times, we should give this._locale a null as the default value, make sense?

bug help wanted

All 4 comments

It _should_ always be called already. It's just called in the next tick and not immediately. Can you check again?

If still an issue, can you provide a failing test / reproduction app or detailed reproduction instructions?

@buschtoens sure, I made a reproduction repo here:

https://github.com/nightire/repro-intl-update-document-language

and I've prepared a simple test case in routes/application.js.

It's because we default to en-us and so the work to update the doc lang via the computed's setter is not executed: https://github.com/ember-intl/ember-intl/blob/master/addon/services/intl.js#L28

Fix deployed in v4.0.0-beta.10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

buschtoens picture buschtoens  路  6Comments

mansona picture mansona  路  5Comments

jacobq picture jacobq  路  6Comments

gossi picture gossi  路  5Comments

richard-viney picture richard-viney  路  5Comments