From 4db90b87f49a5062e5d1ff90d23f6d5635c7e124 Mon Sep 17 00:00:00 2001 From: sk Date: Fri, 17 Mar 2023 01:06:43 +0100 Subject: [PATCH] compare status lang to device locale re: sk22#458 --- .../android/ui/displayitems/TextStatusDisplayItem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java index c325336bf..a75ebc2fe 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java @@ -32,6 +32,7 @@ import org.joinmastodon.android.ui.utils.UiUtils; import org.joinmastodon.android.ui.views.LinkedTextView; import org.joinmastodon.android.utils.StatusTextEncoder; +import java.util.Locale; import java.util.regex.Pattern; import me.grishka.appkit.api.Callback; @@ -173,8 +174,8 @@ public class TextStatusDisplayItem extends StatusDisplayItem{ translateEnabled && !item.status.visibility.isLessVisibleThan(StatusPrivacy.UNLISTED) && item.status.language != null && - // todo: compare to user's locale instead (how do i query that?!) - (item.session.preferences == null || !item.status.language.equalsIgnoreCase(item.session.preferences.postingDefaultLanguage)))) + // todo: compare to mastodon locale instead (how do i query that?!) + !item.status.language.equalsIgnoreCase(Locale.getDefault().getLanguage()))) && (!GlobalUserPreferences.translateButtonOpenedOnly || item.textSelectable); translateWrap.setVisibility(translateVisible ? View.VISIBLE : View.GONE); translateButton.setText(item.translated ? R.string.sk_translate_show_original : R.string.sk_translate_post);