Commit db20e2ee1a31d6f09639c346e37894ebd770f6b3
Refresh all screens on language change event
Marcos Gutierrez committed on 9/29/2017, 6:45:06 PMParent: 130286f770625230c71948c18c13ba3dd97a5d07
Files changed
plugs/intl/sync/i18n.js | changed |
plugs/intl/sync/i18n.js | ||
---|---|---|
@@ -72,17 +72,24 @@ | ||
72 | 72 | //Init an subscribe to settings changes. |
73 | 73 | function _init() { |
74 | 74 | if (_locale) return |
75 | 75 | //TODO: Depject this! |
76 | - _locale = true; | |
77 | 76 | i18nL.configure({ |
78 | 77 | directory: appRoot + '/locales', |
79 | 78 | defaultLocale: 'en' |
80 | 79 | }); |
81 | 80 | |
82 | 81 | watch(api.settings.obs.get('patchwork.lang',navigator.language), currentLocale => { |
83 | 82 | 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 | + } | |
84 | 89 | }) |
90 | + | |
91 | + _locale = true; | |
85 | 92 | } |
86 | 93 | |
87 | 94 | } |
88 | 95 |
Built with git-ssb-web