diff --git a/src/org/thoughtcrime/securesms/ConversationTitleView.java b/src/org/thoughtcrime/securesms/ConversationTitleView.java index 7f1d0ab18..e2afb23fd 100644 --- a/src/org/thoughtcrime/securesms/ConversationTitleView.java +++ b/src/org/thoughtcrime/securesms/ConversationTitleView.java @@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.components.AvatarImageView; import org.thoughtcrime.securesms.connect.DcHelper; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.util.Prefs; +import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.ViewUtil; public class ConversationTitleView extends RelativeLayout { @@ -124,9 +125,19 @@ public class ConversationTitleView extends RelativeLayout { } else { this.title.setText(dcChat.getName()); - this.subtitle.setText(dcChat.getSubtitle()); + this.subtitle.setText(hackPluralsString(dcChat.getSubtitle())); } this.subtitle.setVisibility(showSubtitle? View.VISIBLE : View.GONE); } + + private String hackPluralsString(String string) { + // the rust-core does not care about plural forms (there is just once case that was not worth the effort up to now) + // therefore, we check if the returned string has the form "N member(s)" and localized the corrently to one/few/many/other + if( string.endsWith(" member(s)") ) { + int cnt = Util.objectToInt(string.substring(0, string.indexOf(" "))); + string = getContext().getResources().getQuantityString(R.plurals.n_members, cnt, cnt); + } + return string; + } } diff --git a/src/org/thoughtcrime/securesms/connect/ApplicationDcContext.java b/src/org/thoughtcrime/securesms/connect/ApplicationDcContext.java index 44b89d53e..7441e4038 100644 --- a/src/org/thoughtcrime/securesms/connect/ApplicationDcContext.java +++ b/src/org/thoughtcrime/securesms/connect/ApplicationDcContext.java @@ -643,6 +643,7 @@ public class ApplicationDcContext extends DcContext { case 1: s = context.getString(R.string.chat_no_messages); break; case 2: s = context.getString(R.string.self); break; case 3: s = context.getString(R.string.draft); break; + case 4: s = null; break; // we create DC_STR_MEMBER in hackPluralsString() case 7: s = context.getString(R.string.voice_message); break; case 8: s = context.getString(R.string.chat_contact_request); break; case 9: s = context.getString(R.string.image); break;