Update with new language

This commit is contained in:
Thomas 2023-02-09 19:02:28 +01:00
parent 7ce644e922
commit 25a72471a1
8 changed files with 154 additions and 376 deletions

View file

@ -381,7 +381,7 @@
}, },
{ {
"code": "lo", "code": "lo",
"language": "ພາສາ" "language": "ລາວ"
}, },
{ {
"code": "lt", "code": "lt",
@ -726,5 +726,109 @@
{ {
"code": "zu", "code": "zu",
"language": "isiZulu" "language": "isiZulu"
},
{
"code": "ast",
"language": "Asturianu"
},
{
"code": "ckb",
"language": "سۆرانی"
},
{
"code": "cnr",
"language": "crnogorski"
},
{
"code": "jbo",
"language": "la .lojban."
},
{
"code": "kab",
"language": "Taqbaylit"
},
{
"code": "kmr",
"language": "Kurmancî"
},
{
"code": "ldn",
"language": "Láadan"
},
{
"code": "lfn",
"language": "lingua franca nova"
},
{
"code": "sco",
"language": "Scots"
},
{
"code": "sma",
"language": "Åarjelsaemien Gïele"
},
{
"code": "smj",
"language": "Julevsámegiella"
},
{
"code": "szl",
"language": "ślůnsko godka"
},
{
"code": "tai",
"language": "ภาษาไท or ภาษาไต"
},
{
"code": "tok",
"language": "toki pona"
},
{
"code": "zba",
"language": "باليبلن"
},
{
"code": "zgh",
"language": "ⵜⴰⵎⴰⵣⵉⵖⵜ"
},
{
"code": "en-GB",
"language": "English (British)"
},
{
"code": "es-AR",
"language": "Español (Argentina)"
},
{
"code": "es-MX",
"language": "Español (México)"
},
{
"code": "fr-QC",
"language": "Français (Canadien)"
},
{
"code": "pt-BR",
"language": "Português (Brasil)"
},
{
"code": "pt-PT",
"language": "Português (Portugal)"
},
{
"code": "sr-Latn",
"language": "Srpski (latinica)"
},
{
"code": "zh-CN",
"language": "简体中文"
},
{
"code": "zh-HK",
"language": "繁體中文(香港)"
},
{
"code": "zh-TW",
"language": "繁體中文(臺灣)"
} }
] ]

View file

