git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit db20e2ee1a31d6f09639c346e37894ebd770f6b3

Refresh all screens on language change event

Marcos Gutierrez committed on 9/29/2017, 6:45:06 PM
Parent: 130286f770625230c71948c18c13ba3dd97a5d07

Files changed

plugs/intl/sync/i18n.jschanged
plugs/intl/sync/i18n.jsView
@@ -72,17 +72,24 @@
7272 //Init an subscribe to settings changes.
7373 function _init() {
7474 if (_locale) return
7575 //TODO: Depject this!
76- _locale = true;
7776 i18nL.configure({
7877 directory: appRoot + '/locales',
7978 defaultLocale: 'en'
8079 });
8180
8281 watch(api.settings.obs.get('patchwork.lang',navigator.language), currentLocale => {
8382 i18nL.setLocale(getSubLocal(currentLocale))
83+
84+ // Only refresh if the language has already been selected once.
85+ // This will prevent the update loop
86+ if (_locale) {
87+ electron.remote.getCurrentWebContents().reloadIgnoringCache()
88+ }
8489 })
90+
91+ _locale = true;
8592 }
8693
8794 }
8895

Built with git-ssb-web