Parcourir la source

[RN] Translate AudioRoutePickerDialog

j8
Saúl Ibarra Corretgé il y a 7 ans
Parent
révision
81ac1bf4a5

+ 6
- 0
lang/main.json Voir le fichier

9
     "raisedHand": "Would like to speak",
9
     "raisedHand": "Would like to speak",
10
     "defaultNickname": "ex. Jane Pink",
10
     "defaultNickname": "ex. Jane Pink",
11
     "defaultLink": "e.g. __url__",
11
     "defaultLink": "e.g. __url__",
12
+    "audioDevices": {
13
+        "bluetooth": "Bluetooth",
14
+        "headphones": "Headphones",
15
+        "phone": "Phone",
16
+        "speaker": "Speaker"
17
+    },
12
     "audioOnly": {
18
     "audioOnly": {
13
         "audioOnly": "Audio only",
19
         "audioOnly": "Audio only",
14
         "featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"
20
         "featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"

+ 16
- 9
react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js Voir le fichier

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

Chargement…
Annuler
Enregistrer