Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a839554
Update updateTranscript.js
hiroshisuga Apr 16, 2023
d236966
Create setTranslationLocale.js
hiroshisuga Apr 16, 2023
28b7a68
Update methods.js
hiroshisuga Apr 16, 2023
9b73c99
Update addUser.js
hiroshisuga Apr 16, 2023
33c5e41
Create updateTranslationLocale.js
hiroshisuga Apr 16, 2023
46dcb47
Update addUserPersistentData.js
hiroshisuga Apr 16, 2023
5fe5a77
Show caption button for mobile users (need revise)
hiroshisuga Apr 16, 2023
167744b
Update component.jsx
hiroshisuga Apr 16, 2023
78925b6
Update container.jsx
hiroshisuga Apr 16, 2023
2ad9dbf
Update styles.js
hiroshisuga Apr 16, 2023
5bb08f5
Update service.js
hiroshisuga Apr 16, 2023
bcb36ae
Update en.json
hiroshisuga Apr 16, 2023
940a3c3
Update settings.yml
hiroshisuga Apr 16, 2023
0fadd50
Update updateTranscript.js
hiroshisuga Apr 16, 2023
cd68a20
Update component.jsx
hiroshisuga Apr 16, 2023
5d92310
fix regexp
hiroshisuga Apr 16, 2023
207bca9
Update updateTranscript.js
hiroshisuga Apr 16, 2023
ebf448b
version2, creating translation db
hiroshisuga Apr 18, 2023
3f7c81d
fix regexp (again)
hiroshisuga Apr 18, 2023
56df9d8
fix regexp (one more)
hiroshisuga Apr 18, 2023
fe8bd99
Fix DeepL translation
hiroshisuga May 7, 2023
f5819c9
change to translation locale
hiroshisuga May 7, 2023
f698f5a
remove space
hiroshisuga May 7, 2023
3f55e0a
publish untranslated caption as well
hiroshisuga May 7, 2023
0796611
Delete orphan translations
hiroshisuga May 7, 2023
a095ee4
Revert updateTranscript.js
hiroshisuga May 13, 2023
4e86fd2
Merge pull request #195 from hiroshisuga/test265_translClient
hiroshisuga May 13, 2023
8a733e6
Translation on cilent
hiroshisuga May 13, 2023
fdce6df
revert del Null gen_webvtt
hiroshisuga May 13, 2023
cd1e8d3
add ffi-icu
hiroshisuga May 21, 2023
8c36611
add ffi-icu
hiroshisuga May 21, 2023
7e52943
翻訳を追加
hiroshisuga Jun 3, 2023
cdc19da
Google Translation locale without -XX
hiroshisuga Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default async function addUserPersistentData(user) {
sortName: String,
color: String,
speechLocale: String,
translationLocale: String,
mobile: Boolean,
breakoutProps: Object,
inactivityCheck: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions bigbluebutton-html5/imports/api/users/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
import validateAuthToken from './methods/validateAuthToken';
import setEmojiStatus from './methods/setEmojiStatus';
import setSpeechLocale from './methods/setSpeechLocale';
import setTranslationLocale from './methods/setTranslationLocale';
import setMobileUser from './methods/setMobileUser';
import assignPresenter from './methods/assignPresenter';
import changeRole from './methods/changeRole';
Expand All @@ -17,6 +18,7 @@ import setExitReason from './methods/setExitReason';
Meteor.methods({
setEmojiStatus,
setSpeechLocale,
setTranslationLocale,
setMobileUser,
assignPresenter,
changeRole,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import updateTranslationLocale from '../modifiers/updateTranslationLocale';
import { extractCredentials } from '/imports/api/common/server/helpers';

const LANGUAGES = Meteor.settings.public.app.audioCaptions.language.available;

export default function setTranslationLocale(locale) {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);

check(meetingId, String);
check(requesterUserId, String);
check(locale, String);

if (LANGUAGES.includes(locale) || locale === '') {
updateTranslationLocale(meetingId, requesterUserId, locale);
}
} catch (err) {
Logger.error(`Exception while invoking method setTranslationLocale ${err.stack}`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default async function addUser(meetingId, userData) {
meetingId,
sortName: lowercaseTrim(user.name),
speechLocale: '',
translationLocale: '',
mobile: false,
breakoutProps: {
isBreakoutUser: Meeting.meetingProp.isBreakout,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';

export default function updateTranslationLocale(meetingId, userId, locale) {
const selector = {
meetingId,
userId,
};

const modifier = {
$set: {
translationLocale: locale,
},
};

try {
const numberAffected = Users.update(selector, modifier);

if (numberAffected) {
Logger.info(`Updated translation locale=${locale} userId=${userId} meetingId=${meetingId}`);
}
} catch (err) {
Logger.error(`Updating translation locale: ${err}`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ class ActionsBar extends PureComponent {
<CaptionsButtonContainer {...{ intl }} />
)
: null}
{ !deviceInfo.isMobile
? (
<AudioCaptionsButtonContainer />
)
: null }
<AudioCaptionsButtonContainer />
</Styled.Left>
<Styled.Center>
<AudioControlsContainer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,22 @@ const intlMessages = defineMessages({
id: 'app.audio.captions.button.transcription',
description: 'Audio speech transcription label',
},
translation: {
id: 'app.audio.captions.button.translation',
description: 'Audio speech translation label',
},
transcriptionOn: {
id: 'app.switch.onLabel',
},
transcriptionOff: {
id: 'app.switch.offLabel',
},
translationOn: {
id: 'app.switch.onLabel',
},
translationOff: {
id: 'app.switch.offLabel',
},
language: {
id: 'app.audio.captions.button.language',
description: 'Audio speech recognition language label',
Expand Down Expand Up @@ -85,24 +95,39 @@ const CaptionsButton = ({
isRTL,
enabled,
currentSpeechLocale,
currentTranslationLocale,
availableVoices,
availableTranslations,
isSupported,
isVoiceUser,
}) => {
const isTranscriptionDisabled = () => (
currentSpeechLocale === DISABLED
);
const isTranslationDisabled = () => (
currentTranslationLocale === DISABLED
);

const isTranslationActivated = () => (
Meteor.settings.public.captions.enableAutomaticTranslation
);

const fallbackLocale = availableVoices.includes(navigator.language)
? navigator.language : DEFAULT_LOCALE;

const getSelectedLocaleValue = (isTranscriptionDisabled() ? fallbackLocale : currentSpeechLocale);
const getSelectedTranslationLocaleValue = (isTranslationDisabled() ? fallbackLocale : currentTranslationLocale);

const selectedLocale = useRef(getSelectedLocaleValue);
const selectedTranslationLocale = useRef(getSelectedTranslationLocaleValue);

useEffect(() => {
if (!isTranscriptionDisabled()) selectedLocale.current = getSelectedLocaleValue;
}, [currentSpeechLocale]);

useEffect(() => {
if (!isTranslationDisabled()) selectedTranslationLocale.current = getSelectedTranslationLocaleValue;
}, [currentTranslationLocale]);

if (!enabled) return null;

Expand All @@ -115,49 +140,88 @@ const CaptionsButton = ({
label: intl.formatMessage(intlMessages[availableVoice]),
key: availableVoice,
iconRight: selectedLocale.current === availableVoice ? 'check' : null,
customStyles: (selectedLocale.current === availableVoice) && Styled.SelectedLabel,
customStyles: (selectedLocale.current === availableVoice) ? Styled.SelectedLabel : Styled.NormalLabel,
disabled: isTranscriptionDisabled(),
dividerTop: availableVoice === availableVoices[0],
onClick: () => {
selectedLocale.current = availableVoice;
SpeechService.setSpeechLocale(selectedLocale.current);
},
}
))
);

const getAvailableTranslationLocales = () => (
availableTranslations.map((availableTranslation) => (
{
icon: '',
label: intl.formatMessage(intlMessages[availableTranslation]),
key: availableTranslation,
iconRight: selectedTranslationLocale.current === availableTranslation ? 'check' : null,
customStyles: (selectedTranslationLocale.current === availableTranslation) ? Styled.SelectedLabel : Styled.NormalLabel,
disabled: isTranscriptionDisabled() || isTranslationDisabled(),
onClick: () => {
selectedTranslationLocale.current = availableTranslation;
SpeechService.setTranslationLocale(selectedTranslationLocale.current);
},
}
))
);

const toggleTranscription = () => {
SpeechService.setSpeechLocale(isTranscriptionDisabled() ? selectedLocale.current : DISABLED);
};

const getAvailableLocalesList = () => (
[{
key: 'availableLocalesList',
label: intl.formatMessage(intlMessages.language),
customStyles: Styled.TitleLabel,
disabled: true,
dividerTop: false,
},
...getAvailableLocales(),
{
key: 'divider',
label: intl.formatMessage(intlMessages.transcription),
customStyles: Styled.TitleLabel,
disabled: true,
}, {
key: 'transcriptionStatus',
label: intl.formatMessage(
isTranscriptionDisabled()
? intlMessages.transcriptionOn
: intlMessages.transcriptionOff,
),
customStyles: isTranscriptionDisabled()
? Styled.EnableTrascription : Styled.DisableTrascription,
disabled: false,
dividerTop: true,
onClick: toggleTranscription,
}]
);
const toggleTranslation = () => {
SpeechService.setTranslationLocale(isTranslationDisabled() ? selectedTranslationLocale.current : DISABLED);
};

const getAvailableLocalesList = () => {
let items = [{
key: 'divider',
label: intl.formatMessage(intlMessages.transcription),
customStyles: Styled.TitleLabel,
disabled: true,
},
...getAvailableLocales(),
{
key: 'transcriptionStatus',
label: intl.formatMessage(
isTranscriptionDisabled()
? intlMessages.transcriptionOn
: intlMessages.transcriptionOff,
),
customStyles: isTranscriptionDisabled()
? Styled.EnableTrascription : Styled.DisableTrascription,
disabled: false,
onClick: toggleTranscription,
}];

if (isTranslationActivated()) {
items = items.concat([
{
key: 'divider',
label: intl.formatMessage(intlMessages.translation),
customStyles: Styled.TitleLabel,
disabled: true,
dividerTop: true,
},
...getAvailableTranslationLocales(),
{
key: 'translationStatus',
label: intl.formatMessage(
isTranslationDisabled()
? intlMessages.translationOn
: intlMessages.translationOff,
),
customStyles: isTranslationDisabled()
? Styled.EnableTraslation : Styled.DisableTraslation,
disabled: isTranscriptionDisabled(),
onClick: toggleTranslation,
}
]);
}
return items;
};

const onToggleClick = (e) => {
e.stopPropagation();
Expand Down Expand Up @@ -219,6 +283,7 @@ CaptionsButton.propTypes = {
isRTL: PropTypes.bool.isRequired,
enabled: PropTypes.bool.isRequired,
currentSpeechLocale: PropTypes.string.isRequired,
currentTranslationLocale: PropTypes.string.isRequired,
availableVoices: PropTypes.arrayOf(PropTypes.string).isRequired,
isSupported: PropTypes.bool.isRequired,
isVoiceUser: PropTypes.bool.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ const Container = (props) => <Button {...props} />;
export default withTracker(() => {
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
const availableVoices = SpeechService.getSpeechVoices();
const availableTranslations = SpeechService.getTranslations();
const currentSpeechLocale = SpeechService.getSpeechLocale();
const currentTranslationLocale = SpeechService.getTranslationLocale();
const isSupported = availableVoices.length > 0;
const isVoiceUser = AudioService.isVoiceUser();
return {
isRTL,
enabled: Service.hasAudioCaptions(),
active: Service.getAudioCaptions(),
currentSpeechLocale,
currentTranslationLocale,
availableVoices,
availableTranslations,
isSupported,
isVoiceUser,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,57 @@ const TranscriptionToggle = styled(Toggle)`
padding-left: 1em;
`;

const TranslationToggle = styled(Toggle)`
display: flex;
justify-content: flex-start;
padding-left: 1em;
`;

const TitleLabel = {
fontWeight: 'bold',
opacity: 1,
};

const EnableTrascription = {
color: colorSuccess,
textIndent: '1em',
};

const DisableTrascription = {
color: colorDangerDark,
textIndent: '1em',
};

const EnableTraslation = {
color: colorSuccess,
textIndent: '1em',
};

const DisableTraslation = {
color: colorDangerDark,
textIndent: '1em',
};

const NormalLabel = {
textIndent: '1em',
};

const SelectedLabel = {
color: colorPrimary,
backgroundColor: colorOffWhite,
textIndent: '1em',
};

export default {
ClosedCaptionToggleButton,
SpanButtonWrapper,
TranscriptionToggle,
TranslationToggle,
TitleLabel,
EnableTrascription,
DisableTrascription,
EnableTraslation,
DisableTraslation,
NormalLabel,
SelectedLabel,
};
Loading