Make sure screen name is internationalized
This commit is contained in:
parent
84aed82357
commit
56f0e1ba46
3 changed files with 54 additions and 8 deletions
|
@ -3384,7 +3384,17 @@
|
||||||
},
|
},
|
||||||
"calling__SelectPresentingSourcesModal--entireScreen": {
|
"calling__SelectPresentingSourcesModal--entireScreen": {
|
||||||
"message": "Entire screen",
|
"message": "Entire screen",
|
||||||
"description": "Title for the select your screen sharing sources modal"
|
"description": "Title for the select your screen sharing sources modal and 'Entire Screen' source"
|
||||||
|
},
|
||||||
|
"calling__SelectPresentingSourcesModal--screen": {
|
||||||
|
"message": "Screen $id$",
|
||||||
|
"description": "Title for `Screen #N` source in screen sharing sources modal and overlay",
|
||||||
|
"placeholders": {
|
||||||
|
"id": {
|
||||||
|
"content": "$1",
|
||||||
|
"example": "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"calling__SelectPresentingSourcesModal--window": {
|
"calling__SelectPresentingSourcesModal--window": {
|
||||||
"message": "A window",
|
"message": "A window",
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { LocalizerType } from '../types/Util';
|
||||||
import { Modal } from './Modal';
|
import { Modal } from './Modal';
|
||||||
import { PresentedSource, PresentableSource } from '../types/Calling';
|
import { PresentedSource, PresentableSource } from '../types/Calling';
|
||||||
import { Theme } from '../util/theme';
|
import { Theme } from '../util/theme';
|
||||||
|
import { isScreenSource, translateSourceName } from '../services/calling';
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
|
@ -17,14 +18,18 @@ export type PropsType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Source = ({
|
const Source = ({
|
||||||
|
i18n,
|
||||||
onSourceClick,
|
onSourceClick,
|
||||||
source,
|
source,
|
||||||
sourceToPresent,
|
sourceToPresent,
|
||||||
}: {
|
}: {
|
||||||
|
i18n: LocalizerType;
|
||||||
onSourceClick: (source: PresentedSource) => void;
|
onSourceClick: (source: PresentedSource) => void;
|
||||||
source: PresentableSource;
|
source: PresentableSource;
|
||||||
sourceToPresent?: PresentedSource;
|
sourceToPresent?: PresentedSource;
|
||||||
}): JSX.Element => {
|
}): JSX.Element => {
|
||||||
|
const name = translateSourceName(i18n, source);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={classNames({
|
className={classNames({
|
||||||
|
@ -42,14 +47,14 @@ const Source = ({
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt={source.name}
|
alt={name}
|
||||||
className="module-CallingSelectPresentingSourcesModal__name--screenshot"
|
className="module-CallingSelectPresentingSourcesModal__name--screenshot"
|
||||||
src={source.thumbnail}
|
src={source.thumbnail}
|
||||||
/>
|
/>
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__name--container">
|
<div className="module-CallingSelectPresentingSourcesModal__name--container">
|
||||||
{source.appIcon ? (
|
{source.appIcon ? (
|
||||||
<img
|
<img
|
||||||
alt={source.name}
|
alt={name}
|
||||||
className="module-CallingSelectPresentingSourcesModal__name--icon"
|
className="module-CallingSelectPresentingSourcesModal__name--icon"
|
||||||
height={16}
|
height={16}
|
||||||
src={source.appIcon}
|
src={source.appIcon}
|
||||||
|
@ -57,7 +62,7 @@ const Source = ({
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<span className="module-CallingSelectPresentingSourcesModal__name--text">
|
<span className="module-CallingSelectPresentingSourcesModal__name--text">
|
||||||
{source.name}
|
{name}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -77,9 +82,7 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
throw new Error('No sources available for presenting');
|
throw new Error('No sources available for presenting');
|
||||||
}
|
}
|
||||||
|
|
||||||
const sources = groupBy(presentingSourcesAvailable, source =>
|
const sources = groupBy(presentingSourcesAvailable, isScreenSource);
|
||||||
source.id.startsWith('screen')
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -98,6 +101,7 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
||||||
{sources.true.map(source => (
|
{sources.true.map(source => (
|
||||||
<Source
|
<Source
|
||||||
|
i18n={i18n}
|
||||||
key={source.id}
|
key={source.id}
|
||||||
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
||||||
source={source}
|
source={source}
|
||||||
|
@ -111,6 +115,7 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
||||||
{sources.false.map(source => (
|
{sources.false.map(source => (
|
||||||
<Source
|
<Source
|
||||||
|
i18n={i18n}
|
||||||
key={source.id}
|
key={source.id}
|
||||||
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
||||||
source={source}
|
source={source}
|
||||||
|
|
|
@ -48,6 +48,7 @@ import {
|
||||||
PresentableSource,
|
PresentableSource,
|
||||||
PresentedSource,
|
PresentedSource,
|
||||||
} from '../types/Calling';
|
} from '../types/Calling';
|
||||||
|
import { LocalizerType } from '../types/Util';
|
||||||
import { ConversationModel } from '../models/conversations';
|
import { ConversationModel } from '../models/conversations';
|
||||||
import {
|
import {
|
||||||
base64ToArrayBuffer,
|
base64ToArrayBuffer,
|
||||||
|
@ -89,6 +90,33 @@ enum GroupCallUpdateMessageState {
|
||||||
SentLeft,
|
SentLeft,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isScreenSource(source: PresentedSource): boolean {
|
||||||
|
return source.id.startsWith('screen');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function translateSourceName(
|
||||||
|
i18n: LocalizerType,
|
||||||
|
source: PresentedSource
|
||||||
|
): string {
|
||||||
|
const { name } = source;
|
||||||
|
if (!isScreenSource(source)) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'Entire Screen') {
|
||||||
|
return i18n('calling__SelectPresentingSourcesModal--entireScreen');
|
||||||
|
}
|
||||||
|
|
||||||
|
const match = name.match(/^Screen (\d+)$/);
|
||||||
|
if (match) {
|
||||||
|
return i18n('calling__SelectPresentingSourcesModal--screen', {
|
||||||
|
id: match[1],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
export class CallingClass {
|
export class CallingClass {
|
||||||
readonly videoCapturer: GumVideoCapturer;
|
readonly videoCapturer: GumVideoCapturer;
|
||||||
|
|
||||||
|
@ -954,7 +982,10 @@ export class CallingClass {
|
||||||
this.setOutgoingVideoIsScreenShare(call, isPresenting);
|
this.setOutgoingVideoIsScreenShare(call, isPresenting);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
ipcRenderer.send('show-screen-share', source.name);
|
ipcRenderer.send(
|
||||||
|
'show-screen-share',
|
||||||
|
translateSourceName(window.i18n, source)
|
||||||
|
);
|
||||||
notify({
|
notify({
|
||||||
icon: 'images/icons/v2/video-solid-24.svg',
|
icon: 'images/icons/v2/video-solid-24.svg',
|
||||||
message: window.i18n('calling__presenting--notification-body'),
|
message: window.i18n('calling__presenting--notification-body'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue