Deletion Language is in english (#4841)

* Deletion Language is in english

* Added Tests

* Added Tests

* Added Tests
This commit is contained in:
Devarsh Mavani 2022-02-22 08:15:35 +05:30 committed by GitHub
parent 0f515823e9
commit d81587b85a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 144 additions and 18 deletions

View file

@ -4,6 +4,7 @@ import static fr.free.nrw.commons.notification.NotificationHelper.NOTIFICATION_D
import android.annotation.SuppressLint;
import android.content.Context;
import static fr.free.nrw.commons.utils.LangCodeUtils.getLocalizedResources;
import android.content.Intent;
import android.net.Uri;
import androidx.appcompat.app.AlertDialog;
@ -78,7 +79,7 @@ public class DeleteHelper {
String fileDeleteString = "{{delete|reason=" + reason +
"|subpage=" + media.getFilename() +
"|day=" + calendar.get(Calendar.DAY_OF_MONTH) +
"|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) +
"|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH) +
"|year=" + calendar.get(Calendar.YEAR) +
"}}";
@ -156,16 +157,23 @@ public class DeleteHelper {
ArrayList<Integer> mUserReason = new ArrayList<>();
String[] reasonList = {"Reason 1", "Reason 2", "Reason 3"};
// Messages posted on-wiki should not be in the app user's locale, but rather in Commons' lingua franca English.
String[] reasonListEnglish = {"Eng1", "Eng2", "Eng3"};
if (problem == ReviewController.DeleteReason.SPAM) {
reasonList[0] = context.getString(R.string.delete_helper_ask_spam_selfie);
reasonList[1] = context.getString(R.string.delete_helper_ask_spam_blurry);
reasonList[2] = context.getString(R.string.delete_helper_ask_spam_nonsense);
reasonListEnglish[0] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_spam_selfie);
reasonListEnglish[1] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_spam_blurry);
reasonListEnglish[2] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_spam_nonsense);
} else if (problem == ReviewController.DeleteReason.COPYRIGHT_VIOLATION) {
reasonList[0] = context.getString(R.string.delete_helper_ask_reason_copyright_press_photo);
reasonList[1] = context.getString(R.string.delete_helper_ask_reason_copyright_internet_photo);
reasonList[2] = context.getString(R.string.delete_helper_ask_reason_copyright_logo);
reasonListEnglish[0] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_reason_copyright_press_photo);
reasonListEnglish[1] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_reason_copyright_internet_photo);
reasonListEnglish[2] = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_reason_copyright_logo);
}
alert.setMultiChoiceItems(reasonList, checkedItems, (dialogInterface, position, isChecked) -> {
@ -178,9 +186,10 @@ public class DeleteHelper {
alert.setPositiveButton(context.getString(R.string.ok), (dialogInterface, i) -> {
String reason = context.getString(R.string.delete_helper_ask_alert_set_positive_button_reason) + " ";
String reason = getLocalizedResources(context, Locale.ENGLISH).getString(R.string.delete_helper_ask_alert_set_positive_button_reason) + " ";
for (int j = 0; j < mUserReason.size(); j++) {
reason = reason + reasonList[mUserReason.get(j)];
reason = reason + reasonListEnglish[mUserReason.get(j)];
if (j != mUserReason.size() - 1) {
reason = reason + ", ";
}