Procházet zdrojové kódy

[RN] Translate AudioRoutePickerDialog

j8
Saúl Ibarra Corretgé před 7 roky
rodič
revize
81ac1bf4a5

+ 6
- 0
lang/main.json Zobrazit soubor

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

+ 16
- 9
react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js Zobrazit soubor

@@ -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_;

Načítá se…
Zrušit
Uložit