@ -30,7 +30,7 @@ import app.fedilab.android.mastodon.client.entities.api.Status;
public class CustomEmoji extends ReplacementSpan { public class CustomEmoji extends ReplacementSpan {
private final float scale; private float scale;
private final WeakReference<View> viewWeakReference; private final WeakReference<View> viewWeakReference;
private Drawable imageDrawable; private Drawable imageDrawable;
private boolean callbackCalled; private boolean callbackCalled;
@ -40,6 +40,9 @@ public class CustomEmoji extends ReplacementSpan {
this.viewWeakReference = viewWeakReference; this.viewWeakReference = viewWeakReference;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
scale = sharedpreferences.getFloat(mContext.getString(R.string.SET_FONT_SCALE), 1.1f); scale = sharedpreferences.getFloat(mContext.getString(R.string.SET_FONT_SCALE), 1.1f);
if (scale > 1.3f) {
scale = 1.3f;
}
callbackCalled = false; callbackCalled = false;
} }

View file

@ -230,7 +230,6 @@ public class ComposeWorker extends Worker {
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD);
return; return;
} }
String language = sharedPreferences.getString(context.getString(R.string.SET_COMPOSE_LANGUAGE) + dataPost.userId + dataPost.instance, null);
if (statuses.get(i).local_only) { if (statuses.get(i).local_only) {
statuses.get(i).text += " \uD83D\uDC41"; statuses.get(i).text += " \uD83D\uDC41";
} }
@ -258,11 +257,11 @@ public class ComposeWorker extends Worker {
if (dataPost.scheduledDate == null) { if (dataPost.scheduledDate == null) {
if (dataPost.statusEditId == null) { if (dataPost.statusEditId == null) {
statusCall = mastodonStatusesService.createStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in, statusCall = mastodonStatusesService.createStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language, statuses.get(i).quote_id, statuses.get(i).content_type); poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), statuses.get(i).language, statuses.get(i).quote_id, statuses.get(i).content_type);
} else { //Status is edited } else { //Status is edited
statusCall = mastodonStatusesService.updateStatus(null, dataPost.token, dataPost.statusEditId, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in, statusCall = mastodonStatusesService.updateStatus(null, dataPost.token, dataPost.statusEditId, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive,
statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), statuses.get(i).language,
media_edit_id, media_edit_description, media_edit_focus); media_edit_id, media_edit_description, media_edit_focus);
} }
try { try {

View file

@ -1695,7 +1695,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
if (statusDraft.language == null || statusDraft.language.isEmpty()) { if (statusDraft.language == null || statusDraft.language.isEmpty()) {
String currentCode = sharedpreferences.getString(context.getString(R.string.SET_COMPOSE_LANGUAGE) + account.user_id + account.instance, Locale.getDefault().getLanguage()); String currentCode = sharedpreferences.getString(context.getString(R.string.SET_COMPOSE_LANGUAGE) + account.user_id + account.instance, Locale.getDefault().getLanguage());
if (currentCode == null || currentCode.isEmpty()) { if (currentCode.isEmpty()) {
currentCode = "EN"; currentCode = "EN";
} }
statusDraft.language = currentCode; statusDraft.language = currentCode;

View file

@ -18,11 +18,16 @@ import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.preference.EditTextPreference; import androidx.preference.EditTextPreference;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import java.util.List;
import java.util.Set;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.client.entities.app.Languages;
public class FragmentComposeSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { public class FragmentComposeSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -40,6 +45,40 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
String val = sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT), null)); String val = sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT), null));
SET_WATERMARK_TEXT.setText(val); SET_WATERMARK_TEXT.setText(val);
} }
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
if (SET_SELECTED_LANGUAGE != null) {
Set<String> storedLanguages = sharedPreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
String[] selectedValue = new String[0];
if (storedLanguages != null && storedLanguages.size() > 0) {
if (storedLanguages.size() == 1 && storedLanguages.toArray()[0] == null) {
sharedPreferences.edit().remove(getString(R.string.SET_SELECTED_LANGUAGE)).commit();
} else {
selectedValue = storedLanguages.toArray(new String[0]);
}
}
List<Languages.Language> languages = Languages.get(requireActivity());
if (languages != null) {
String[] codesArr = new String[languages.size()];
String[] languagesArr = new String[languages.size()];
int i = 0;
for (Languages.Language language : languages) {
codesArr[i] = language.code;
languagesArr[i] = language.language;
i++;
}
SET_SELECTED_LANGUAGE.setEntries(languagesArr);
SET_SELECTED_LANGUAGE.setEntryValues(codesArr);
if (selectedValue.length > 0) {
SET_SELECTED_LANGUAGE.setDefaultValue(selectedValue);
}
}
}
} }
@Override @Override

View file

