mozilla / remote-newtab

Remotely-hosted New Tab Page
https://mozilla.github.io/remote-newtab/src/
Mozilla Public License 2.0
15 stars 7 forks source link

locale/newTab.js should be an JSON file #114

Closed marcoscaceres closed 8 years ago

marcoscaceres commented 8 years ago

we should load newTab.js strings as needed, using fetch as XML.

marcoscaceres commented 8 years ago

Loosely depends on: https://github.com/whatwg/fetch/issues/151

marcoscaceres commented 8 years ago

Can do:

async function fetchXML(url){
  var response = await fetch(url);
  var text = await response.text(); 
  return (new DOMParser()).parseFromString(text, "text/xml");
}
oyiptong commented 8 years ago

Any reason why we want locale/newTab.js as XML? We can make it JSON.

If we re-use the XML as-is currently, there is a need for 2 requests: the xml and the DTD which actually contains the text:

http://mxr.mozilla.org/l10n-central/source/en-GB/browser/chrome/browser/newTab.dtd http://mxr.mozilla.org/l10n-central/source/en-GB/browser/chrome/browser/newTab.properties

There is also no locale XML for en-US in l10n-central.

How about we provide one JSON file per locale, generated as a build step?

marcoscaceres commented 8 years ago

(Note, this is a v2 thing)

On Nov 3, 2015, at 3:14 AM, Olivier Yiptong notifications@github.com wrote:

Any reason why we want locale/newTab.js as XML? We can make it JSON

That would be great - just need to remove the comments. Right now, anyone localizing could add arbitrary code to the locales file, which makes me a bit uncomfortable. This could break things, or worse, obviously. If we re-use the XML as-is currently, there is a need for 2 requests: the xml and the DTD which actually contains the text:

http://mxr.mozilla.org/l10n-central/source/en-GB/browser/chrome/browser/newTab.dtd http://mxr.mozilla.org/l10n-central/source/en-GB/browser/chrome/browser/newTab.properties

Yeah, the currently used format is pretty awful.

There is also no locale XML for en-US in l10n-central.

How about we provide one JSON file per locale, generated as a build step?

That would be ideal:)

— Reply to this email directly or view it on GitHub.