[RN] Translate AudioRoutePickerDialog
This commit is contained in:
parent
81094ba7fd
commit
81ac1bf4a5
@ -9,6 +9,12 @@
|
|||||||
"raisedHand": "Would like to speak",
|
"raisedHand": "Would like to speak",
|
||||||
"defaultNickname": "ex. Jane Pink",
|
"defaultNickname": "ex. Jane Pink",
|
||||||
"defaultLink": "e.g. __url__",
|
"defaultLink": "e.g. __url__",
|
||||||
|
"audioDevices": {
|
||||||
|
"bluetooth": "Bluetooth",
|
||||||
|
"headphones": "Headphones",
|
||||||
|
"phone": "Phone",
|
||||||
|
"speaker": "Speaker"
|
||||||
|
},
|
||||||
"audioOnly": {
|
"audioOnly": {
|
||||||
"audioOnly": "Audio only",
|
"audioOnly": "Audio only",
|
||||||
"featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"
|
"featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import { NativeModules } from 'react-native';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { hideDialog, SimpleBottomSheet } from '../../../base/dialog';
|
import { hideDialog, SimpleBottomSheet } from '../../../base/dialog';
|
||||||
|
import { translate } from '../../../base/i18n';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code PasswordRequiredPrompt}'s React {@code Component} prop types.
|
* {@code PasswordRequiredPrompt}'s React {@code Component} prop types.
|
||||||
@ -15,7 +17,12 @@ type Props = {
|
|||||||
/**
|
/**
|
||||||
* Used for hiding the dialog when the selection was completed.
|
* Used for hiding the dialog when the selection was completed.
|
||||||
*/
|
*/
|
||||||
dispatch: Function
|
dispatch: Function,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked to obtain translated strings.
|
||||||
|
*/
|
||||||
|
t: Function
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@ -30,27 +37,26 @@ const { AudioMode } = NativeModules;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps each device type to a display name and icon.
|
* Maps each device type to a display name and icon.
|
||||||
* TODO i18n
|
|
||||||
*/
|
*/
|
||||||
const deviceInfoMap = {
|
const deviceInfoMap = {
|
||||||
BLUETOOTH: {
|
BLUETOOTH: {
|
||||||
iconName: 'bluetooth',
|
iconName: 'bluetooth',
|
||||||
text: 'Bluetooth',
|
text: 'audioDevices.bluetooth',
|
||||||
type: 'BLUETOOTH'
|
type: 'BLUETOOTH'
|
||||||
},
|
},
|
||||||
EARPIECE: {
|
EARPIECE: {
|
||||||
iconName: 'phone-talk',
|
iconName: 'phone-talk',
|
||||||
text: 'Phone',
|
text: 'audioDevices.phone',
|
||||||
type: 'EARPIECE'
|
type: 'EARPIECE'
|
||||||
},
|
},
|
||||||
HEADPHONES: {
|
HEADPHONES: {
|
||||||
iconName: 'headset',
|
iconName: 'headset',
|
||||||
text: 'Headphones',
|
text: 'audioDevices.headphones',
|
||||||
type: 'HEADPHONES'
|
type: 'HEADPHONES'
|
||||||
},
|
},
|
||||||
SPEAKER: {
|
SPEAKER: {
|
||||||
iconName: 'volume',
|
iconName: 'volume',
|
||||||
text: 'Speaker',
|
text: 'audioDevices.speaker',
|
||||||
type: 'SPEAKER'
|
type: 'SPEAKER'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -100,10 +106,11 @@ class AudioRoutePickerDialog extends Component<Props, State> {
|
|||||||
|
|
||||||
if (devices) {
|
if (devices) {
|
||||||
for (const device of 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.selected = device === selected;
|
||||||
|
info.text = this.props.t(info.text);
|
||||||
audioDevices.push(info);
|
audioDevices.push(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +186,7 @@ class AudioRoutePickerDialog extends Component<Props, State> {
|
|||||||
// Only export the dialog if we have support for getting / setting audio devices
|
// Only export the dialog if we have support for getting / setting audio devices
|
||||||
// in AudioMode.
|
// in AudioMode.
|
||||||
if (AudioMode.getAudioDevices && AudioMode.setAudioDevice) {
|
if (AudioMode.getAudioDevices && AudioMode.setAudioDevice) {
|
||||||
AudioRoutePickerDialog_ = connect()(AudioRoutePickerDialog);
|
AudioRoutePickerDialog_ = translate(connect()(AudioRoutePickerDialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AudioRoutePickerDialog_;
|
export default AudioRoutePickerDialog_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user