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
3 // found in the LICENSE file.
7 * @fileoverview Testing stub for messages.
10 goog
.provide('cvox.TestMsgs');
12 goog
.require('cvox.Msgs');
13 goog
.require('cvox.TestMessages');
18 * @extends {cvox.Msgs}
20 cvox
.TestMsgs = function() {
23 goog
.inherits(cvox
.TestMsgs
, cvox
.Msgs
);
29 cvox
.TestMsgs
.prototype.getLocale = function() {
37 cvox
.TestMsgs
.prototype.getMsg = function(messageId
, opt_subs
) {
39 throw Error('Message id required');
41 var message
= cvox
.TestMessages
[('chromevox_' + messageId
).toUpperCase()];
42 if (message
== undefined) {
43 throw Error('missing-msg: ' + messageId
);
46 var messageString
= message
.message
;
48 // Unshift a null to make opt_subs and message.placeholders line up.
49 for (var i
= 0; i
< opt_subs
.length
; i
++) {
50 messageString
= messageString
.replace('$' + (i
+ 1), opt_subs
[i
]);