mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 08:40:03 +02:00
Add localization for pronons support
This commit is contained in:
parent
ff026e260a
commit
b943309dd2
4 changed files with 37 additions and 3 deletions
|
@ -0,0 +1,31 @@
|
|||
package app.fedilab.android.mastodon.helper;
|
||||
/* Copyright 2024 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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PronounsHelper {
|
||||
|
||||
public static List<String> pronouns = new ArrayList<>() {
|
||||
{
|
||||
add("pronouns");
|
||||
add("pronoms");
|
||||
add("pronombres");
|
||||
add("לשון פנייה");
|
||||
add("כינויי גוף");
|
||||
add("Pronomen");
|
||||
}
|
||||
};
|
||||
}
|
|
@ -33,6 +33,7 @@ import app.fedilab.android.mastodon.client.entities.api.Account;
|
|||
import app.fedilab.android.mastodon.client.entities.api.Field;
|
||||
import app.fedilab.android.mastodon.helper.Helper;
|
||||
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||
import app.fedilab.android.mastodon.helper.PronounsHelper;
|
||||
|
||||
|
||||
public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filterable {
|
||||
|
@ -120,7 +121,7 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|||
holder.binding.accountDn.setVisibility(View.VISIBLE);
|
||||
account.pronouns = null;
|
||||
for (Field field : account.fields) {
|
||||
if (field.name.trim().equalsIgnoreCase("pronouns")) {
|
||||
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
||||
account.pronouns = Helper.parseHtml(field.value);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ import app.fedilab.android.mastodon.helper.ComposeHelper;
|
|||
import app.fedilab.android.mastodon.helper.Helper;
|
||||
import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod;
|
||||
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||
import app.fedilab.android.mastodon.helper.PronounsHelper;
|
||||
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||
import app.fedilab.android.mastodon.imageeditor.EditImageActivity;
|
||||
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
|
||||
|
@ -1428,7 +1429,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
statusFromUser.pronouns = null;
|
||||
if (accountFromUser.fields != null && accountFromUser.fields.size() > 0) {
|
||||
for (Field field : accountFromUser.fields) {
|
||||
if (field.name.toLowerCase().startsWith("pronoun")) {
|
||||
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
||||
statusList.get(position).pronouns = Helper.parseHtml(field.value);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -169,6 +169,7 @@ import app.fedilab.android.mastodon.helper.Helper;
|
|||
import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod;
|
||||
import app.fedilab.android.mastodon.helper.MastodonHelper;
|
||||
import app.fedilab.android.mastodon.helper.MediaHelper;
|
||||
import app.fedilab.android.mastodon.helper.PronounsHelper;
|
||||
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||
import app.fedilab.android.mastodon.helper.ThemeHelper;
|
||||
import app.fedilab.android.mastodon.helper.TimelineHelper;
|
||||
|
@ -483,7 +484,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
String loadMediaType = sharedpreferences.getString(context.getString(R.string.SET_LOAD_MEDIA_TYPE), "ALWAYS");
|
||||
if (statusToDeal.pronouns == null && statusToDeal.account.fields != null && statusToDeal.account.fields.size() > 0) {
|
||||
for (Field field : statusToDeal.account.fields) {
|
||||
if (field.name.toLowerCase().startsWith("pronoun")) {
|
||||
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
||||
statusToDeal.pronouns = Helper.parseHtml(field.value);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue