Board Thread:Code Review/@comment-24757753-20180805110740

I've recently made some changes to the i18n-js library and am hoping some other people would take a look, since the script is quite widely used. The updated version is currently at MediaWiki:I18n-js/beta.js (diff from current version).

The major change involves  being used as a client-side cache. When an i18n JSON page is fetched, it'll be cached in  along with the current timestamp and a version number. The cache will be used as long as it's less than two days old (seemed a decent period), or as long as its version is less than the version requested by the script (this is to allow a script change that needs new messages to force a cache update). This version is implemented via a new  argument for the   function.

A smaller change involves how the i18n JSON page is loaded. Rather than (ab)using  and loading it as styles, it instead uses Dev Wiki's MediaWiki API endpoint via JSONP to allow loading cross-domain. This also has the side effect of allowing i18n-js to function when used on wikis outside of Wikia (not a common case, but compatibility is nice!). i18n JSON pages hosted on other wikis are still supported (by extracting the wiki prefix from the supplied page name and using it in the URL), however hosting a JSON page on a language-prefixed wiki isn't currently supported. I'm not sure if support for that is important, since this feature was mainly meant for VSTF wiki.

Also, I've tweaked the comment-stripping code to ignore comment-like text within strings (with a bit of regex help from Doru!), as this was causing issues for a few scripts.

Any feedback or thoughts on the changes would be appreciated! 