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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js

Issue 1362223003: Improve braille related message descriptions and clean up message handling in Chromevox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inputtypeexception
Patch Set: Move another braille message to Msgs.Untranslated Created 5 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 6 /**
7 * @fileoverview Testing stub for messages. 7 * @fileoverview Testing stub for messages.
8 */ 8 */
9 9
10 goog.provide('cvox.TestMsgs'); 10 goog.provide('TestMsgs');
11 11
12 goog.require('cvox.Msgs'); 12 goog.require('Msgs');
13 goog.require('cvox.TestMessages'); 13 goog.require('cvox.TestMessages');
14 14
15
16 /** 15 /**
17 * @constructor 16 * @constructor
18 * @extends {cvox.Msgs}
19 */ 17 */
20 cvox.TestMsgs = function() { 18 TestMsgs = function() {};
21 cvox.Msgs.call(this);
22 };
23 goog.inherits(cvox.TestMsgs, cvox.Msgs);
24
25 19
26 /** 20 /**
27 * @override 21 * @type {Object<string>}
28 */ 22 */
29 cvox.TestMsgs.prototype.getLocale = function() { 23 TestMsgs.Untranslated = Msgs.Untranslated;
24
25 /**
26 * @return {string} The locale.
27 */
28 TestMsgs.getLocale = function() {
30 return 'testing'; 29 return 'testing';
31 }; 30 };
32 31
33
34 /** 32 /**
35 * @override 33 * @param {string} messageId
34 * @param {Array<string>=} opt_subs
35 * @return {string}
36 */ 36 */
37 cvox.TestMsgs.prototype.getMsg = function(messageId, opt_subs) { 37 TestMsgs.getMsg = function(messageId, opt_subs) {
38 if (!messageId) { 38 if (!messageId) {
39 throw Error('Message id required'); 39 throw Error('Message id required');
40 } 40 }
41 var message = cvox.TestMessages[('chromevox_' + messageId).toUpperCase()]; 41 var message = TestMsgs.Untranslated[messageId.toUpperCase()];
42 if (message == undefined) { 42 if (message !== undefined)
43 return message;
44 message = cvox.TestMessages[('chromevox_' + messageId).toUpperCase()];
45 if (message === undefined) {
43 throw Error('missing-msg: ' + messageId); 46 throw Error('missing-msg: ' + messageId);
44 } 47 }
45 48
46 var messageString = message.message; 49 var messageString = message.message;
47 if (opt_subs) { 50 if (opt_subs) {
48 // Unshift a null to make opt_subs and message.placeholders line up. 51 // Unshift a null to make opt_subs and message.placeholders line up.
49 for (var i = 0; i < opt_subs.length; i++) { 52 for (var i = 0; i < opt_subs.length; i++) {
50 messageString = messageString.replace('$' + (i + 1), opt_subs[i]); 53 messageString = messageString.replace('$' + (i + 1), opt_subs[i]);
51 } 54 }
52 } 55 }
53 return messageString; 56 return messageString;
54 }; 57 };
58
59 /**
60 * @param {number} num
61 * @return {string}
62 */
63 TestMsgs.getNumber = Msgs.getNumber;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698