1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview A helper object used to get a pluralized string.
*/
// clang-format off
import {addSingletonGetter, sendWithPromise} from './cr.m.js';
// clang-format on
/** @interface */
export class PluralStringProxy {
/**
* Obtains a pluralized string for |messageName| with |itemCount| items.
* @param {!string} messageName The name of the message.
* @param {!number} itemCount The number of items.
* @return {!Promise<string>} Promise resolved with the appropriate plural
* string for |messageName| with |itemCount| items.
*/
getPluralString(messageName, itemCount) {}
/**
* Fetches both plural strings, concatenated to one string with a comma.
* @param {!string} messageName1 The name of the first message.
* @param {!number} itemCount1 The number of items in the first message.
* @param {!string} messageName2 The name of the second message.
* @param {!number} itemCount2 The number of items in the second message.
* @return {!Promise<string>} Promise resolved with the appropriate plural
* strings for both messages, concatenated with a comma+whitespace in
* between them.
*/
getPluralStringTupleWithComma(
messageName1, itemCount1, messageName2, itemCount2) {}
/**
* Fetches both plural strings, concatenated to one string with periods.
* @param {!string} messageName1 The name of the first message.
* @param {!number} itemCount1 The number of items in the first message.
* @param {!string} messageName2 The name of the second message.
* @param {!number} itemCount2 The number of items in the second message.
* @return {!Promise<string>} Promise resolved with the appropriate plural
* strings for both messages, concatenated with a period+whitespace after
* the first message, and a period after the second message.
*/
getPluralStringTupleWithPeriods(
messageName1, itemCount1, messageName2, itemCount2) {}
}
/** @implements {PluralStringProxy} */
export class PluralStringProxyImpl {
/** @override */
getPluralString(messageName, itemCount) {
return sendWithPromise('getPluralString', messageName, itemCount);
}
/** @override */
getPluralStringTupleWithComma(
messageName1, itemCount1, messageName2, itemCount2) {
return sendWithPromise(
'getPluralStringTupleWithComma', messageName1, itemCount1, messageName2,
itemCount2);
}
/** @override */
getPluralStringTupleWithPeriods(
messageName1, itemCount1, messageName2, itemCount2) {
return sendWithPromise(
'getPluralStringTupleWithPeriods', messageName1, itemCount1,
messageName2, itemCount2);
}
}
addSingletonGetter(PluralStringProxyImpl);
|