Bad Language Pair

So I have been testing out the Transcription/Translation feature. When it’s one way translation it seems to work fine. For example English to Japanese or Chinese (can be English to Japanese AND Chinese) and vice versa. But problems occur when it comes to two way translation. When I speak I would choose the option of my speech input as my own language for example English and at the same time I want to translate incoming speech from other participants as English. So I set transcript as well as translation to English. But then I got Bad Language Pair

2021-03-27 08:18:03.196 INFO: [29815] org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService.log() modeststormssinkon/5f105acc: sent 4500ms to speech API, for a total of 1 intervals with a total of 9 requests.
2021-03-27 08:18:03.402 WARNING: [29837] org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService.log() modeststormssinkon/5f105acc: received an error from the Google Cloud API
com.google.api.gax.rpc.CancelledException: io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:43)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
	at com.google.api.gax.grpc.ExceptionResponseObserver.onErrorImpl(ExceptionResponseObserver.java:82)
	at com.google.api.gax.rpc.StateCheckingResponseObserver.onError(StateCheckingResponseObserver.java:86)
	at com.google.api.gax.grpc.GrpcDirectStreamController$ResponseObserverAdapter.onClose(GrpcDirectStreamController.java:149)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:611)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:584)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.
	at io.grpc.Status.asRuntimeException(Status.java:533)
	... 23 more
Caused by: com.google.cloud.translate.TranslateException: Bad language pair: en|en
	at com.google.cloud.translate.spi.v2.HttpTranslateRpc.translate(HttpTranslateRpc.java:62)
	at com.google.cloud.translate.spi.v2.HttpTranslateRpc.translate(HttpTranslateRpc.java:156)
	at com.google.cloud.translate.TranslateImpl$4.call(TranslateImpl.java:124)
	at com.google.cloud.translate.TranslateImpl$4.call(TranslateImpl.java:121)
	at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105)
	at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
	at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at com.google.cloud.translate.TranslateImpl.translate(TranslateImpl.java:120)
	at com.google.cloud.translate.TranslateImpl.translate(TranslateImpl.java:138)
	at org.jitsi.jigasi.transcription.GoogleCloudTranslationService.translate(GoogleCloudTranslationService.java:60)
	at org.jitsi.jigasi.transcription.TranslationManager.getTranslations(TranslationManager.java:143)
	at org.jitsi.jigasi.transcription.TranslationManager.notify(TranslationManager.java:171)
	at org.jitsi.jigasi.transcription.Transcriber.notify(Transcriber.java:813)
	at org.jitsi.jigasi.transcription.Participant.notify(Participant.java:583)
	at org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService$ResponseApiStreamingObserver.sent(GoogleCloudTranscriptionService.java:1073)
	at org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService$ResponseApiStreamingObserver.handleResult(GoogleCloudTranscriptionService.java:1032)
	at org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService$ResponseApiStreamingObserver.onNext(GoogleCloudTranscriptionService.java:946)
	at org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService$ResponseApiStreamingObserver.onNext(GoogleCloudTranscriptionService.java:840)
	at com.google.api.gax.rpc.ApiStreamObserverAdapter.onResponseImpl(ApiStreamObserverAdapter.java:56)
	at com.google.api.gax.rpc.StateCheckingResponseObserver.onResponse(StateCheckingResponseObserver.java:62)
	at com.google.api.gax.tracing.TracedResponseObserver.onResponse(TracedResponseObserver.java:90)
	at com.google.api.gax.grpc.ExceptionResponseObserver.onResponseImpl(ExceptionResponseObserver.java:74)
	at com.google.api.gax.rpc.StateCheckingResponseObserver.onResponse(StateCheckingResponseObserver.java:62)
	at com.google.api.gax.grpc.GrpcDirectStreamController$ResponseObserverAdapter.onMessage(GrpcDirectStreamController.java:134)
	at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33)
	at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:599)
	... 9 more
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Bad language pair: en|en",
    "reason" : "badRequest"
  } ],
  "message" : "Bad language pair: en|en"
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:150)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:443)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1092)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:541)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
	at com.google.cloud.translate.spi.v2.HttpTranslateRpc.translate(HttpTranslateRpc.java:142)
	... 34 more

Can anyone explain the flow of the transcription/translation in jigasi? or can someone help give me insight or solution to this? Thank you in advance!

1 Like

@Pisethpanha_Chhean Can you please share how you are do to this point? I cant even get translation. Thank you for step by step.

I’m not sure where your progress is, it’s just that after you set up jitsi as well as jigasi (by researching) you can use APP.conference._room.setLocalParticipantProperty('translation_language','en'); to set translation, or this for transcription
APP.conference._room.setLocalParticipantProperty('transcription_language','ja-JP');

if you want to create a button to change this, i suggest you check the above reference.

1 Like

Updating: I am looking through this file (TranslationManager.java) i wonder if somehow I can add a logic where if the source lang == targetlang => dont translate (return or sth)

1 Like

@Pisethpanha_Chhean thank you for respond. I already make transcription it work fine. But what I no know is where I put that code in browser konsole if i want make translation.
Another thing is the google json the same for translation or i need make another type google json?

u put that here, also i don’t think u need to do anything else for translation
just right now i need to somehow get the language pair to not be conflicted

1 Like

Ok thank you very much I try that

1 Like

I guess here : jigasi/TranslationManager.java at d0073e3dc6857b17a5addf65b9c2c32082e8a83a · jitsi/jigasi · GitHub

Something like that:

String translatedText;
If (result.getParticipant().getSourceLanguage().equals(targetLanguage))
    translatedText = alternatives.iterator().next().getTranscription()
else
    translatedText = translationService.translate(
                    alternatives.iterator().next().getTranscription(),
                    result.getParticipant().getSourceLanguage(),
                    targetLanguage);
....
1 Like

Amazing!! Thank you so much!

but why my transcription when first clicked ‘cc’ button is not getting any default transcription (“English”) , unless i set the transcription lang via the command?

You might want to try the first point on Unable to invite transcriber due to no Jigasi instances being available - #72 by Prashanth

1 Like

The translation is something that was done for a gsoc, I think. We never got it to add UI and to use it.

1 Like

Okay, it’s fine now thank you!

I have try to clone it again one more time and it got the default language now.
I have made the UI changes for button to change language for my usage already.

1 Like

Thank you so much i have tried clone it again and it works now

1 Like

Any PRs are welcome, thank you.

3 Likes

Hi @damencho with this logic, the translation is working fine, but for transcription it would normally show the transcript faster (after spoken near real time ) now it will be waiting for the transcription to finish as well to show the original text