Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/UIString.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 */ 30 */
31 31
32 /** 32 /**
33 * @param {string} string 33 * @param {string} string
34 * @param {...*} vararg 34 * @param {...*} vararg
35 * @return {string} 35 * @return {string}
36 */ 36 */
37 WebInspector.UIString = function(string, vararg) 37 WebInspector.UIString = function(string, vararg)
38 { 38 {
39 return String.vsprintf(WebInspector.localize(string), Array.prototype.slice. call(arguments, 1)); 39 return String.vsprintf(WebInspector.localize(string), Array.prototype.slice. call(arguments, 1));
40 } 40 };
41 41
42 /** 42 /**
43 * @param {string} string 43 * @param {string} string
44 * @param {...*} vararg 44 * @param {...*} vararg
45 * @return {string} 45 * @return {string}
46 */ 46 */
47 WebInspector.UIString.capitalize = function(string, vararg) 47 WebInspector.UIString.capitalize = function(string, vararg)
48 { 48 {
49 if (WebInspector._useLowerCaseMenuTitles === undefined) 49 if (WebInspector._useLowerCaseMenuTitles === undefined)
50 throw "WebInspector.setLocalizationPlatform() has not been called"; 50 throw "WebInspector.setLocalizationPlatform() has not been called";
51 51
52 var localized = WebInspector.localize(string); 52 var localized = WebInspector.localize(string);
53 var capitalized; 53 var capitalized;
54 if (WebInspector._useLowerCaseMenuTitles) 54 if (WebInspector._useLowerCaseMenuTitles)
55 capitalized = localized.replace(/\^(.)/g, "$1"); 55 capitalized = localized.replace(/\^(.)/g, "$1");
56 else 56 else
57 capitalized = localized.replace(/\^(.)/g, function(str, char) { return c har.toUpperCase(); }); 57 capitalized = localized.replace(/\^(.)/g, function(str, char) { return c har.toUpperCase(); });
58 return String.vsprintf(capitalized, Array.prototype.slice.call(arguments, 1) ); 58 return String.vsprintf(capitalized, Array.prototype.slice.call(arguments, 1) );
59 } 59 };
60 60
61 /** 61 /**
62 * @param {string} platform 62 * @param {string} platform
63 */ 63 */
64 WebInspector.setLocalizationPlatform = function(platform) 64 WebInspector.setLocalizationPlatform = function(platform)
65 { 65 {
66 WebInspector._useLowerCaseMenuTitles = platform === "windows"; 66 WebInspector._useLowerCaseMenuTitles = platform === "windows";
67 } 67 };
68 68
69 /** 69 /**
70 * @param {string} string 70 * @param {string} string
71 * @return {string} 71 * @return {string}
72 */ 72 */
73 WebInspector.localize = function(string) 73 WebInspector.localize = function(string)
74 { 74 {
75 return string; 75 return string;
76 } 76 };
77 77
78 /** 78 /**
79 * @constructor 79 * @constructor
80 * @param {string} format 80 * @param {string} format
81 */ 81 */
82 WebInspector.UIStringFormat = function(format) 82 WebInspector.UIStringFormat = function(format)
83 { 83 {
84 /** @type {string} */ 84 /** @type {string} */
85 this._localizedFormat = WebInspector.localize(format); 85 this._localizedFormat = WebInspector.localize(format);
86 /** @type {!Array.<!Object>} */ 86 /** @type {!Array.<!Object>} */
87 this._tokenizedFormat = String.tokenizeFormatString(this._localizedFormat, S tring.standardFormatters); 87 this._tokenizedFormat = String.tokenizeFormatString(this._localizedFormat, S tring.standardFormatters);
88 } 88 };
89 89
90 /** 90 /**
91 * @param {string} a 91 * @param {string} a
92 * @param {string} b 92 * @param {string} b
93 * @return {string} 93 * @return {string}
94 */ 94 */
95 WebInspector.UIStringFormat._append = function(a, b) 95 WebInspector.UIStringFormat._append = function(a, b)
96 { 96 {
97 return a + b; 97 return a + b;
98 } 98 };
99 99
100 WebInspector.UIStringFormat.prototype = { 100 WebInspector.UIStringFormat.prototype = {
101 /** 101 /**
102 * @param {...*} vararg 102 * @param {...*} vararg
103 * @return {string} 103 * @return {string}
104 */ 104 */
105 format: function(vararg) 105 format: function(vararg)
106 { 106 {
107 return String.format(this._localizedFormat, arguments, 107 return String.format(this._localizedFormat, arguments,
108 String.standardFormatters, "", WebInspector.UIStringFormat._append, this._tokenizedFormat).formattedResult; 108 String.standardFormatters, "", WebInspector.UIStringFormat._append, this._tokenizedFormat).formattedResult;
109 } 109 }
110 } 110 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698