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

Side by Side Diff: remoting/webapp/crd/js/l10n.js

Issue 1004513002: Eliminated named constants for instances of remoting.Error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 var l10n = l10n || {}; 6 var l10n = l10n || {};
7 7
8 /** 8 /**
9 * Localize a tag, returning the tag itself and logging an error if no 9 * Localize a tag, returning the tag itself and logging an error if no
10 * translation exists. 10 * translation exists.
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 console.error('Missing translation for "' + tag + '"'); 22 console.error('Missing translation for "' + tag + '"');
23 return tag; 23 return tag;
24 }; 24 };
25 25
26 /** 26 /**
27 * Localize an element by setting its innerText according to the specified tag 27 * Localize an element by setting its innerText according to the specified tag
28 * and an optional set of substitutions. 28 * and an optional set of substitutions.
29 * 29 *
30 * @param {Element} element The element to localize. 30 * @param {Element} element The element to localize.
31 * @param {string} tag The localization tag. 31 * @param {string} tag The localization tag or
32 * an Error object containing the tag.
32 * @param {(string|Array)=} opt_substitutions An optional set of substitution 33 * @param {(string|Array)=} opt_substitutions An optional set of substitution
33 * strings corresponding to the "placeholders" attributes in messages.json. 34 * strings corresponding to the "placeholders" attributes in messages.json.
34 * @param {boolean=} opt_asHtml If true, set innerHTML instead of innerText. 35 * @param {boolean=} opt_asHtml If true, set innerHTML instead of innerText.
35 * This parameter should be used with caution. 36 * This parameter should be used with caution.
36 * @return {boolean} True if the localization was successful; false otherwise. 37 * @return {boolean} True if the localization was successful; false otherwise.
37 */ 38 */
38 l10n.localizeElementFromTag = function(element, tag, opt_substitutions, 39 l10n.localizeElementFromTag = function(element, tag, opt_substitutions,
39 opt_asHtml) { 40 opt_asHtml) {
40 var translation = l10n.getTranslationOrError(tag, opt_substitutions); 41 var translation = l10n.getTranslationOrError(tag, opt_substitutions);
41 if (opt_asHtml) { 42 if (opt_asHtml) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 97 }
97 var titleTag = element.getAttribute('i18n-title'); 98 var titleTag = element.getAttribute('i18n-title');
98 if (titleTag) { 99 if (titleTag) {
99 element.title = l10n.getTranslationOrError(titleTag, substitutions); 100 element.title = l10n.getTranslationOrError(titleTag, substitutions);
100 } else { 101 } else {
101 l10n.localizeElement(element, substitutions, 102 l10n.localizeElement(element, substitutions,
102 substitutions.length != 0); 103 substitutions.length != 0);
103 } 104 }
104 } 105 }
105 }; 106 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/it2me_host_facade.js ('k') | remoting/webapp/crd/js/me2me_connect_flow.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698