Skip to content

Commit

Permalink
I18n: Dispatch “reactI18nDidSetLocale” on window after setting locale
Browse files Browse the repository at this point in the history
  • Loading branch information
alexblunck committed Nov 23, 2017
1 parent 545a6b3 commit ccf53ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/I18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export default {
setLocale(locale) {
this._locale = locale
this.forceComponentUpdate()

// Dispatch reactI18nDidSetLocale event
setTimeout(() => {
const event = new CustomEvent('reactI18nDidSetLocale')
window.dispatchEvent(event)
})
},

setTranslations(translations) {
Expand Down

0 comments on commit ccf53ae

Please sign in to comment.