From 81ac1bf4a5fe984c8a7da0a8a18f3b67812e35ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 20 Nov 2017 12:13:42 +0100 Subject: [PATCH] [RN] Translate AudioRoutePickerDialog --- lang/main.json | 6 +++++ .../components/AudioRoutePickerDialog.js | 25 ++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lang/main.json b/lang/main.json index a649df3c4..084e7675c 100644 --- a/lang/main.json +++ b/lang/main.json @@ -9,6 +9,12 @@ "raisedHand": "Would like to speak", "defaultNickname": "ex. Jane Pink", "defaultLink": "e.g. __url__", + "audioDevices": { + "bluetooth": "Bluetooth", + "headphones": "Headphones", + "phone": "Phone", + "speaker": "Speaker" + }, "audioOnly": { "audioOnly": "Audio only", "featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode" diff --git a/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js b/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js index bb2347c76..9f1c68876 100644 --- a/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js +++ b/react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js @@ -6,6 +6,8 @@ import { NativeModules } from 'react-native'; import { connect } from 'react-redux'; import { hideDialog, SimpleBottomSheet } from '../../../base/dialog'; +import { translate } from '../../../base/i18n'; + /** * {@code PasswordRequiredPrompt}'s React {@code Component} prop types. @@ -15,7 +17,12 @@ type Props = { /** * Used for hiding the dialog when the selection was completed. */ - dispatch: Function + dispatch: Function, + + /** + * Invoked to obtain translated strings. + */ + t: Function }; type State = { @@ -30,27 +37,26 @@ const { AudioMode } = NativeModules; /** * Maps each device type to a display name and icon. - * TODO i18n */ const deviceInfoMap = { BLUETOOTH: { iconName: 'bluetooth', - text: 'Bluetooth', + text: 'audioDevices.bluetooth', type: 'BLUETOOTH' }, EARPIECE: { iconName: 'phone-talk', - text: 'Phone', + text: 'audioDevices.phone', type: 'EARPIECE' }, HEADPHONES: { iconName: 'headset', - text: 'Headphones', + text: 'audioDevices.headphones', type: 'HEADPHONES' }, SPEAKER: { iconName: 'volume', - text: 'Speaker', + text: 'audioDevices.speaker', type: 'SPEAKER' } }; @@ -100,10 +106,11 @@ class AudioRoutePickerDialog extends Component { if (devices) { for (const device of devices) { - const info = deviceInfoMap[device]; + if (deviceInfoMap[device]) { + const info = Object.assign({}, deviceInfoMap[device]); - if (info) { info.selected = device === selected; + info.text = this.props.t(info.text); audioDevices.push(info); } } @@ -179,7 +186,7 @@ class AudioRoutePickerDialog extends Component { // Only export the dialog if we have support for getting / setting audio devices // in AudioMode. if (AudioMode.getAudioDevices && AudioMode.setAudioDevice) { - AudioRoutePickerDialog_ = connect()(AudioRoutePickerDialog); + AudioRoutePickerDialog_ = translate(connect()(AudioRoutePickerDialog)); } export default AudioRoutePickerDialog_;