Merge pull request #4857 from yurydelendik/normtext
Making sure we are not importing CRs and BOMs
This commit is contained in:
commit
8fab610b7e
33
external/crlfchecker/normtext.js
vendored
Normal file
33
external/crlfchecker/normtext.js
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* jshint node:true */
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
function normalizeText(s) {
|
||||
return s.replace(/\r\n?/g, '\n').replace(/\uFEFF/g, '');
|
||||
}
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
args.forEach(function (file) {
|
||||
var content = fs.readFileSync(file, 'utf8');
|
||||
content = normalizeText(content);
|
||||
fs.writeFileSync(file, content, 'utf8');
|
||||
});
|
12
external/importL10n/locales.js
vendored
12
external/importL10n/locales.js
vendored
@ -39,6 +39,10 @@ var langCodes = [
|
||||
'zh-TW', 'zu'
|
||||
];
|
||||
|
||||
function normalizeText(s) {
|
||||
return s.replace(/\r\n?/g, '\n').replace(/\uFEFF/g, '');
|
||||
}
|
||||
|
||||
function downloadLanguageFiles(langCode, callback) {
|
||||
console.log('Downloading ' + langCode + '...');
|
||||
|
||||
@ -60,12 +64,16 @@ function downloadLanguageFiles(langCode, callback) {
|
||||
// Download the necessary files for this language.
|
||||
files.forEach(function(fileName) {
|
||||
var outputPath = path.join(langCode, fileName);
|
||||
var file = fs.createWriteStream(outputPath);
|
||||
var url = MOZCENTRAL_ROOT + langCode + MOZCENTRAL_PDFJS_DIR +
|
||||
fileName + MOZCENTRAL_RAW_FLAG;
|
||||
var request = http.get(url, function(response) {
|
||||
response.pipe(file);
|
||||
var content = '';
|
||||
response.setEncoding('utf8');
|
||||
response.on("data", function(chunk) {
|
||||
content += chunk;
|
||||
});
|
||||
response.on('end', function() {
|
||||
fs.writeFileSync(outputPath, normalizeText(content), 'utf8');
|
||||
downloadsLeft--;
|
||||
if (downloadsLeft === 0) {
|
||||
callback();
|
||||
|
@ -1,4 +1,4 @@
|
||||
<em:localized>
|
||||
<em:localized>
|
||||
<Description>
|
||||
<em:locale>bn-BD</em:locale>
|
||||
<em:name>পিডিএফ ভিউয়ার</em:name>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<em:localized>
|
||||
<em:localized>
|
||||
<Description>
|
||||
<em:locale>fi</em:locale>
|
||||
<em:name>PDF Lukuohjelma</em:name>
|
||||
|
Loading…
Reference in New Issue
Block a user