coderifous / jquery-localize

a jQuery plugin that makes it easy to internationalize your web site.
465 stars 142 forks source link

How to clear local storage when .json file changes on production #70

Closed nitinsurana closed 8 years ago

nitinsurana commented 8 years ago

Hi,

We made some enhancements, but they are not reflecting on production for many users, because localStorage is not cleared. I thought of adding some ?_= param to .json path but could not find pathSuffix or something similar.

How to achieve this ?

alvin0618 commented 8 years ago

Add ?v=' + Math.random(), into ajaxOption

      ajaxOptions = {
        url: file + '?v=' + Math.random(),
        dataType: "json",
        async: false,
        timeout: options.timeout != null ? options.timeout : 500,
        success: successFunc,
        error: errorFunc
      };
balazsnemeth commented 7 years ago

This is wokring without changing the internal library code:

var translationOptions = { language: "de", fileExtension: ('json'+ '?v=' + Math.random())};
$("[data-localize]").localize("home", translationOptions);