Merge branch 'develop'

This commit is contained in:
Thomas 2022-12-27 17:43:00 +01:00
commit 7dfedbdaa4
20 changed files with 334 additions and 160 deletions

View file

@ -13,8 +13,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 33
versionCode 454
versionName "3.13.0"
versionCode 455
versionName "3.13.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "default"

View file

@ -1,4 +1,9 @@
[
{
"version": "3.13.1",
"code": "455",
"note": "Added:\n- DeepL translation support free/pro keys\n\nChanged:\n- Hide buttons for media when editing\n\nFixed:\n- GIF loaded as static images\n- Suggested accounts cannot be followed"
},
{
"version": "3.13.0",
"code": "454",

View file

@ -21,14 +21,12 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
@ -44,15 +42,8 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.ViewPager;
import com.github.stom79.mytransl.MyTransL;
import com.github.stom79.mytransl.client.HttpsConnectionException;
import com.github.stom79.mytransl.client.Results;
import com.github.stom79.mytransl.translate.Params;
import com.github.stom79.mytransl.translate.Translate;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@ -63,6 +54,7 @@ import app.fedilab.android.client.entities.api.Status;
import app.fedilab.android.databinding.ActivityMediaPagerBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MediaHelper;
import app.fedilab.android.helper.TranslateHelper;
import app.fedilab.android.interfaces.OnDownloadInterface;
import app.fedilab.android.ui.fragment.media.FragmentMedia;
import es.dmoral.toasty.Toasty;
@ -157,40 +149,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
binding.mediaDescription.setText(description);
binding.translate.setOnClickListener(v -> {
String descriptionToTranslate = attachments.get(mediaPosition - 1).description;
MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE;
final MyTransL myTransL = MyTransL.getInstance(et);
myTransL.setObfuscation(true);
Params params = new Params();
params.setSplit_sentences(false);
params.setFormat(Params.fType.TEXT);
params.setSource_lang("auto");
myTransL.setLibretranslateDomain("translate.fedilab.app");
String statusToTranslate;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
statusToTranslate = Html.fromHtml(descriptionToTranslate, Html.FROM_HTML_MODE_LEGACY).toString();
else
statusToTranslate = Html.fromHtml(descriptionToTranslate).toString();
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(MediaActivity.this);
String translate = sharedpreferences.getString(getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
if (translate != null && translate.equalsIgnoreCase("default")) {
translate = MyTransL.getLocale();
}
myTransL.translate(statusToTranslate, translate, params, new Results() {
@Override
public void onSuccess(Translate translate) {
if (translate.getTranslatedContent() != null) {
attachments.get(mediaPosition - 1).translation = translate.getTranslatedContent();
binding.mediaDescriptionTranslated.setText(translate.getTranslatedContent());
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE);
} else {
Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFail(HttpsConnectionException httpsConnectionException) {
TranslateHelper.translate(MediaActivity.this, descriptionToTranslate, translated -> {
if (translated != null) {
attachments.get(mediaPosition - 1).translation = translated;
binding.mediaDescriptionTranslated.setText(translated);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE);
} else {
Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
});
});
@ -222,40 +188,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
}
binding.translate.setOnClickListener(v -> {
String descriptionToTranslate = attachments.get(position).description;
MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE;
final MyTransL myTransL = MyTransL.getInstance(et);
myTransL.setObfuscation(true);
Params params = new Params();
params.setSplit_sentences(false);
params.setFormat(Params.fType.TEXT);
params.setSource_lang("auto");
myTransL.setLibretranslateDomain("translate.fedilab.app");
String statusToTranslate;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
statusToTranslate = Html.fromHtml(descriptionToTranslate, Html.FROM_HTML_MODE_LEGACY).toString();
else
statusToTranslate = Html.fromHtml(descriptionToTranslate).toString();
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(MediaActivity.this);
String translate = sharedpreferences.getString(getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
if (translate != null && translate.equalsIgnoreCase("default")) {
translate = MyTransL.getLocale();
}
myTransL.translate(statusToTranslate, translate, params, new Results() {
@Override
public void onSuccess(Translate translate) {
if (translate.getTranslatedContent() != null) {
attachments.get(position).translation = translate.getTranslatedContent();
binding.mediaDescriptionTranslated.setText(translate.getTranslatedContent());
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE);
} else {
Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFail(HttpsConnectionException httpsConnectionException) {
TranslateHelper.translate(MediaActivity.this, descriptionToTranslate, translated -> {
if (translated != null) {
attachments.get(position).translation = translated;
binding.mediaDescriptionTranslated.setText(translated);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE);
} else {
Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
});
});

View file

@ -124,14 +124,17 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
import java.util.regex.Matcher;
@ -1236,7 +1239,8 @@ public class Helper {
counter++;
Date now = new Date();
attachment.filename = formatter.format(now) + "." + extension;
if (attachment.mimeType.startsWith("image")) {
Set<String> imageType = new HashSet<>(Arrays.asList("image/png", "image/jpeg", "image/jpg"));
if (imageType.contains(attachment.mimeType)) {
final File certCacheDir = new File(context.getCacheDir(), TEMP_MEDIA_DIRECTORY);
boolean isCertCacheDirExists = certCacheDir.exists();
if (!isCertCacheDirExists) {

View file

@ -0,0 +1,91 @@
package app.fedilab.android.helper;
/* Copyright 2022 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.Html;
import android.widget.Toast;
import androidx.preference.PreferenceManager;
import com.github.stom79.mytransl.MyTransL;
import com.github.stom79.mytransl.client.HttpsConnectionException;
import com.github.stom79.mytransl.client.Results;
import com.github.stom79.mytransl.translate.Params;
import app.fedilab.android.R;
import es.dmoral.toasty.Toasty;
public class TranslateHelper {
public static void translate(Context context, String toTranslate, Translate callback) {
String statusToTranslate;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
statusToTranslate = Html.fromHtml(toTranslate, Html.FROM_HTML_MODE_LEGACY).toString();
else
statusToTranslate = Html.fromHtml(toTranslate).toString();
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
String translator = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR), "FEDILAB");
MyTransL.translatorEngine et;
if (translator.compareToIgnoreCase("FEDILAB") == 0) {
et = MyTransL.translatorEngine.LIBRETRANSLATE;
} else {
et = MyTransL.translatorEngine.DEEPL;
}
final MyTransL myTransL = MyTransL.getInstance(et);
myTransL.setObfuscation(true);
Params params = new Params();
params.setSplit_sentences(false);
params.setFormat(Params.fType.TEXT);
params.setSource_lang("auto");
if (translator.compareToIgnoreCase("FEDILAB") == 0) {
myTransL.setLibretranslateDomain("translate.fedilab.app");
} else {
String translatorVersion = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_VERSION), "PRO");
params.setPro(translatorVersion.equals("PRO"));
String apikey = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_API_KEY), null);
myTransL.setDeeplAPIKey(apikey.trim());
}
String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
if (translate.equalsIgnoreCase("default")) {
translate = MyTransL.getLocale();
}
myTransL.translate(statusToTranslate, translate, params, new Results() {
@Override
public void onSuccess(com.github.stom79.mytransl.translate.Translate translate) {
if (translate.getTranslatedContent() != null) {
callback.onTranslate(translate.getTranslatedContent());
} else {
callback.onTranslate("");
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFail(HttpsConnectionException httpsConnectionException) {
callback.onTranslate("");
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
});
}
public interface Translate {
void onTranslate(String translated);
}
}

View file

@ -1021,6 +1021,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
for (Attachment attachment : attachmentList) {
ComposeAttachmentItemBinding composeAttachmentItemBinding = ComposeAttachmentItemBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false);
composeAttachmentItemBinding.buttonPlay.setVisibility(View.GONE);
if (editMessageId != null) {
composeAttachmentItemBinding.editPreview.setVisibility(View.INVISIBLE);
composeAttachmentItemBinding.buttonDescription.setVisibility(View.INVISIBLE);
composeAttachmentItemBinding.buttonOrderDown.setVisibility(View.INVISIBLE);
composeAttachmentItemBinding.buttonOrderUp.setVisibility(View.INVISIBLE);
composeAttachmentItemBinding.buttonRemove.setVisibility(View.INVISIBLE);
}
String attachmentPath = attachment.local_path != null && !attachment.local_path.trim().isEmpty() ? attachment.local_path : attachment.preview_url;
if (attachment.type != null || attachment.mimeType != null) {
if ((attachment.type != null && attachment.type.toLowerCase().startsWith("image")) || (attachment.mimeType != null && attachment.mimeType.toLowerCase().startsWith("image"))) {

View file

@ -16,28 +16,21 @@ package app.fedilab.android.ui.drawer;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import com.github.stom79.mytransl.MyTransL;
import com.github.stom79.mytransl.client.HttpsConnectionException;
import com.github.stom79.mytransl.client.Results;
import com.github.stom79.mytransl.translate.Params;
import com.github.stom79.mytransl.translate.Translate;
import java.util.List;
import java.util.Locale;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.app.ReleaseNote;
import app.fedilab.android.databinding.DrawerReleaseNoteBinding;
import app.fedilab.android.helper.TranslateHelper;
import es.dmoral.toasty.Toasty;
@ -81,37 +74,14 @@ public class ReleaseNoteAdapter extends RecyclerView.Adapter<ReleaseNoteAdapter.
holder.binding.containerTrans.setVisibility(View.GONE);
holder.binding.translate.setVisibility(View.VISIBLE);
}
holder.binding.translate.setOnClickListener(v -> {
MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE;
final MyTransL myTransL = MyTransL.getInstance(et);
myTransL.setObfuscation(true);
Params params = new Params();
params.setSplit_sentences(false);
params.setFormat(Params.fType.TEXT);
params.setSource_lang("auto");
myTransL.setLibretranslateDomain("translate.fedilab.app");
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
if (translate != null && translate.equalsIgnoreCase("default")) {
translate = MyTransL.getLocale();
holder.binding.translate.setOnClickListener(v -> TranslateHelper.translate(context, note.note, translated -> {
if (translated != null) {
note.noteTranslated = translated;
notifyItemChanged(holder.getBindingAdapterPosition());
} else {
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
myTransL.translate(note.note, translate, params, new Results() {
@Override
public void onSuccess(Translate translate) {
if (translate.getTranslatedContent() != null) {
note.noteTranslated = translate.getTranslatedContent();
notifyItemChanged(holder.getBindingAdapterPosition());
} else {
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFail(HttpsConnectionException httpsConnectionException) {
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
});
});
}));
}

View file

@ -87,10 +87,6 @@ import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.github.stom79.mytransl.MyTransL;
import com.github.stom79.mytransl.client.HttpsConnectionException;
import com.github.stom79.mytransl.client.Results;
import com.github.stom79.mytransl.translate.Params;
import com.github.stom79.mytransl.translate.Translate;
import com.vanniktech.emoji.EmojiManager;
import com.vanniktech.emoji.EmojiPopup;
import com.vanniktech.emoji.one.EmojiOneProvider;
@ -145,6 +141,7 @@ import app.fedilab.android.helper.MediaHelper;
import app.fedilab.android.helper.SpannableHelper;
import app.fedilab.android.helper.ThemeHelper;
import app.fedilab.android.helper.TimelineHelper;
import app.fedilab.android.helper.TranslateHelper;
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonContext;
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
import app.fedilab.android.viewmodel.mastodon.SearchVM;
@ -1982,6 +1979,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
private static void translate(Context context, Status statusToDeal,
StatusViewHolder holder,
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) {
@ -1990,40 +1988,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
statusToTranslate = Html.fromHtml(statusToDeal.content, Html.FROM_HTML_MODE_LEGACY).toString();
else
statusToTranslate = Html.fromHtml(statusToDeal.content).toString();
int countMorseChar = ComposeAdapter.countMorseChar(statusToTranslate);
if (countMorseChar < 4) {
MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE;
final MyTransL myTransL = MyTransL.getInstance(et);
myTransL.setObfuscation(true);
Params params = new Params();
params.setSplit_sentences(false);
params.setFormat(Params.fType.TEXT);
params.setSource_lang("auto");
myTransL.setLibretranslateDomain("translate.fedilab.app");
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale());
if (translate != null && translate.equalsIgnoreCase("default")) {
translate = MyTransL.getLocale();
}
myTransL.translate(statusToTranslate, translate, params, new Results() {
@Override
public void onSuccess(Translate translate) {
if (translate.getTranslatedContent() != null) {
statusToDeal.translationShown = true;
statusToDeal.translationContent = translate.getTranslatedContent();
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
} else {
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFail(HttpsConnectionException httpsConnectionException) {
TranslateHelper.translate(context, statusToDeal.content, translated -> {
if (translated != null) {
statusToDeal.translationShown = true;
statusToDeal.translationContent = translated;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
} else {
Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show();
}
});
} else {

View file

@ -109,7 +109,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
new WeakReference<>(holder.binding.bio)),
TextView.BufferType.SPANNABLE);
holder.binding.followAction.setEnabled(false);
holder.binding.followAction.setOnClickListener(v -> {
suggestionList.remove(position);
notifyItemRemoved(position);

View file

@ -17,9 +17,11 @@ package app.fedilab.android.ui.fragment.settings;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import app.fedilab.android.R;
import app.fedilab.android.helper.Helper;
@ -33,10 +35,31 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen
}
private void createPref() {
getPreferenceScreen().removeAll();
addPreferencesFromResource(R.xml.pref_timelines);
PreferenceScreen preferenceScreen = getPreferenceScreen();
ListPreference SET_LOAD_MEDIA_TYPE = findPreference(getString(R.string.SET_LOAD_MEDIA_TYPE));
if (SET_LOAD_MEDIA_TYPE != null) {
SET_LOAD_MEDIA_TYPE.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_TRANSLATOR = findPreference(getString(R.string.SET_TRANSLATOR));
if (SET_TRANSLATOR != null) {
SET_TRANSLATOR.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_TRANSLATOR_VERSION = findPreference(getString(R.string.SET_TRANSLATOR_VERSION));
if (SET_TRANSLATOR_VERSION != null) {
SET_TRANSLATOR_VERSION.getContext().setTheme(Helper.dialogStyle());
}
EditTextPreference SET_TRANSLATOR_API_KEY = findPreference(getString(R.string.SET_TRANSLATOR_API_KEY));
if (SET_TRANSLATOR != null && SET_TRANSLATOR.getValue().equals("FEDILAB")) {
if (SET_TRANSLATOR_API_KEY != null) {
preferenceScreen.removePreferenceRecursively("SET_TRANSLATOR_API_KEY");
}
if (SET_TRANSLATOR_VERSION != null) {
preferenceScreen.removePreferenceRecursively("SET_TRANSLATOR_VERSION");
}
}
}
@Override
@ -44,8 +67,10 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen
if (getActivity() != null) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.apply();
if (key.compareToIgnoreCase(getString(R.string.SET_TRANSLATOR)) == 0) {
createPref();
}
}
}

View file

@ -106,7 +106,9 @@
android:layout_marginTop="6dp"
android:insetTop="0dp"
android:insetBottom="0dp"
android:padding="6dp"
android:padding="0dp"
app:iconGravity="textStart"
app:iconPadding="0dp"
app:icon="@drawable/ic_baseline_person_add_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/bio" />

View file

@ -942,4 +942,8 @@
<string name="add_all_users_home_muted">Přidat všechny uživatele pro ztlumený domov</string>
<string name="display">Zobrazit</string>
<string name="group_reblogs">Seskupovat reblogy v domovské časové ose</string>
<string name="manage_accounts">Spravovat účty</string>
<string name="report_all_more">Vyberte vše, co vyhovuje</string>
<string name="set_remove_left_margin_title">Odstranit levý okraj</string>
<string name="set_remove_left_margin">Odstranit v časových osách levý okraj, aby se zprávy zobrazovaly kompaktněji</string>
</resources>

View file

@ -931,4 +931,6 @@
<string name="muted_menu_home">Usuarias acalas en Inicio</string>
<string name="group_reblogs">Comparticións para o grupo no Inicio</string>
<string name="manage_accounts">Xestionar contas</string>
<string name="set_remove_left_margin_title">Eliminar marxe esquerda</string>
<string name="set_remove_left_margin">Eliminar a marxe esquerda nas cronoloxías para compactar máis as mensaxes</string>
</resources>

View file

@ -859,4 +859,74 @@
<string name="delete_timeline">タイムラインの削除</string>
<string name="notif_submitted_report">レポートを送信しました</string>
<string name="notif_signed_up">登録しました</string>
<string name="import_data">データをインポート</string>
<string name="admin_reject_reports">通報を却下</string>
<string name="set_notif_update">新着情報の通知</string>
<string name="set_notif_admin_report">新しい通報(モデレーター)</string>
<string name="channel_notif_update">新着情報</string>
<string name="channel_notif_signup">新規登録</string>
<string name="channel_notif_report">新しい通報</string>
<string name="notif_update_push">あなたが共有した投稿が編集されました</string>
<string name="notif_sign_up">ユーザーが登録しました</string>
<string name="notif_report">ユーザーが通報しました</string>
<string name="sign_ups">新規登録</string>
<string name="mute_tag">タグ %1$s をブロックしますか?</string>
<string name="admin_reject_media">メディアファイルを拒否</string>
<string name="admin_domainblock_reject_media">このドメインからの通報を全て無視します。サスペンドとは無関係です</string>
<string name="type_of_theme">テーマのモードを選択</string>
<string name="cark_custom_colors">ダーク - カスタムカラー</string>
<string name="light_custom_colors">ライト - カスタムカラー</string>
<string name="unmute_tag_action">タグのミュートを解除</string>
<string name="mute_tag_action">タグをミュート</string>
<string name="display_remote_conversation">リモートの会話を表示</string>
<string name="pin_tag">タグのピン留め</string>
<string name="unpin_tag">タグのピン留めを解除</string>
<string name="unmute_home">ホームでのミュートを解除</string>
<string name="severity">重大性</string>
<string name="admin_domainblock_severity">サイレンスするとそのアカウントの投稿がフォローしていないユーザーから見えなくなります。サスペンドはそのアカウントのコンテンツやメディア、プロフィール情報などが全て削除されます。メディアファイルを拒否したいだけの場合は「なし」を使用してください。</string>
<string name="type_default_theme_dark">デフォルトのダークテーマ</string>
<string name="type_default_theme_light">デフォルトのライトテーマ</string>
<string name="muted_menu_home">ホームのミュートしたユーザー</string>
<string name="keep_notifications">通知を消去しない</string>
<string name="set_dynamic_color">ダイナミックカラー</string>
<string name="set_dynamic_color_indication">個人設定の壁紙の配色に合わせます。</string>
<string name="set_display_translate_indication">翻訳ボタンを常に表示します</string>
<string name="reject_reports">通報を却下</string>
<string name="admin_reject_obfuscate">ドメイン名の難読化</string>
<string name="public_comment">公開コメント</string>
<string name="saved_changes">変更が保存されました!</string>
<string name="create_domain_block">ドメインブロックを追加</string>
<string name="pref_customize">色のカスタマイズ</string>
<string name="pref_customize_summary">テーマのカスタムカラーを設定することができます。</string>
<string name="set_cardview">高さのあるカード</string>
<string name="set_customize_light">ライトテーマのカスタマイズ</string>
<string name="set_customize_dark">ダークテーマのカスタマイズ</string>
<string name="set_custom_colors">カスタムカラーの設定</string>
<string name="toast_try_later">時間をおいて再試行してください。</string>
<string name="mute_home">ホームでのミュート</string>
<string name="set_remove_left_margin">タイムライン上の左のマージンを削除し、投稿をよりコンパクトにします</string>
<string name="notif_reported">通報しました</string>
<string name="domains">ドメイン</string>
<string name="set_notif_user_sign_up">新規登録(モデレーター)</string>
<string name="order_lists">リストの並び替え</string>
<string name="admin_domainblock_domain">ドメインブロックはデータベースへのアカウントエントリーの作成を妨げませんが、それらのアカウントに指定されたモデレーション方法を遡及的かつ自動的に適用します。</string>
<string name="open_with_account">他のアカウントで開く</string>
<string name="reject_media">メディアを拒否</string>
<string name="set_cardview_indication">有効にすると、タイムライン上のアイテムが影と高さを持ちます。</string>
<string name="set_customize_light_indication">ライトテーマでの投稿の一部の要素をカスタマイズできます。</string>
<string name="set_customize_dark_indication">ダークテーマでの投稿の一部の要素をカスタマイズできます。</string>
<string name="toast_on_your_instance">会話があなたのサーバーで開始されました!</string>
<string name="toast_error_fetch_message">リモートの投稿が見つかりませんでした。</string>
<string name="unfollow_tag">タグのフォローを解除</string>
<string name="put_all_accounts_in_home_muted">全てのアカウントがホームタイムライン上でミュートされます。</string>
<string name="add_all_users_home_muted">全てのユーザーをホームでのミュート対象として追加</string>
<string name="mute_them_all">選択をミュート</string>
<string name="group_reblogs">ホームタイムラインでブーストをグループ化</string>
<string name="manage_accounts">アカウントの管理</string>
<string name="set_remove_left_margin_title">左のマージンを削除</string>
<string name="admin_domainblock_reject_reports">このドメインからの通報を全て無視します。サスペンドとは無関係です</string>
<string name="admin_domainblock_reject_obfuscate">ドメイン制限リストの公開が有効なとき、リスト内のドメイン名を一部難読化します</string>
<string name="private_comment">内部コメント</string>
<string name="admin_domainblock_private_comment">このドメイン制限に関するコメントで、モデレーターによって内部で使用されます。</string>
<string name="admin_domainblock_public_comment">このドメイン制限に関するコメントで、ドメイン制限リストの公開が有効な場合に一般外部向けに使用されます。</string>
</resources>

View file

@ -935,4 +935,6 @@
<string name="import_data">Verileri içe aktar</string>
<string name="group_reblogs">Ana sayfa zaman çizelgesinde yeniden blogları gruplandır</string>
<string name="manage_accounts">Hesapları yönet</string>
<string name="set_remove_left_margin_title">Sol kenar boşluğunu kaldır</string>
<string name="set_remove_left_margin">Mesajları daha sıkı hale getirmek için zaman çizelgelerindeki sol kenar boşluğunu kaldır</string>
</resources>

View file

@ -766,6 +766,26 @@
<item>Wifi only</item>
<item>Ask</item>
</string-array>
<string-array name="set_translator_values" translatable="false">
<item>Fedilab</item>
<item>DeepL</item>
</string-array>
<string-array name="set_translator_version_values">
<item>Free</item>
<item>Pro</item>
</string-array>
<string-array name="SET_TRANSLATOR_VALUES" translatable="false">
<item>FEDILAB</item>
<item>DEEPL</item>
</string-array>
<string-array name="SET_TRANSLATOR_VERSION_VALUES" translatable="false">
<item>FREE</item>
<item>PRO</item>
</string-array>
<string-array name="set_notification_delay_values">
<item>15 minutes</item>
<item>30 minutes</item>
@ -1400,6 +1420,12 @@
<string name="SET_NOTIF_VALIDATION" translatable="false">SET_NOTIF_VALIDATION</string>
<string name="SET_DISPLAY_BOOKMARK" translatable="false">SET_DISPLAY_BOOKMARK</string>
<string name="SET_DISPLAY_TRANSLATE" translatable="false">SET_DISPLAY_TRANSLATE</string>
<string name="SET_TRANSLATOR" translatable="false">SET_TRANSLATOR</string>
<string name="SET_TRANSLATOR_VERSION" translatable="false">SET_TRANSLATOR_VERSION</string>
<string name="SET_TRANSLATOR_API_KEY" translatable="false">SET_TRANSLATOR_API_KEY</string>
<string name="SET_NOTIF_VALIDATION_FAV" translatable="false">SET_NOTIF_VALIDATION_FAV</string>
<string name="SET_DISPLAY_COUNTER_FAV_BOOST" translatable="false">SET_DISPLAY_COUNTER_FAV_BOOST</string>
<string name="SET_REMOVE_LEFT_MARGIN" translatable="false">SET_REMOVE_LEFT_MARGIN</string>
@ -2116,4 +2142,9 @@
<string name="manage_accounts">Manage accounts</string>
<string name="set_remove_left_margin_title">Remove left margin</string>
<string name="set_remove_left_margin">Remove the left margin in timelines to make messages more compact</string>
<string name="translator">Translator</string>
<string name="set_translator">Translator</string>
<string name="api_key">Translator API key</string>
<string name="version">Version</string>
<string name="set_translator_version">Translator version</string>
</resources>

View file

@ -54,6 +54,32 @@
app:singleLineTitle="false"
app:title="@string/set_display_translate_indication" />
<ListPreference
app:defaultValue="FEDILAB"
app:dialogTitle="@string/translator"
app:entries="@array/set_translator_values"
app:entryValues="@array/SET_TRANSLATOR_VALUES"
app:iconSpaceReserved="false"
app:key="@string/SET_TRANSLATOR"
app:title="@string/set_translator"
app:useSimpleSummaryProvider="true" />
<EditTextPreference
app:dependency="@string/SET_TRANSLATOR"
app:iconSpaceReserved="false"
app:key="@string/SET_TRANSLATOR_API_KEY"
app:title="@string/api_key"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="PRO"
app:dialogTitle="@string/version"
app:entries="@array/set_translator_version_values"
app:entryValues="@array/SET_TRANSLATOR_VERSION_VALUES"
app:iconSpaceReserved="false"
app:key="@string/SET_TRANSLATOR_VERSION"
app:title="@string/set_translator_version"
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"

View file

@ -28,7 +28,8 @@ public class Helper {
private static final String YANDEX_BASE_URL = "https://translate.yandex.net/api/v1.5/tr.json/translate?";
private static final String DEEPL_BASE_URL = "https://api.deepl.com/v1/translate?";
private static final String DEEPL_BASE_URL = "https://free.deepl.com/v2/translate?";
private static final String DEEPL_BASE_FREE_URL = "https://api-free.deepl.com/v2/translate?";
private static final String SYSTRAN_BASE_URL = "https://api-platform.systran.net/translation/text/translate?";
private static final String[] deeplAvailableLang = {"EN", "DE", "FR", "ES", "IT", "NL", "PL"};
@ -98,8 +99,11 @@ public class Helper {
if (deepLParams.getNon_splitting_tags() != null)
params += "&tag_handling=" + deepLParams.getNon_splitting_tags();
return Helper.DEEPL_BASE_URL + text + lang + params + key;
if (deepLParams.isPro()) {
return Helper.DEEPL_BASE_URL + text + lang + params + key;
} else {
return Helper.DEEPL_BASE_FREE_URL + text + lang + params + key;
}
}

View file

@ -25,6 +25,7 @@ public class Params {
private String ignore_tags;
private boolean split_sentences = true;
private boolean preserve_formatting = false;
private boolean isPro = true;
private Params.fType format;
public Params.fType getFormat() {
@ -86,6 +87,15 @@ public class Params {
this.preserve_formatting = preserve_formatting;
}
public boolean isPro() {
return isPro;
}
public void setPro(boolean pro) {
this.isPro = pro;
}
public enum fType {
@SerializedName("TEXT")
TEXT("text"),

View file

@ -0,0 +1,9 @@
Added:
- DeepL translation support free/pro keys
Changed:
- Hide buttons for media when editing
Fixed:
- GIF loaded as static images
- Suggested accounts cannot be followed