Unbreak the importl10n command by updating the links to point to hg.mozilla.org instead of mxr

Currently `importl10n` fails, since mxr.mozilla.org has been down for a while. Based on discussions in #developers, it isn't clear to me if/when it'll be available again.
Furthermore, I'm not sure why we're even getting the l10n files through a code search tool, rather than just using the official Mozilla repository directly.
This commit is contained in:
Jonas Jenwald 2016-06-22 09:36:59 +02:00
parent a0a6e6d688
commit bd0affab9c

View File

@ -17,7 +17,7 @@
'use strict';
var fs = require('fs');
var http = require('http');
var https = require('https');
var path = require('path');
// Defines all languages that have a translation at mozilla-aurora.
@ -47,9 +47,8 @@ function downloadLanguageFiles(root, langCode, callback) {
// Constants for constructing the URLs. Translations are taken from the
// Aurora channel as those are the most recent ones. The Nightly channel
// does not provide all translations.
var MOZCENTRAL_ROOT = 'http://mxr.mozilla.org/l10n-mozilla-aurora/source/';
var MOZCENTRAL_PDFJS_DIR = '/browser/pdfviewer/';
var MOZCENTRAL_RAW_FLAG = '?raw=1';
var MOZ_AURORA_ROOT = 'https://hg.mozilla.org/releases/l10n/mozilla-aurora/';
var MOZ_AURORA_PDFJS_DIR = '/raw-file/tip/browser/pdfviewer/';
// Defines which files to download for each language.
var files = ['chrome.properties', 'viewer.properties'];
@ -63,9 +62,8 @@ function downloadLanguageFiles(root, langCode, callback) {
// Download the necessary files for this language.
files.forEach(function(fileName) {
var outputPath = path.join(outputDir, fileName);
var url = MOZCENTRAL_ROOT + langCode + MOZCENTRAL_PDFJS_DIR +
fileName + MOZCENTRAL_RAW_FLAG;
var request = http.get(url, function(response) {
var url = MOZ_AURORA_ROOT + langCode + MOZ_AURORA_PDFJS_DIR + fileName;
var request = https.get(url, function(response) {
var content = '';
response.setEncoding('utf8');
response.on("data", function(chunk) {