gecko-dev/browser/components/loop/standalone/content/legal/js/loader.js
Rémy HUBSCHER fb4ec1d1e7 Bug 1044411 - Generate Loop ToS static content, r=abr,dmose; rs=ted for .hgignore changes
Bug 1044411 - Generate Loop ToS static content, priv-policy bits removed
2014-08-26 12:58:00 -05:00

33 lines
905 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Set the current translation content
function setBody(data) {
$("#legal-copy").html(data);
}
function normalizeLocale(lang) {
return lang.replace(/-/g, "_");
}
$(document).ready(function() {
// Get the favorite language
var lang, defaultLang = "en-US";
$.get(loop.config.serverUrl, function(data) {
if (data.hasOwnProperty("i18n")) {
lang = normalizeLocale(data.i18n.lang);
defaultLang = normalizeLocale(data.i18n.defaultLang);
}
if (lang === undefined) {
lang = normalizeLocale(defaultLang);
}
$.get(lang + ".html")
.done(setBody)
.fail(function() {
$.get(defaultLang + ".html")
.done(setBody);
});
});
});