lib/gcli/commands/server/firefox.js
function tweakI18nStrings(data) {
  // Rip off the CommonJS header/footer
  var output = '';
  data.replace(outline, function(m, inner) {
    // Remove the trailing spaces
    output += inner.replace(/ *$/, '');
  });

  if (output === '') {
    throw new Error('Mismatch in lib/gcli/nls/strings.js');
  }

  var strings = [];

  // Convert each of the string definitions
  var reply = output.replace(singleString, function(m, note, x, name, value) {
    strings.push({
      note: note,
      noteAlsoFor: [],
      name: name,
      value: value
    });
    return '';
  });

  console.log('reply="' + reply + '"');

  strings = strings.filter(function(string) {
    return ignoreStrings.indexOf(string.name) === -1;
  });

  // All strings should have a note, but sometimes we describe several strings
  // with one note, so if a string has no note then we add it to noteAlsoFor
  // in the last string with a note
  var lastStringWithNote = -1;
  strings.forEach(function(string, i) {
    if (string.note === '') {
      strings[lastStringWithNote].noteAlsoFor.push(string.name);
    }
    else {
      lastStringWithNote = i;
    }
  });

  // Make a single one line string from the the multi-line JS comments
  strings.forEach(function(string) {
    if (string.note !== '') {
      string.note = string.note.replace(/\n? *\/\/ */g, ' ')
                               .replace(/^ /, '')
                               .replace(/\n$/, '');
    }
  });

  // Add the 'LOCALIZATION NOTE' and word wrap
  strings.forEach(function(string) {
    if (string.note !== '') {
      string.noteAlsoFor.unshift(string.name);
      var names = '';
      if (string.noteAlsoFor.length > 1) {
        names = ' (' + string.noteAlsoFor.join(', ') + ')';
      }

      string.note = 'LOCALIZATION NOTE' + names + ': ' + string.note;
      string.note = '\n# ' + wordWrap(string.note, 77).join('\n# ') + '\n';
    }
  });

  // The values were escaped JavaScript strings to be property values they
  // need unescaping
  strings.forEach(function(string) {
    string.value = string.value.replace(/\\\\/g, '\\').replace(/\\'/g, '\'');
  });

  // Join to get the output
  output = strings.map(function(string) {
    return string.note + string.name + '=' + string.value + '\n';
  }).join('');

  return '' +
    '# This Source Code Form is subject to the terms of the Mozilla Public\n' +
    '# License, v. 2.0. If a copy of the MPL was not distributed with this\n' +
    '# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n' +
    '\n' +
    '# LOCALIZATION NOTE These strings are used inside the Web Console\n' +
    '# command line which is available from the Web Developer sub-menu\n' +
    '# -> \'Web Console\'.\n' +
    '# The correct localization of this file might be to keep it in\n' +
    '# English, or another language commonly spoken among web developers.\n' +
    '# You want to make that choice consistent across the developer tools.\n' +
    '# A good criteria is the language in which you\'d find the best\n' +
    '# documentation on web development on the web.\n' +
    '\n' +
    '# For each command there are in general two strings. As an example consider\n' +
    '# the \'pref\' command.\n' +
    '# commandDesc (e.g. prefDesc for the command \'pref\'): this string contains a\n' +
    '# very short description of the command. It\'s designed to be shown in a menu\n' +
    '# alongside the command name, which is why it should be as short as possible.\n' +
    '# commandManual (e.g. prefManual for the command \'pref\'): this string will\n' +
    '# contain a fuller description of the command. It\'s diplayed when the user\n' +
    '# asks for help about a specific command (e.g. \'help pref\').\n' +
    output;
}
function tweakI18nStrings(data) {
  // Rip off the CommonJS header/footer
  var output = '';
  data.replace(outline, function(m, inner) {
    // Remove the trailing spaces
    output += inner.replace(/ *$/, '');
  });

  if (output === '') {
    throw new Error('Mismatch in lib/gcli/nls/strings.js');
  }

  var strings = [];

  // Convert each of the string definitions
  var reply = output.replace(singleString, function(m, note, x, name, value) {
    strings.push({
      note: note,
      noteAlsoFor: [],
      name: name,
      value: value
    });
    return '';
  });

  console.log('reply="' + reply + '"');

  strings = strings.filter(function(string) {
    return ignoreStrings.indexOf(string.name) === -1;
  });

  // All strings should have a note, but sometimes we describe several strings
  // with one note, so if a string has no note then we add it to noteAlsoFor
  // in the last string with a note
  var lastStringWithNote = -1;
  strings.forEach(function(string, i) {
    if (string.note === '') {
      strings[lastStringWithNote].noteAlsoFor.push(string.name);
    }
    else {
      lastStringWithNote = i;
    }
  });

  // Make a single one line string from the the multi-line JS comments
  strings.forEach(function(string) {
    if (string.note !== '') {
      string.note = string.note.replace(/\n? *\/\/ */g, ' ')
                               .replace(/^ /, '')
                               .replace(/\n$/, '');
    }
  });

  // Add the 'LOCALIZATION NOTE' and word wrap
  strings.forEach(function(string) {
    if (string.note !== '') {
      string.noteAlsoFor.unshift(string.name);
      var names = '';
      if (string.noteAlsoFor.length > 1) {
        names = ' (' + string.noteAlsoFor.join(', ') + ')';
      }

      string.note = 'LOCALIZATION NOTE' + names + ': ' + string.note;
      string.note = '\n# ' + wordWrap(string.note, 77).join('\n# ') + '\n';
    }
  });

  // The values were escaped JavaScript strings to be property values they
  // need unescaping
  strings.forEach(function(string) {
    string.value = string.value.replace(/\\\\/g, '\\').replace(/\\'/g, '\'');
  });

  // Join to get the output
  output = strings.map(function(string) {
    return string.note + string.name + '=' + string.value + '\n';
  }).join('');

  return '' +
    '# This Source Code Form is subject to the terms of the Mozilla Public\n' +
    '# License, v. 2.0. If a copy of the MPL was not distributed with this\n' +
    '# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n' +
    '\n' +
    '# LOCALIZATION NOTE These strings are used inside the Web Console\n' +
    '# command line which is available from the Web Developer sub-menu\n' +
    '# -> \'Web Console\'.\n' +
    '# The correct localization of this file might be to keep it in\n' +
    '# English, or another language commonly spoken among web developers.\n' +
    '# You want to make that choice consistent across the developer tools.\n' +
    '# A good criteria is the language in which you\'d find the best\n' +
    '# documentation on web development on the web.\n' +
    '\n' +
    '# For each command there are in general two strings. As an example consider\n' +
    '# the \'pref\' command.\n' +
    '# commandDesc (e.g. prefDesc for the command \'pref\'): this string contains a\n' +
    '# very short description of the command. It\'s designed to be shown in a menu\n' +
    '# alongside the command name, which is why it should be as short as possible.\n' +
    '# commandManual (e.g. prefManual for the command \'pref\'): this string will\n' +
    '# contain a fuller description of the command. It\'s diplayed when the user\n' +
    '# asks for help about a specific command (e.g. \'help pref\').\n' +
    output;
}
function tweakI18nStrings ( data ) { // Rip off the CommonJS header/footer var output = '' ; data . replace ( outline , function ( m , inner ) { // Remove the trailing spaces output += inner . replace ( /  *$ / , '' ) ; } ) ; if ( output === '' ) { throw new Error ( 'Mismatch in lib/gcli/nls/strings.js' ) ; } var strings = [ ] ; // Convert each of the string definitions var reply = output . replace ( singleString , function ( m , note , x , name , value ) { strings . push ( { note : note , noteAlsoFor : [ ] , name : name , value : value } ) ; return '' ; } ) ; console . log ( 'reply="' + reply + '"' ) ; strings = strings . filter ( function ( string ) { return ignoreStrings . indexOf ( string . name ) === - 1 ; } ) ; // All strings should have a note, but sometimes we describe several strings // with one note, so if a string has no note then we add it to noteAlsoFor // in the last string with a note var lastStringWithNote = - 1 ; strings . forEach ( function ( string , i ) { if ( string . note === '' ) { strings [ lastStringWithNote ] . noteAlsoFor . push ( string . name ) ; } else { lastStringWithNote = i ; } } ) ; // Make a single one line string from the the multi-line JS comments strings . forEach ( function ( string ) { if ( string . note !== '' ) { string . note = string . note . replace ( / \n? *\/\/ * / g , ' ' ) . replace ( / ^  / , '' ) . replace ( / \n$ / , '' ) ; } } ) ; // Add the 'LOCALIZATION NOTE' and word wrap strings . forEach ( function ( string ) { if ( string . note !== '' ) { string . noteAlsoFor . unshift ( string . name ) ; var names = '' ; if ( string . noteAlsoFor . length > 1 ) { names = ' (' + string . noteAlsoFor . join ( ', ' ) + ')' ; } string . note = 'LOCALIZATION NOTE' + names + ': ' + string . note ; string . note = '\n# ' + wordWrap ( string . note , 77 ) . join ( '\n# ' ) + '\n' ; } } ) ; // The values were escaped JavaScript strings to be property values they // need unescaping strings . forEach ( function ( string ) { string . value = string . value . replace ( / \\\\ / g , '\\' ) . replace ( / \\' / g , '\'' ) ; } ) ; // Join to get the output output = strings . map ( function ( string ) { return string . note + string . name + '=' + string . value + '\n' ; } ) . join ( '' ) ; return '' + '# This Source Code Form is subject to the terms of the Mozilla Public\n' + '# License, v. 2.0. If a copy of the MPL was not distributed with this\n' + '# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n' + '\n' + '# LOCALIZATION NOTE These strings are used inside the Web Console\n' + '# command line which is available from the Web Developer sub-menu\n' + '# -> \'Web Console\'.\n' + '# The correct localization of this file might be to keep it in\n' + '# English, or another language commonly spoken among web developers.\n' + '# You want to make that choice consistent across the developer tools.\n' + '# A good criteria is the language in which you\'d find the best\n' + '# documentation on web development on the web.\n' + '\n' + '# For each command there are in general two strings. As an example consider\n' + '# the \'pref\' command.\n' + '# commandDesc (e.g. prefDesc for the command \'pref\'): this string contains a\n' + '# very short description of the command. It\'s designed to be shown in a menu\n' + '# alongside the command name, which is why it should be as short as possible.\n' + '# commandManual (e.g. prefManual for the command \'pref\'): this string will\n' + '# contain a fuller description of the command. It\'s diplayed when the user\n' + '# asks for help about a specific command (e.g. \'help pref\').\n' + output ; }
Filter to turn GCLIs l18n script file into a Firefox l10n strings file
Filter to turn GCLIs l18n script file into a Firefox l10n strings file