Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'I18nBehavior' is a behavior to mix in loading of | 7 * 'I18nBehavior' is a behavior to mix in loading of |
| 8 * internationalization strings. | 8 * internationalization strings. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 * @param {{substitutions: (Array<string>|undefined), | 50 * @param {{substitutions: (Array<string>|undefined), |
| 51 * attrs: (Object<function(Node, string):boolean>|undefined), | 51 * attrs: (Object<function(Node, string):boolean>|undefined), |
| 52 * tags: (Array<string>|undefined)}} opts | 52 * tags: (Array<string>|undefined)}} opts |
| 53 */ | 53 */ |
| 54 i18nAdvanced: function(id, opts) { | 54 i18nAdvanced: function(id, opts) { |
| 55 var args = [id].concat(opts.substitutions || []); | 55 var args = [id].concat(opts.substitutions || []); |
| 56 var rawString = this.i18nRaw_.apply(this, args); | 56 var rawString = this.i18nRaw_.apply(this, args); |
| 57 return parseHtmlSubset('<b>' + rawString + '</b>', opts.tags, opts.attrs) | 57 return parseHtmlSubset('<b>' + rawString + '</b>', opts.tags, opts.attrs) |
| 58 .firstChild.innerHTML; | 58 .firstChild.innerHTML; |
| 59 }, | 59 }, |
| 60 | |
| 61 /** | |
| 62 * Returns true if a translation exists for |id|. | |
| 63 * @param {string} id | |
| 64 * @return {boolean} | |
| 65 */ | |
| 66 i18nExists: function(id) { | |
|
Dan Beam
2016/07/13 01:35:11
if you do add this, can you update chrome/test/dat
stevenjb
2016/07/13 17:26:43
Done.
| |
| 67 return loadTimeData.valueExists(id); | |
| 68 }, | |
| 60 }; | 69 }; |
| OLD | NEW |