Skip to content

Commit

Permalink
[TF][KILL] Google Translate without MLKit
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Dec 31, 2021
1 parent fd6cd48 commit 146793d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 33 deletions.
1 change: 0 additions & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies {
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1'
implementation 'org.osmdroid:osmdroid-android:6.1.10'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
Expand Down

This file was deleted.

7 changes: 3 additions & 4 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
import org.telegram.messenger.ForwardingMessagesParams;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LanguageDetector;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
Expand Down Expand Up @@ -20876,7 +20875,7 @@ public void onClick(View view) {
// "Translate" button
String toLang = LocaleController.getInstance().getCurrentLocale().getLanguage();
final CharSequence finalMessageText = messageText;
if (LanguageDetector.hasSupport()) {
/*if (LanguageDetector.hasSupport()) {
final String[] fromLang = { null };
cell.setVisibility(View.GONE);
waitForLangDetection.set(true);
Expand Down Expand Up @@ -20922,7 +20921,7 @@ public void onClick(View view) {
onLangDetectionDone.set(null);
}
}, 250);
} else {
} else {*/
cell.setOnClickListener(e -> {
if (selectedObject == null || i >= options.size() || getParentActivity() == null) {
return;
Expand All @@ -20936,7 +20935,7 @@ public void onClick(View view) {
scrimPopupWindow.dismiss();
}
});
}
//}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
import androidx.core.graphics.ColorUtils;
import androidx.core.widget.NestedScrollView;

import com.google.android.gms.vision.Frame;

import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LanguageDetector;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
Expand Down Expand Up @@ -438,8 +437,8 @@ public TranslateSettings(Context context) {
presentFragment(new RestrictedLanguagesSelectActivity());
update();
});
doNotTranslateCell.setClickable(value && LanguageDetector.hasSupport());
doNotTranslateCell.setAlpha(value && LanguageDetector.hasSupport() ? 1f : 0f);
doNotTranslateCell.setClickable(value && false);
doNotTranslateCell.setAlpha(value && false ? 1f : 0f);
addView(doNotTranslateCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

info = new TextInfoPrivacyCell(context);
Expand All @@ -451,7 +450,7 @@ public TranslateSettings(Context context) {
info2 = new TextInfoPrivacyCell(context);
info2.setTopPadding(0);
info2.setBottomPadding(16);
info2.setText(LocaleController.getString("TranslateMessagesInfo2", R.string.TranslateMessagesInfo2));
info2.setText("Telegram-FOSS does not support automatic detection of message language via Google MLKit. Google may have access to the messages you translate.");
info2.setAlpha(value ? 0f : 1f);
addView(info2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

Expand All @@ -478,7 +477,7 @@ private ArrayList<String> getRestrictedLanguages() {
}

public void update() {
boolean value = getValue() && LanguageDetector.hasSupport();
boolean value = getValue() && false;

showButtonCheck.setChecked(getValue());

Expand Down

2 comments on commit 146793d

@MatiasConTilde
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I have a few questions: Does this mean that Tg FOSS still uses google translate, but without language recognition? When I enable the option and translate a message, it correctly recognizes the language, how is it possible?

@thermatk
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google Translate has its own recognition logic

Please sign in to comment.