@ -900,374 +900,7 @@
<item>szl</item> <item>szl</item>
<item>sc</item> <item>sc</item>
</string-array> </string-array>
<string-array name="SET_SELECTED_LANGUAGE_ENTRIES" translatable="false">
<item>aa</item>
<item>ab</item>
<item>ae</item>
<item>af</item>
<item>ak</item>
<item>am</item>
<item>an</item>
<item>ar</item>
<item>as</item>
<item>av</item>
<item>ay</item>
<item>az</item>
<item>ba</item>
<item>be</item>
<item>bg</item>
<item>bh</item>
<item>bi</item>
<item>bm</item>
<item>bn</item>
<item>bo</item>
<item>br</item>
<item>bs</item>
<item>ca</item>
<item>ce</item>
<item>ch</item>
<item>co</item>
<item>cr</item>
<item>cs</item>
<item>cu</item>
<item>cv</item>
<item>cy</item>
<item>da</item>
<item>de</item>
<item>dv</item>
<item>dz</item>
<item>ee</item>
<item>el</item>
<item>en</item>
<item>eo</item>
<item>es</item>
<item>et</item>
<item>eu</item>
<item>fa</item>
<item>ff</item>
<item>fi</item>
<item>fj</item>
<item>fo</item>
<item>fr</item>
<item>fy</item>
<item>ga</item>
<item>gd</item>
<item>gl</item>
<item>gu</item>
<item>gv</item>
<item>ha</item>
<item>he</item>
<item>hi</item>
<item>ho</item>
<item>hr</item>
<item>ht</item>
<item>hu</item>
<item>hy</item>
<item>hz</item>
<item>ia</item>
<item>id</item>
<item>ie</item>
<item>ig</item>
<item>ii</item>
<item>ik</item>
<item>io</item>
<item>is</item>
<item>it</item>
<item>iu</item>
<item>ja</item>
<item>jv</item>
<item>ka</item>
<item>kg</item>
<item>ki</item>
<item>kj</item>
<item>kk</item>
<item>kl</item>
<item>km</item>
<item>kn</item>
<item>ko</item>
<item>kr</item>
<item>ks</item>
<item>ku</item>
<item>kv</item>
<item>kw</item>
<item>ky</item>
<item>la</item>
<item>lb</item>
<item>lg</item>
<item>li</item>
<item>ln</item>
<item>lo</item>
<item>lt</item>
<item>lu</item>
<item>lv</item>
<item>mg</item>
<item>mh</item>
<item>mi</item>
<item>mk</item>
<item>ml</item>
<item>mn</item>
<item>mr</item>
<item>ms</item>
<item>mt</item>
<item>my</item>
<item>na</item>
<item>nb</item>
<item>nd</item>
<item>ne</item>
<item>ng</item>
<item>nl</item>
<item>nn</item>
<item>no</item>
<item>nr</item>
<item>nv</item>
<item>ny</item>
<item>oc</item>
<item>oj</item>
<item>om</item>
<item>or</item>
<item>os</item>
<item>pa</item>
<item>pi</item>
<item>pl</item>
<item>ps</item>
<item>pt</item>
<item>qu</item>
<item>rm</item>
<item>rn</item>
<item>ro</item>
<item>ru</item>
<item>rw</item>
<item>sa</item>
<item>sc</item>
<item>sd</item>
<item>se</item>
<item>sg</item>
<item>si</item>
<item>sk</item>
<item>sl</item>
<item>sn</item>
<item>so</item>
<item>sq</item>
<item>sr</item>
<item>ss</item>
<item>st</item>
<item>su</item>
<item>sv</item>
<item>sw</item>
<item>ta</item>
<item>te</item>
<item>tg</item>
<item>th</item>
<item>ti</item>
<item>tk</item>
<item>tl</item>
<item>tn</item>
<item>to</item>
<item>tr</item>
<item>ts</item>
<item>tt</item>
<item>tw</item>
<item>ty</item>
<item>ug</item>
<item>uk</item>
<item>ur</item>
<item>uz</item>
<item>ve</item>
<item>vi</item>
<item>vo</item>
<item>wa</item>
<item>wo</item>
<item>xh</item>
<item>yi</item>
<item>yo</item>
<item>za</item>
<item>zh</item>
<item>zu</item>
</string-array>
<string-array name="SET_SELECTED_LANGUAGE_VALUES" translatable="false">
<item>Afaraf</item>
<item>аҧсуа бызшәа</item>
<item>avesta</item>
<item>Afrikaans</item>
<item>Akan</item>
<item>አማርኛ</item>
<item>aragonés</item>
<item>اللغة العربية</item>
<item>অসমীয়া</item>
<item>авар мацӀ</item>
<item>aymar aru</item>
<item>azərbaycan dili</item>
<item>башҡорт теле</item>
<item>беларуская мова</item>
<item>български език</item>
<item>भोजपुरी</item>
<item>Bislama</item>
<item>bamanankan</item>
<item>বাংলা</item>
<item>བོད་ཡིག</item>
<item>brezhoneg</item>
<item>bosanski jezik</item>
<item>Català</item>
<item>нохчийн мотт</item>
<item>Chamoru</item>
<item>corsu</item>
<item>ᓀᐦᐃᔭᐍᐏᐣ</item>
<item>čeština</item>
<item>ѩзыкъ словѣньскъ</item>
<item>чӑваш чӗлхи</item>
<item>Cymraeg</item>
<item>dansk</item>
<item>Deutsch</item>
<item>Dhivehi</item>
<item>རྫོང་ཁ</item>
<item>Eʋegbe</item>
<item>Ελληνικά</item>
<item>English</item>
<item>Esperanto</item>
<item>Español</item>
<item>eesti</item>
<item>euskara</item>
<item>فارسی</item>
<item>Fulfulde</item>
<item>suomi</item>
<item>Vakaviti</item>
<item>føroyskt</item>
<item>Français</item>
<item>Frysk</item>
<item>Gaeilge</item>
<item>Gàidhlig</item>
<item>galego</item>
<item>ગુજરાતી</item>
<item>Gaelg</item>
<item>هَوُسَ</item>
<item>עברית</item>
<item>हिन्दी</item>
<item>Hiri Motu</item>
<item>Hrvatski</item>
<item>Kreyòl ayisyen</item>
<item>magyar</item>
<item>Հայերեն</item>
<item>Otjiherero</item>
<item>Interlingua</item>
<item>Bahasa Indonesia</item>
<item>Interlingue</item>
<item>Asụsụ Igbo</item>
<item>ꆈꌠ꒿ Nuosuhxop</item>
<item>Iñupiaq</item>
<item>Ido</item>
<item>Íslenska</item>
<item>Italiano</item>
<item>ᐃᓄᒃᑎᑐᑦ</item>
<item>日本語</item>
<item>basa Jawa</item>
<item>ქართული</item>
<item>Kikongo</item>
<item>Gĩkũyũ</item>
<item>Kuanyama</item>
<item>қазақ тілі</item>
<item>kalaallisut</item>
<item>ខេមរភាសា</item>
<item>ಕನ್ನಡ</item>
<item>한국어</item>
<item>Kanuri</item>
<item>कश्मीरी</item>
<item>Kurmancî</item>
<item>коми кыв</item>
<item>Kernewek</item>
<item>Кыргызча</item>
<item>latine</item>
<item>Lëtzebuergesch</item>
<item>Luganda</item>
<item>Limburgs</item>
<item>Lingála</item>
<item>ພາສາ</item>
<item>lietuvių kalba</item>
<item>Tshiluba</item>
<item>latviešu valoda</item>
<item>fiteny malagasy</item>
<item>Kajin M̧ajeļ</item>
<item>te reo Māori</item>
<item>македонски јазик</item>
<item>മലയാളം</item>
<item>Монгол хэл</item>
<item>मराठी</item>
<item>Bahasa Melayu</item>
<item>Malti</item>
<item>ဗမာစာ</item>
<item>Ekakairũ Naoero</item>
<item>Norsk bokmål</item>
<item>isiNdebele</item>
<item>नेपाली</item>
<item>Owambo</item>
<item>Nederlands</item>
<item>Norsk Nynorsk</item>
<item>Norsk</item>
<item>isiNdebele</item>
<item>Diné bizaad</item>
<item>chiCheŵa</item>
<item>occitan</item>
<item>ᐊᓂᔑᓈᐯᒧᐎᓐ</item>
<item>Afaan Oromoo</item>
<item>ଓଡ଼ିଆ</item>
<item>ирон æвзаг</item>
<item>ਪੰਜਾਬੀ</item>
<item>पाऴि</item>
<item>Polski</item>
<item>پښتو</item>
<item>Português</item>
<item>Runa Simi</item>
<item>rumantsch grischun</item>
<item>Ikirundi</item>
<item>Română</item>
<item>Русский</item>
<item>Ikinyarwanda</item>
<item>संस्कृतम्</item>
<item>sardu</item>
<item>सिन्धी</item>
<item>Davvisámegiella</item>
<item>yângâ tî sängö</item>
<item>සිංහල</item>
<item>slovenčina</item>
<item>slovenščina</item>
<item>chiShona</item>
<item>Soomaaliga</item>
<item>Shqip</item>
<item>српски језик</item>
<item>SiSwati</item>
<item>Sesotho</item>
<item>Basa Sunda</item>
<item>Svenska</item>
<item>Kiswahili</item>
<item>தமிழ்</item>
<item>తెలుగు</item>
<item>тоҷикӣ</item>
<item>ไทย</item>
<item>ትግርኛ</item>
<item>Türkmen</item>
<item>Wikang Tagalog</item>
<item>Setswana</item>
<item>faka Tonga</item>
<item>Türkçe</item>
<item>Xitsonga</item>
<item>татар теле</item>
<item>Twi</item>
<item>Reo Tahiti</item>
<item>ئۇيغۇرچە‎</item>
<item>Українська</item>
<item>اردو</item>
<item>Ўзбек</item>
<item>Tshivenḓa</item>
<item>Tiếng Việt</item>
<item>Volapük</item>
<item>walon</item>
<item>Wollof</item>
<item>isiXhosa</item>
<item>ייִדיש</item>
<item>Yorùbá</item>
<item>Saɯ cueŋƅ</item>
<item>中文</item>
<item>isiZulu</item>
</string-array>
<string-array name="SET_LIVE_TRANSLATE_ENTRIES" translatable="false"> <string-array name="SET_LIVE_TRANSLATE_ENTRIES" translatable="false">
<item>en</item> <item>en</item>
<item>fr</item> <item>fr</item>

View file

@ -47,8 +47,6 @@
app:title="@string/set_unlisted_replies" /> app:title="@string/set_unlisted_replies" />
<MultiSelectListPreference <MultiSelectListPreference
app:entries="@array/SET_SELECTED_LANGUAGE_VALUES"
app:entryValues="@array/SET_SELECTED_LANGUAGE_ENTRIES"
app:iconSpaceReserved="false" app:iconSpaceReserved="false"
app:key="@string/SET_SELECTED_LANGUAGE" app:key="@string/SET_SELECTED_LANGUAGE"
app:summary="@string/set_language_picker" app:summary="@string/set_language_picker"

View file

@ -5,6 +5,8 @@ Added:
Changed: Changed:
- Media heights now use the screen size - Media heights now use the screen size
- Reduce size of emoji when text size is increased
- Update available languages in picker
Fixed: Fixed:
- Forwarded tags are added back after being deleted - Forwarded tags are added back after being deleted