mirror of https://github.com/zulip/zulip.git
translations: Remove unnecessary cache clearing code.
Since the browser reloads when new server versions are deployed, the other similar block already handles this issue.
This commit is contained in:
parent
a17f42a6f9
commit
93418c6eb4
|
@ -37,9 +37,6 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||||
if (event.immediate) {
|
if (event.immediate) {
|
||||||
reload_options.immediate = true;
|
reload_options.immediate = true;
|
||||||
}
|
}
|
||||||
if (event.server_generation !== page_params.server_generation) {
|
|
||||||
i18n.clearCache();
|
|
||||||
}
|
|
||||||
reload.initiate(reload_options);
|
reload.initiate(reload_options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -54,20 +54,6 @@ i18next.ensure_i18n = function (callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
i18next.clearCache = function () {
|
|
||||||
// this collects all localStorage keys that match the format of:
|
|
||||||
// i18next:dddddddddd:w+ => 1484902202:en
|
|
||||||
// these are all language translation strings.
|
|
||||||
var translations = Object.keys(localStorage).filter(function (key) {
|
|
||||||
return /^i18next:\d{10}:\w+$/.test(key);
|
|
||||||
});
|
|
||||||
|
|
||||||
// remove all translations.
|
|
||||||
translations.forEach(function (translation_key) {
|
|
||||||
localStorage.removeItem(translation_key);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// garbage collect all old i18n translation maps in localStorage.
|
// garbage collect all old i18n translation maps in localStorage.
|
||||||
$(function () {
|
$(function () {
|
||||||
// this collects all localStorage keys that match the format of:
|
// this collects all localStorage keys that match the format of:
|
||||||
|
|
Loading…
Reference in New Issue