Add lang to all fields based on chosen language

Reference: https://github.com/mastodon/mastodon/issues/19858
This commit is contained in:
Lim Chee Aun 2023-01-26 00:34:52 +08:00
parent a1e2207e96
commit f2d50b0bac

View file

@ -783,6 +783,7 @@ function Compose({
placeholder="Content warning" placeholder="Content warning"
disabled={uiState === 'loading'} disabled={uiState === 'loading'}
class="spoiler-text-field" class="spoiler-text-field"
lang={language}
style={{ style={{
opacity: sensitive ? 1 : 0, opacity: sensitive ? 1 : 0,
pointerEvents: sensitive ? 'auto' : 'none', pointerEvents: sensitive ? 'auto' : 'none',
@ -847,6 +848,7 @@ function Compose({
} }
required={mediaAttachments.length === 0} required={mediaAttachments.length === 0}
disabled={uiState === 'loading'} disabled={uiState === 'loading'}
lang={language}
onInput={() => { onInput={() => {
updateCharCount(); updateCharCount();
}} }}
@ -862,6 +864,7 @@ function Compose({
key={id || fileID || i} key={id || fileID || i}
attachment={attachment} attachment={attachment}
disabled={uiState === 'loading'} disabled={uiState === 'loading'}
lang={language}
onDescriptionChange={(value) => { onDescriptionChange={(value) => {
setMediaAttachments((attachments) => { setMediaAttachments((attachments) => {
const newAttachments = [...attachments]; const newAttachments = [...attachments];
@ -895,6 +898,7 @@ function Compose({
)} )}
{!!poll && ( {!!poll && (
<Poll <Poll
lang={language}
maxOptions={maxOptions} maxOptions={maxOptions}
maxExpiration={maxExpiration} maxExpiration={maxExpiration}
minExpiration={minExpiration} minExpiration={minExpiration}
@ -1235,6 +1239,7 @@ function CharCountMeter({ maxCharacters = 500 }) {
function MediaAttachment({ function MediaAttachment({
attachment, attachment,
disabled, disabled,
lang,
onDescriptionChange = () => {}, onDescriptionChange = () => {},
onRemove = () => {}, onRemove = () => {},
}) { }) {
@ -1274,6 +1279,7 @@ function MediaAttachment({
<textarea <textarea
ref={textareaRef} ref={textareaRef}
value={description || ''} value={description || ''}
lang={lang}
placeholder={ placeholder={
{ {
image: 'Image description', image: 'Image description',
@ -1368,6 +1374,7 @@ function MediaAttachment({
} }
function Poll({ function Poll({
lang,
poll, poll,
disabled, disabled,
onInput = () => {}, onInput = () => {},
@ -1390,6 +1397,7 @@ function Poll({
disabled={disabled} disabled={disabled}
maxlength={maxCharactersPerOption} maxlength={maxCharactersPerOption}
placeholder={`Choice ${i + 1}`} placeholder={`Choice ${i + 1}`}
lang={lang}
onInput={(e) => { onInput={(e) => {
const { value } = e.target; const { value } = e.target;
options[i] = value; options[i] = value;