| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 var str = num + ""; | 556 var str = num + ""; |
| 557 var re = /(\d+)(\d{3})/; | 557 var re = /(\d+)(\d{3})/; |
| 558 while (str.match(re)) | 558 while (str.match(re)) |
| 559 str = str.replace(re, "$1\u2009$2"); // \u2009 is a thin space. | 559 str = str.replace(re, "$1\u2009$2"); // \u2009 is a thin space. |
| 560 return str; | 560 return str; |
| 561 } | 561 } |
| 562 | 562 |
| 563 /** | 563 /** |
| 564 * @param {string} format | 564 * @param {string} format |
| 565 * @param {?ArrayLike} substitutions | 565 * @param {?ArrayLike} substitutions |
| 566 * @param {!Object.<string, function(string, ...):*>} formatters | 566 * @param {?string} initialValue |
| 567 * @param {string} initialValue | 567 * @return {!Element} |
| 568 * @param {function(string, string): ?} append | |
| 569 * @return {!{formattedResult: string, unusedSubstitutions: ?ArrayLike}}; | |
| 570 */ | 568 */ |
| 571 WebInspector.formatLocalized = function(format, substitutions, formatters, initi
alValue, append) | 569 WebInspector.formatLocalized = function(format, substitutions, initialValue) |
| 572 { | 570 { |
| 573 return String.format(WebInspector.UIString(format), substitutions, formatter
s, initialValue, append); | 571 var element = createElement("span"); |
| 572 var formatters = { |
| 573 s: function(substitution) |
| 574 { |
| 575 return substitution; |
| 576 } |
| 577 }; |
| 578 function append(a, b) |
| 579 { |
| 580 if (typeof b === "string") |
| 581 b = createTextNode(b); |
| 582 else if (b.shadowRoot) |
| 583 b = createTextNode(b.shadowRoot.lastChild.textContent); |
| 584 element.appendChild(b); |
| 585 } |
| 586 String.format(WebInspector.UIString(format), substitutions, formatters, init
ialValue, append); |
| 587 return element; |
| 574 } | 588 } |
| 575 | 589 |
| 576 /** | 590 /** |
| 577 * @return {string} | 591 * @return {string} |
| 578 */ | 592 */ |
| 579 WebInspector.openLinkExternallyLabel = function() | 593 WebInspector.openLinkExternallyLabel = function() |
| 580 { | 594 { |
| 581 return WebInspector.UIString.capitalize("Open ^link in ^new ^tab"); | 595 return WebInspector.UIString.capitalize("Open ^link in ^new ^tab"); |
| 582 } | 596 } |
| 583 | 597 |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 // Due to the nature of regex, |items| array has matched elements on its
even indexes. | 1441 // Due to the nature of regex, |items| array has matched elements on its
even indexes. |
| 1428 var items = text.replace(regex, "\0$1\0").split("\0"); | 1442 var items = text.replace(regex, "\0$1\0").split("\0"); |
| 1429 for (var i = 0; i < items.length; ++i) { | 1443 for (var i = 0; i < items.length; ++i) { |
| 1430 var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
(processorIndex + 1, items[i]); | 1444 var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
(processorIndex + 1, items[i]); |
| 1431 container.appendChild(processedNode); | 1445 container.appendChild(processedNode); |
| 1432 } | 1446 } |
| 1433 | 1447 |
| 1434 return container; | 1448 return container; |
| 1435 } | 1449 } |
| 1436 } | 1450 } |
| OLD | NEW |