diff --git a/app/build.gradle b/app/build.gradle index 1b9361f..1b629df 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,8 +29,8 @@ android { defaultConfig { applicationId "nie.translator.rtranslator" targetSdkVersion 32 //32 - versionCode 16 - versionName '2.0.1' + versionCode 17 + versionName '2.0.2' minSdkVersion 24 externalNativeBuild { cmake { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index db2cdfd..586ee1c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/java/nie/translator/rtranslator/Global.java b/app/src/main/java/nie/translator/rtranslator/Global.java index 6ff9fe1..14aab96 100644 --- a/app/src/main/java/nie/translator/rtranslator/Global.java +++ b/app/src/main/java/nie/translator/rtranslator/Global.java @@ -51,6 +51,7 @@ public class Global extends Application implements DefaultLifecycleObserver { private ArrayList languages = new ArrayList<>(); + private ArrayList ttsLanguages = new ArrayList<>(); private CustomLocale language; private CustomLocale firstLanguage; private CustomLocale secondLanguage; @@ -117,16 +118,16 @@ public void onDestroyed() { }); } - public void getLanguages(final boolean recycleResult, boolean ignoreTTSError,final GetLocalesListListener responseListener) { + public void getLanguages(final boolean recycleResult, boolean ignoreTTSError, final GetLocalesListListener responseListener) { if (recycleResult && !languages.isEmpty()) { responseListener.onSuccess(languages); } else { - TTS.getSupportedLanguages(this, new TTS.SupportedLanguagesListener() { + TTS.getSupportedLanguages(this, new TTS.SupportedLanguagesListener() { //we load TTS languages to catch eventual TTS errors @Override public void onLanguagesListAvailable(ArrayList ttsLanguages) { ArrayList translatorLanguages = Translator.getSupportedLanguages(Global.this, Translator.NLLB); ArrayList speechRecognizerLanguages = Recognizer.getSupportedLanguages(Global.this); - //we return only the languages compatible with the speech recognizer, the translator and the tts + //we return only the languages compatible with the speech recognizer and the translator final ArrayList compatibleLanguages = new ArrayList<>(); for (CustomLocale translatorLanguage : translatorLanguages) { if (CustomLocale.containsLanguage(speechRecognizerLanguages, translatorLanguage)) { @@ -142,7 +143,7 @@ public void onError(int reason) { if(ignoreTTSError) { ArrayList translatorLanguages = Translator.getSupportedLanguages(Global.this, Translator.NLLB); ArrayList speechRecognizerLanguages = Recognizer.getSupportedLanguages(Global.this); - //we return only the languages compatible with the speech recognizer, the translator and the tts + //we return only the languages compatible with the speech recognizer and the translator (without loading TTS languages) final ArrayList compatibleLanguages = new ArrayList<>(); for (CustomLocale translatorLanguage : translatorLanguages) { if (CustomLocale.containsLanguage(speechRecognizerLanguages, translatorLanguage)) { @@ -159,6 +160,25 @@ public void onError(int reason) { } } + public void getTTSLanguages(final boolean recycleResult, final GetLocalesListListener responseListener){ + if(recycleResult && !ttsLanguages.isEmpty()){ + responseListener.onSuccess(ttsLanguages); + }else{ + TTS.getSupportedLanguages(this, new TTS.SupportedLanguagesListener() { //we load TTS languages to catch eventual TTS errors + @Override + public void onLanguagesListAvailable(ArrayList ttsLanguages) { + Global.this.ttsLanguages = ttsLanguages; + responseListener.onSuccess(ttsLanguages); + } + + @Override + public void onError(int reason) { + responseListener.onSuccess(new ArrayList<>()); + } + }); + } + } + public Translator getTranslator() { return translator; } diff --git a/app/src/main/java/nie/translator/rtranslator/settings/LanguagePreference.java b/app/src/main/java/nie/translator/rtranslator/settings/LanguagePreference.java index 9943bf1..515bad6 100644 --- a/app/src/main/java/nie/translator/rtranslator/settings/LanguagePreference.java +++ b/app/src/main/java/nie/translator/rtranslator/settings/LanguagePreference.java @@ -73,11 +73,21 @@ public void initializeLanguagesList() { global.getLanguage(false, new Global.GetLocaleListener() { @Override public void onSuccess(CustomLocale result) { - if (getSummary() == null || "".equals((String) getSummary())) { // to avoid changing the summary after a language change after the initializeLanguageList () call - setSummary(result.getDisplayName()); // if we have an error of lack of internet we simply don't insert the summary - } else if (summary != null && summary.equals((String) getSummary())) { - setSummary(result.getDisplayName()); // if we have an error of lack of internet we simply don't insert the summary - } + global.getTTSLanguages(false, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + if (getSummary() == null || "".equals((String) getSummary())) { // to avoid changing the summary after a language change after the initializeLanguageList () call + setSummary(result.getDisplayName(ttsLanguages)); // if we have an error of lack of internet we simply don't insert the summary + } else if (summary != null && summary.equals((String) getSummary())) { + setSummary(result.getDisplayName(ttsLanguages)); // if we have an error of lack of internet we simply don't insert the summary + } + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } @Override @@ -148,11 +158,21 @@ public void onItemClick(AdapterView parent, View view, final int position, lo global.getLanguages(true, true, new Global.GetLocalesListListener() { @Override public void onSuccess(ArrayList result) { - if (result.contains((CustomLocale) listView.getItem(position))) { - global.setLanguage((CustomLocale) listView.getItem(position)); - CustomLocale item=(CustomLocale) listView.getItem(position); - setSummary(item.getDisplayName()); - } + global.getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + if (result.contains((CustomLocale) listView.getItem(position))) { + global.setLanguage((CustomLocale) listView.getItem(position)); + CustomLocale item=(CustomLocale) listView.getItem(position); + setSummary(item.getDisplayName(ttsLanguages)); + } + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } @Override diff --git a/app/src/main/java/nie/translator/rtranslator/tools/CustomLocale.java b/app/src/main/java/nie/translator/rtranslator/tools/CustomLocale.java index 679d368..7e62f40 100644 --- a/app/src/main/java/nie/translator/rtranslator/tools/CustomLocale.java +++ b/app/src/main/java/nie/translator/rtranslator/tools/CustomLocale.java @@ -25,6 +25,8 @@ import java.util.MissingResourceException; import java.util.Set; +import nie.translator.rtranslator.Global; + public class CustomLocale implements Comparable, Serializable { @NonNull private Locale locale; @@ -153,14 +155,18 @@ public String getDisplayVariant(Locale inLocale) { return locale.getDisplayVariant(inLocale); } - public String getDisplayName() { - if (containsLanguage(TTS.ttsLanguages, CustomLocale.getInstance(locale.getLanguage()))) { + public String getDisplayName(ArrayList ttsLanguages) { + if (containsLanguage(ttsLanguages, CustomLocale.getInstance(locale.getLanguage()))) { return locale.getDisplayName(); } else { - return locale.getDisplayName()+" (no TTS)"; // Notice that users cannot use TTS for this language. + return locale.getDisplayName()+" (no TTS)"; // Notice that users cannot use TTS for this language. } } + public String getDisplayNameWithoutTTS() { + return locale.getDisplayName(); + } + public String getDisplayName(Locale locale) { return locale.getDisplayName(locale); /*String displayLanguage; @@ -179,7 +185,7 @@ public Object clone() { @Override public int compareTo(CustomLocale o) { - return getDisplayName().compareTo(((CustomLocale) o).getDisplayName()); + return getDisplayNameWithoutTTS().compareTo(((CustomLocale) o).getDisplayNameWithoutTTS()); } @Override @@ -195,7 +201,7 @@ public boolean equals(Object obj) { public boolean equalsLanguage(CustomLocale locale) { if (getLanguage() != null && locale != null && locale.getLanguage() != null) { - return getLanguage().equals(locale.getLanguage()); + return getISO3Language().equals(locale.getISO3Language()); } else { return false; } diff --git a/app/src/main/java/nie/translator/rtranslator/tools/TTS.java b/app/src/main/java/nie/translator/rtranslator/tools/TTS.java index 26041dc..466383f 100644 --- a/app/src/main/java/nie/translator/rtranslator/tools/TTS.java +++ b/app/src/main/java/nie/translator/rtranslator/tools/TTS.java @@ -38,6 +38,7 @@ public class TTS { private static Thread getSupportedLanguageThread; private static ArrayDeque supportedLanguagesListeners = new ArrayDeque<>(); private static final Object lock = new Object(); + private static final ArrayList ttsLanguages = new ArrayList<>(); public TTS(Context context, final InitListener listener) { @@ -181,8 +182,6 @@ private static void notifyGetSupportedLanguagesFailure(final int reasons) { } } - public static ArrayList ttsLanguages = new ArrayList<>(); - private static class GetSupportedLanguageRunnable implements Runnable { private SupportedLanguagesListener responseListener; private Context context; @@ -211,25 +210,25 @@ public void onInit() { } else { quality = Voice.QUALITY_NORMAL; } - boolean foundLanguage = false; // if there is available languages; keep false if our code cannot get its name + boolean foundLanguage = false; // if there is available languages if (set != null) { // we filter the languages that have a tts that reflects the quality characteristics we want for (Voice aSet : set) { - if (aSet.getQuality() >= quality && !aSet.getFeatures().contains("legacySetLanguageVoice")) { // - int i = aSet.getLocale().toString().indexOf("-"); + if (aSet.getQuality() >= quality && (qualityLow || !aSet.getFeatures().contains("legacySetLanguageVoice"))) { CustomLocale language; - if (i != -1) { + if(aSet.getLocale() != null){ language = new CustomLocale(aSet.getLocale()); // Use .getLocale() for google foundLanguage = true; - } else { + }else{ language = CustomLocale.getInstance(aSet.getName()); // Use .getName() for samsung/huawei (maybe others also) foundLanguage = true; } + ttsLanguages.add(language); } } } - if (foundLanguage) { // start TTS if the above lines find at least 1 supported language + if (foundLanguage) { // start TTS if the above lines find at least 1 supported language mainHandler.post(new Runnable() { @Override public void run() { @@ -237,22 +236,22 @@ public void run() { } }); } else { - onError(ErrorCodes.GOOGLE_TTS_ERROR); - } - tempTts.stop(); - tempTts.shutdown(); + onError(ErrorCodes.GOOGLE_TTS_ERROR); } + tempTts.stop(); + tempTts.shutdown(); + } - @Override - public void onError(final int reason) { - mainHandler.post(new Runnable() { - @Override - public void run() { - responseListener.onError(reason); - } - }); - } - }); + @Override + public void onError(final int reason) { + mainHandler.post(new Runnable() { + @Override + public void run() { + responseListener.onError(reason); + } + }); + } + }); } } diff --git a/app/src/main/java/nie/translator/rtranslator/tools/gui/LanguageListAdapter.java b/app/src/main/java/nie/translator/rtranslator/tools/gui/LanguageListAdapter.java index 7e04e3a..5451b47 100644 --- a/app/src/main/java/nie/translator/rtranslator/tools/gui/LanguageListAdapter.java +++ b/app/src/main/java/nie/translator/rtranslator/tools/gui/LanguageListAdapter.java @@ -23,6 +23,8 @@ import android.widget.BaseAdapter; import android.widget.TextView; import java.util.ArrayList; + +import nie.translator.rtranslator.Global; import nie.translator.rtranslator.R; import nie.translator.rtranslator.tools.CustomLocale; @@ -31,6 +33,8 @@ public class LanguageListAdapter extends BaseAdapter { private CustomLocale selectedLanguage; private Activity activity; private LayoutInflater inflater; + private boolean showTTSInfo = true; + private ArrayList ttsLanguages = new ArrayList<>(); public LanguageListAdapter(Activity activity, ArrayList languages, CustomLocale selectedLanguage) { this.activity = activity; @@ -38,6 +42,17 @@ public LanguageListAdapter(Activity activity, ArrayList languages, this.selectedLanguage = selectedLanguage; notifyDataSetChanged(); inflater = activity.getLayoutInflater(); + initializeTTSLanguageList(activity); + } + + public LanguageListAdapter(Activity activity, boolean showTTSInfo, ArrayList languages, CustomLocale selectedLanguage) { + this.activity = activity; + this.showTTSInfo = showTTSInfo; + this.languages = languages; + this.selectedLanguage = selectedLanguage; + notifyDataSetChanged(); + inflater = activity.getLayoutInflater(); + initializeTTSLanguageList(activity); } @Override @@ -79,7 +94,26 @@ public View getView(int position, View view, ViewGroup viewGroup) { } else { view.findViewById(R.id.isSelected).setVisibility(View.GONE); } - ((TextView) view.findViewById(R.id.languageName)).setText(item.getDisplayName()); + if(showTTSInfo){ + ((TextView) view.findViewById(R.id.languageName)).setText(item.getDisplayName(ttsLanguages)); + }else { + ((TextView) view.findViewById(R.id.languageName)).setText(item.getDisplayNameWithoutTTS()); + } return view; } + + private void initializeTTSLanguageList(Activity activity){ + Global global = (Global) activity.getApplication(); + global.getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + LanguageListAdapter.this.ttsLanguages = ttsLanguages; + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); + } } diff --git a/app/src/main/java/nie/translator/rtranslator/voice_translation/_conversation_mode/_conversation/ConversationService.java b/app/src/main/java/nie/translator/rtranslator/voice_translation/_conversation_mode/_conversation/ConversationService.java index 5ad80d1..8c008fc 100644 --- a/app/src/main/java/nie/translator/rtranslator/voice_translation/_conversation_mode/_conversation/ConversationService.java +++ b/app/src/main/java/nie/translator/rtranslator/voice_translation/_conversation_mode/_conversation/ConversationService.java @@ -22,6 +22,9 @@ import android.os.Looper; import android.util.Log; import androidx.annotation.NonNull; + +import java.util.ArrayList; + import nie.translator.rtranslator.Global; import nie.translator.rtranslator.tools.BluetoothHeadsetUtils; import nie.translator.rtranslator.tools.CustomLocale; @@ -166,14 +169,24 @@ public void onSuccess(CustomLocale result) { translator.translateMessage(conversationMessage, result, TRANSLATOR_BEAM_SIZE, new Translator.TranslateMessageListener() { @Override public void onTranslatedMessage(ConversationMessage conversationMessage, long messageID, boolean isFinal) { - if(isFinal && CustomLocale.containsLanguage(TTS.ttsLanguages, conversationMessage.getPayload().getLanguage())) { // check if the language can be speak - speak(conversationMessage.getPayload().getText(), conversationMessage.getPayload().getLanguage()); - } - message.setText(conversationMessage.getPayload().getText()); // updating the text with the new translated text (and without the language code) - GuiMessage guiMessage = new GuiMessage(message, messageID, false, true); - notifyMessage(guiMessage); - // we save every new message in the exchanged messages so that the fragment can restore them - addOrUpdateMessage(guiMessage); + global.getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + if(isFinal && CustomLocale.containsLanguage(ttsLanguages, conversationMessage.getPayload().getLanguage())) { // check if the language can be speak + speak(conversationMessage.getPayload().getText(), conversationMessage.getPayload().getLanguage()); + } + message.setText(conversationMessage.getPayload().getText()); // updating the text with the new translated text (and without the language code) + GuiMessage guiMessage = new GuiMessage(message, messageID, false, true); + notifyMessage(guiMessage); + // we save every new message in the exchanged messages so that the fragment can restore them + addOrUpdateMessage(guiMessage); + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } @Override diff --git a/app/src/main/java/nie/translator/rtranslator/voice_translation/_text_translation/TranslationFragment.java b/app/src/main/java/nie/translator/rtranslator/voice_translation/_text_translation/TranslationFragment.java index 4c2ae0c..327d396 100644 --- a/app/src/main/java/nie/translator/rtranslator/voice_translation/_text_translation/TranslationFragment.java +++ b/app/src/main/java/nie/translator/rtranslator/voice_translation/_text_translation/TranslationFragment.java @@ -382,7 +382,7 @@ public void onSuccess(final ArrayList languages) { progressBar.setVisibility(View.GONE); listViewGui.setVisibility(View.VISIBLE); - listView = new LanguageListAdapter(activity, languages, selectedLanguage); + listView = new LanguageListAdapter(activity, false, languages, selectedLanguage); listViewGui.setAdapter(listView); listViewGui.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -426,14 +426,14 @@ private void setFirstLanguage(CustomLocale language) { // save firstLanguage selected global.setFirstLanguage(language); // change language displayed - ((AnimatedTextView) firstLanguageSelector.findViewById(R.id.firstLanguageName)).setText(language.getDisplayName(), true); + ((AnimatedTextView) firstLanguageSelector.findViewById(R.id.firstLanguageName)).setText(language.getDisplayNameWithoutTTS(), true); } private void setSecondLanguage(CustomLocale language) { // save secondLanguage selected global.setSecondLanguage(language); // change language displayed - ((AnimatedTextView) secondLanguageSelector.findViewById(R.id.secondLanguageName)).setText(language.getDisplayName(), true); + ((AnimatedTextView) secondLanguageSelector.findViewById(R.id.secondLanguageName)).setText(language.getDisplayNameWithoutTTS(), true); } private void onFailureShowingList(int[] reasons, long value) { diff --git a/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieFragment.java b/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieFragment.java index ef195c4..30e5b5e 100644 --- a/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieFragment.java +++ b/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieFragment.java @@ -325,7 +325,17 @@ private void setFirstLanguage(CustomLocale language) { // save firstLanguage selected global.setFirstLanguage(language); // change language displayed - ((AnimatedTextView) firstLanguageSelector.findViewById(R.id.firstLanguageName)).setText(language.getDisplayName(), true); + global.getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + ((AnimatedTextView) firstLanguageSelector.findViewById(R.id.firstLanguageName)).setText(language.getDisplayName(ttsLanguages), true); + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } private void setSecondLanguage(CustomLocale language) { @@ -334,7 +344,17 @@ private void setSecondLanguage(CustomLocale language) { // save secondLanguage selected global.setSecondLanguage(language); // change language displayed - ((AnimatedTextView) secondLanguageSelector.findViewById(R.id.secondLanguageName)).setText(language.getDisplayName(), true); + global.getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + ((AnimatedTextView) secondLanguageSelector.findViewById(R.id.secondLanguageName)).setText(language.getDisplayName(ttsLanguages), true); + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } private void onFailureShowingList(int[] reasons, long value) { diff --git a/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieService.java b/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieService.java index b5fc00c..456553f 100644 --- a/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieService.java +++ b/app/src/main/java/nie/translator/rtranslator/voice_translation/_walkie_talkie_mode/_walkie_talkie/WalkieTalkieService.java @@ -173,18 +173,28 @@ public void onError(int[] reasons, long value) { firstResultTranslateListener = new Translator.TranslateListener() { @Override public void onTranslatedText(String text, long resultID, boolean isFinal, CustomLocale languageOfText) { - if(isFinal && CustomLocale.containsLanguage(TTS.ttsLanguages, languageOfText)) { // check if the text can be speak - speak(text, languageOfText); - } - GuiMessage message = new GuiMessage(new Message(WalkieTalkieService.this, text), resultID, true, isFinal); - WalkieTalkieService.super.notifyMessage(message); - // we save every new message in the exchanged messages so that the fragment can restore them - WalkieTalkieService.super.addOrUpdateMessage(message); - //if the tts is not active we restart the mic here - if(tts == null || !CustomLocale.containsLanguage(TTS.ttsLanguages, languageOfText) || !tts.isActive() || isAudioMute){ - startVoiceRecorder(); - notifyMicProgrammaticallyStarted(); - } + ((Global) getApplication()).getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + if(isFinal && CustomLocale.containsLanguage(ttsLanguages, languageOfText)) { // check if the text can be speak + speak(text, languageOfText); + } + GuiMessage message = new GuiMessage(new Message(WalkieTalkieService.this, text), resultID, true, isFinal); + WalkieTalkieService.super.notifyMessage(message); + // we save every new message in the exchanged messages so that the fragment can restore them + WalkieTalkieService.super.addOrUpdateMessage(message); + //if the tts is not active we restart the mic here + if(tts == null || !CustomLocale.containsLanguage(ttsLanguages, languageOfText) || !tts.isActive() || isAudioMute){ + startVoiceRecorder(); + notifyMicProgrammaticallyStarted(); + } + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } @Override @@ -200,18 +210,28 @@ public void onFailure(int[] reasons, long value) { secondResultTranslateListener = new Translator.TranslateListener() { @Override public void onTranslatedText(String text, long resultID, boolean isFinal, CustomLocale languageOfText) { - if(isFinal && CustomLocale.containsLanguage(TTS.ttsLanguages, languageOfText)) { // check if the text can be speak - speak(text, languageOfText); - } - GuiMessage message = new GuiMessage(new Message(WalkieTalkieService.this, text), resultID, false, isFinal); - WalkieTalkieService.super.notifyMessage(message); - // we save every new message in the exchanged messages so that the fragment can restore them - WalkieTalkieService.super.addOrUpdateMessage(message); - //if the tts is not active we restart the mic here - if(tts == null || !CustomLocale.containsLanguage(TTS.ttsLanguages, languageOfText) || !tts.isActive() || isAudioMute){ - startVoiceRecorder(); - notifyMicProgrammaticallyStarted(); - } + ((Global) getApplication()).getTTSLanguages(true, new Global.GetLocalesListListener() { + @Override + public void onSuccess(ArrayList ttsLanguages) { + if(isFinal && CustomLocale.containsLanguage(ttsLanguages, languageOfText)) { // check if the text can be speak + speak(text, languageOfText); + } + GuiMessage message = new GuiMessage(new Message(WalkieTalkieService.this, text), resultID, false, isFinal); + WalkieTalkieService.super.notifyMessage(message); + // we save every new message in the exchanged messages so that the fragment can restore them + WalkieTalkieService.super.addOrUpdateMessage(message); + //if the tts is not active we restart the mic here + if(tts == null || !CustomLocale.containsLanguage(ttsLanguages, languageOfText) || !tts.isActive() || isAudioMute){ + startVoiceRecorder(); + notifyMicProgrammaticallyStarted(); + } + } + + @Override + public void onFailure(int[] reasons, long value) { + //never called in this case + } + }); } @Override diff --git a/app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/voice/Recognizer.java b/app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/voice/Recognizer.java index 7a954b8..ea59f4c 100644 --- a/app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/voice/Recognizer.java +++ b/app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/voice/Recognizer.java @@ -606,6 +606,7 @@ public int getLanguageID(String language){ return START_TOKEN_ID + i + 1; } } + Log.e("error", "Error Converting Language code " + language + " to Whisper code"); return -1; } diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index ab7a8ec..63e25b3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -133,7 +133,7 @@ Seleziona il livello di volume che serve per avviare e mantenere il riconoscimento vocale Permette di supportare anche le lingue che hanno una bassa qualità del sintetizzatore vocale - Impostazioni di sistema del tts + Impostazioni di sistema del tts, un eventuale cambio del motore predefinito sarà applicato solo dopo il riavvio dell\'app Seleziona il tempo che deve trascorrere dopo aver smesso di parlare per inviare il testo trascritto Seleziona la durata della registrazione precedente a quando si inizia a parlare che verrà inclusa nel riconoscimento vocale \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2edc472..4018673 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -136,7 +136,7 @@ Select the volume level you need to start and maintain voice recognition It allow to also supports languages ​​that have a low quality speech synthesizer - System settings of tts + System settings of tts, an eventual change of the preferred engine will be applied only after the restart of the app Select the time after you stop talking to send the transcribed text Select the length of the recording before you start speaking that will be included in the voice recognition