From ccf53ae813ff43d079bce5253cd570672552ff56 Mon Sep 17 00:00:00 2001 From: Alexander Blunck Date: Thu, 23 Nov 2017 18:19:18 +0100 Subject: [PATCH] =?UTF-8?q?I18n:=20Dispatch=20=E2=80=9CreactI18nDidSetLoca?= =?UTF-8?q?le=E2=80=9D=20on=20window=20after=20setting=20locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/I18n.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/I18n.js b/src/lib/I18n.js index aa3252f..1751e11 100644 --- a/src/lib/I18n.js +++ b/src/lib/I18n.js @@ -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) {