Fix i18n warning on empty string
This commit is contained in:
parent
5daa820e4e
commit
b483d26488
1 changed files with 6 additions and 10 deletions
|
@ -60,7 +60,6 @@ export type DispatchProps = Readonly<{
|
||||||
export type Props = OwnProps & DispatchProps;
|
export type Props = OwnProps & DispatchProps;
|
||||||
|
|
||||||
type ButtonProps = {
|
type ButtonProps = {
|
||||||
i18n: LocalizerType;
|
|
||||||
variant: 'play' | 'playback-rate';
|
variant: 'play' | 'playback-rate';
|
||||||
mod?: string;
|
mod?: string;
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -129,7 +128,6 @@ const timeToText = (time: number): string => {
|
||||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
function ButtonInner(props, ref) {
|
function ButtonInner(props, ref) {
|
||||||
const {
|
const {
|
||||||
i18n,
|
|
||||||
variant,
|
variant,
|
||||||
mod,
|
mod,
|
||||||
label,
|
label,
|
||||||
|
@ -189,8 +187,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
onMouseUp={() => setIsDown(false)}
|
onMouseUp={() => setIsDown(false)}
|
||||||
onMouseLeave={() => setIsDown(false)}
|
onMouseLeave={() => setIsDown(false)}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
// eslint-disable-next-line local-rules/valid-i18n-keys
|
aria-label={label}
|
||||||
aria-label={i18n(label)}
|
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
@ -517,7 +514,6 @@ export function MessageAudio(props: Props): JSX.Element {
|
||||||
button = (
|
button = (
|
||||||
<Button
|
<Button
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
i18n={i18n}
|
|
||||||
variant="play"
|
variant="play"
|
||||||
mod="download"
|
mod="download"
|
||||||
label="MessageAudio--download"
|
label="MessageAudio--download"
|
||||||
|
@ -530,10 +526,11 @@ export function MessageAudio(props: Props): JSX.Element {
|
||||||
button = (
|
button = (
|
||||||
<Button
|
<Button
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
i18n={i18n}
|
|
||||||
variant="play"
|
variant="play"
|
||||||
mod={isPlaying ? 'pause' : 'play'}
|
mod={isPlaying ? 'pause' : 'play'}
|
||||||
label={isPlaying ? 'MessageAudio--pause' : 'MessageAudio--play'}
|
label={
|
||||||
|
isPlaying ? i18n('MessageAudio--pause') : i18n('MessageAudio--play')
|
||||||
|
}
|
||||||
animateClick={false}
|
animateClick={false}
|
||||||
onClick={toggleIsPlaying}
|
onClick={toggleIsPlaying}
|
||||||
/>
|
/>
|
||||||
|
@ -575,8 +572,7 @@ export function MessageAudio(props: Props): JSX.Element {
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="playback-rate"
|
variant="playback-rate"
|
||||||
i18n={i18n}
|
label={playbackRateLabels[active?.playbackRate ?? 1]}
|
||||||
label={(active && playbackRateLabels[active.playbackRate]) ?? ''}
|
|
||||||
visible={isPlaying && (!played || !isPlayedDotVisible)}
|
visible={isPlaying && (!played || !isPlayedDotVisible)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (active) {
|
if (active) {
|
||||||
|
@ -587,7 +583,7 @@ export function MessageAudio(props: Props): JSX.Element {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{active && playbackRateLabels[active.playbackRate]}
|
{playbackRateLabels[active?.playbackRate ?? 1]}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue