Add lang attribute to image description textarea and poll option field (#23293)
parent
d3f3810fe1
commit
2a4f2216d6
app/javascript/mastodon/features
compose
components
containers
ui/components
|
@ -25,6 +25,7 @@ class Option extends React.PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
|
lang: PropTypes.string,
|
||||||
index: PropTypes.number.isRequired,
|
index: PropTypes.number.isRequired,
|
||||||
isPollMultiple: PropTypes.bool,
|
isPollMultiple: PropTypes.bool,
|
||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
|
@ -72,7 +73,7 @@ class Option extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { isPollMultiple, title, index, autoFocus, intl } = this.props;
|
const { isPollMultiple, title, lang, index, autoFocus, intl } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
|
@ -91,6 +92,7 @@ class Option extends React.PureComponent {
|
||||||
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
|
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
|
||||||
maxLength={50}
|
maxLength={50}
|
||||||
value={title}
|
value={title}
|
||||||
|
lang={lang}
|
||||||
onChange={this.handleOptionTitleChange}
|
onChange={this.handleOptionTitleChange}
|
||||||
suggestions={this.props.suggestions}
|
suggestions={this.props.suggestions}
|
||||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
||||||
|
@ -116,6 +118,7 @@ class PollForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
options: ImmutablePropTypes.list,
|
options: ImmutablePropTypes.list,
|
||||||
|
lang: PropTypes.string,
|
||||||
expiresIn: PropTypes.number,
|
expiresIn: PropTypes.number,
|
||||||
isMultiple: PropTypes.bool,
|
isMultiple: PropTypes.bool,
|
||||||
onChangeOption: PropTypes.func.isRequired,
|
onChangeOption: PropTypes.func.isRequired,
|
||||||
|
@ -142,7 +145,7 @@ class PollForm extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { options, expiresIn, isMultiple, onChangeOption, onRemoveOption, intl, ...other } = this.props;
|
const { options, lang, expiresIn, isMultiple, onChangeOption, onRemoveOption, intl, ...other } = this.props;
|
||||||
|
|
||||||
if (!options) {
|
if (!options) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -153,7 +156,7 @@ class PollForm extends ImmutablePureComponent {
|
||||||
return (
|
return (
|
||||||
<div className='compose-form__poll-wrapper'>
|
<div className='compose-form__poll-wrapper'>
|
||||||
<ul>
|
<ul>
|
||||||
{options.map((title, i) => <Option title={title} key={i} index={i} onChange={onChangeOption} onRemove={onRemoveOption} isPollMultiple={isMultiple} onToggleMultiple={this.handleToggleMultiple} autoFocus={i === autoFocusIndex} {...other} />)}
|
{options.map((title, i) => <Option title={title} lang={lang} key={i} index={i} onChange={onChangeOption} onRemove={onRemoveOption} isPollMultiple={isMultiple} onToggleMultiple={this.handleToggleMultiple} autoFocus={i === autoFocusIndex} {...other} />)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className='poll__footer'>
|
<div className='poll__footer'>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
suggestions: state.getIn(['compose', 'suggestions']),
|
suggestions: state.getIn(['compose', 'suggestions']),
|
||||||
options: state.getIn(['compose', 'poll', 'options']),
|
options: state.getIn(['compose', 'poll', 'options']),
|
||||||
|
lang: state.getIn(['compose', 'language']),
|
||||||
expiresIn: state.getIn(['compose', 'poll', 'expires_in']),
|
expiresIn: state.getIn(['compose', 'poll', 'expires_in']),
|
||||||
isMultiple: state.getIn(['compose', 'poll', 'multiple']),
|
isMultiple: state.getIn(['compose', 'poll', 'multiple']),
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,6 +39,7 @@ const mapStateToProps = (state, { id }) => ({
|
||||||
account: state.getIn(['accounts', me]),
|
account: state.getIn(['accounts', me]),
|
||||||
isUploadingThumbnail: state.getIn(['compose', 'isUploadingThumbnail']),
|
isUploadingThumbnail: state.getIn(['compose', 'isUploadingThumbnail']),
|
||||||
description: state.getIn(['compose', 'media_modal', 'description']),
|
description: state.getIn(['compose', 'media_modal', 'description']),
|
||||||
|
lang: state.getIn(['compose', 'language']),
|
||||||
focusX: state.getIn(['compose', 'media_modal', 'focusX']),
|
focusX: state.getIn(['compose', 'media_modal', 'focusX']),
|
||||||
focusY: state.getIn(['compose', 'media_modal', 'focusY']),
|
focusY: state.getIn(['compose', 'media_modal', 'focusY']),
|
||||||
dirty: state.getIn(['compose', 'media_modal', 'dirty']),
|
dirty: state.getIn(['compose', 'media_modal', 'dirty']),
|
||||||
|
@ -274,7 +275,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { media, intl, account, onClose, isUploadingThumbnail, description, focusX, focusY, dirty, is_changing_upload } = this.props;
|
const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
|
||||||
const { dragging, detecting, progress, ocrStatus } = this.state;
|
const { dragging, detecting, progress, ocrStatus } = this.state;
|
||||||
const x = (focusX / 2) + .5;
|
const x = (focusX / 2) + .5;
|
||||||
const y = (focusY / -2) + .5;
|
const y = (focusY / -2) + .5;
|
||||||
|
@ -349,6 +350,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
id='upload-modal__description'
|
id='upload-modal__description'
|
||||||
className='setting-text light'
|
className='setting-text light'
|
||||||
value={detecting ? '…' : description}
|
value={detecting ? '…' : description}
|
||||||
|
lang={lang}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
onKeyDown={this.handleKeyDown}
|
onKeyDown={this.handleKeyDown}
|
||||||
disabled={detecting || is_changing_upload}
|
disabled={detecting || is_changing_upload}
|
||||||
|
|
Loading…
Reference in New Issue