|
@@ -6,6 +6,8 @@ import { NativeModules } from 'react-native';
|
6
|
6
|
import { connect } from 'react-redux';
|
7
|
7
|
|
8
|
8
|
import { hideDialog, SimpleBottomSheet } from '../../../base/dialog';
|
|
9
|
+import { translate } from '../../../base/i18n';
|
|
10
|
+
|
9
|
11
|
|
10
|
12
|
/**
|
11
|
13
|
* {@code PasswordRequiredPrompt}'s React {@code Component} prop types.
|
|
@@ -15,7 +17,12 @@ type Props = {
|
15
|
17
|
/**
|
16
|
18
|
* Used for hiding the dialog when the selection was completed.
|
17
|
19
|
*/
|
18
|
|
- dispatch: Function
|
|
20
|
+ dispatch: Function,
|
|
21
|
+
|
|
22
|
+ /**
|
|
23
|
+ * Invoked to obtain translated strings.
|
|
24
|
+ */
|
|
25
|
+ t: Function
|
19
|
26
|
};
|
20
|
27
|
|
21
|
28
|
type State = {
|
|
@@ -30,27 +37,26 @@ const { AudioMode } = NativeModules;
|
30
|
37
|
|
31
|
38
|
/**
|
32
|
39
|
* Maps each device type to a display name and icon.
|
33
|
|
- * TODO i18n
|
34
|
40
|
*/
|
35
|
41
|
const deviceInfoMap = {
|
36
|
42
|
BLUETOOTH: {
|
37
|
43
|
iconName: 'bluetooth',
|
38
|
|
- text: 'Bluetooth',
|
|
44
|
+ text: 'audioDevices.bluetooth',
|
39
|
45
|
type: 'BLUETOOTH'
|
40
|
46
|
},
|
41
|
47
|
EARPIECE: {
|
42
|
48
|
iconName: 'phone-talk',
|
43
|
|
- text: 'Phone',
|
|
49
|
+ text: 'audioDevices.phone',
|
44
|
50
|
type: 'EARPIECE'
|
45
|
51
|
},
|
46
|
52
|
HEADPHONES: {
|
47
|
53
|
iconName: 'headset',
|
48
|
|
- text: 'Headphones',
|
|
54
|
+ text: 'audioDevices.headphones',
|
49
|
55
|
type: 'HEADPHONES'
|
50
|
56
|
},
|
51
|
57
|
SPEAKER: {
|
52
|
58
|
iconName: 'volume',
|
53
|
|
- text: 'Speaker',
|
|
59
|
+ text: 'audioDevices.speaker',
|
54
|
60
|
type: 'SPEAKER'
|
55
|
61
|
}
|
56
|
62
|
};
|
|
@@ -100,10 +106,11 @@ class AudioRoutePickerDialog extends Component<Props, State> {
|
100
|
106
|
|
101
|
107
|
if (devices) {
|
102
|
108
|
for (const device of devices) {
|
103
|
|
- const info = deviceInfoMap[device];
|
|
109
|
+ if (deviceInfoMap[device]) {
|
|
110
|
+ const info = Object.assign({}, deviceInfoMap[device]);
|
104
|
111
|
|
105
|
|
- if (info) {
|
106
|
112
|
info.selected = device === selected;
|
|
113
|
+ info.text = this.props.t(info.text);
|
107
|
114
|
audioDevices.push(info);
|
108
|
115
|
}
|
109
|
116
|
}
|
|
@@ -179,7 +186,7 @@ class AudioRoutePickerDialog extends Component<Props, State> {
|
179
|
186
|
// Only export the dialog if we have support for getting / setting audio devices
|
180
|
187
|
// in AudioMode.
|
181
|
188
|
if (AudioMode.getAudioDevices && AudioMode.setAudioDevice) {
|
182
|
|
- AudioRoutePickerDialog_ = connect()(AudioRoutePickerDialog);
|
|
189
|
+ AudioRoutePickerDialog_ = translate(connect()(AudioRoutePickerDialog));
|
183
|
190
|
}
|
184
|
191
|
|
185
|
192
|
export default AudioRoutePickerDialog_;
|