https://bugzilla.wikimedia.org/show_bug.cgi?id=41489

--- Comment #14 from Krinkle <[email protected]> ---
(In reply to comment #11)
> (In reply to comment #8)
> > ULS shouldn't be using CORS to load JSON data from static files. It should 
> > use
> > JSON-P, preferably from the API.
> 
> As far as I know it is jquery.i18n which is loading the files. We are not
> going
> to change the i18n file format for this, so the ULS extension would need to
> implement custom loading wrapper for both backend and frontend.
> 
> Or perhaps we could just skip the effort and load the static files from the
> current domain ignoring bits altogether?

The wrapper sounds like the way to go. A simple ResourceLoader or API module.
Which ever works best for you.

API:

 Implement:
  GET /api.php?action=<module>&lang=<lang>&callback=..
  ...({...data from json file..});

 Load:
  $.getJSON(api, function (data) {
    mw.ext.uls.provideLang(data);
  });

ResourceLoader:

 Implement:
  register module (if you only ever need 1 lang per page, switch getScript
response based on context language within 1 module, or register 1 module per
language)
  module's getScript would be like mw.ext.uls.provideLang({...data from json
file..});

 Load:
  mw.loader.load( '<module>.<lang>' );


The API approach is probably better. It gives more flexibility in usage (by
providing the data directly from the callback) and doesn't fill the startup
module with 1 lot of modules for every language code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to