make invite strings plural

fixes #4388
Closes #4389

// FREEBIE
This commit is contained in:
agrajaghh 2015-11-05 14:53:02 +01:00 committed by Moxie Marlinspike
parent 181c7dfd85
commit 5c59c3f423
2 changed files with 14 additions and 4 deletions

View File

@ -280,8 +280,14 @@
<string name="InviteActivity_heart_content_description">Heart</string> <string name="InviteActivity_heart_content_description">Heart</string>
<string name="InviteActivity_invitations_sent">Invitations sent!</string> <string name="InviteActivity_invitations_sent">Invitations sent!</string>
<string name="InviteActivity_invite_to_signal">Invite to Signal</string> <string name="InviteActivity_invite_to_signal">Invite to Signal</string>
<string name="InviteActivity_send_to_friends">SEND TO %1$s FRIEND(S)</string> <plurals name="InviteActivity_send_to_friends">
<string name="InviteActivity_send_sms_invites">Send %1$s SMS invite(s)?</string> <item quantity="one">SEND TO ONE FRIEND</item>
<item quantity="other">SEND TO %d FRIENDS</item>
</plurals>
<plurals name="InviteActivity_send_sms_invites">
<item quantity="one">Send one SMS invite?</item>
<item quantity="other">Send %d SMS invites?</item>
</plurals>
<string name="InviteActivity_lets_switch_to_signal">Let\'s switch to Signal: %1$s</string> <string name="InviteActivity_lets_switch_to_signal">Let\'s switch to Signal: %1$s</string>
<string name="InviteActivity_no_app_to_share_to">It looks like you don\'t have any apps to share to.</string> <string name="InviteActivity_no_app_to_share_to">It looks like you don\'t have any apps to share to.</string>
<string name="InviteActivity_friends_dont_let_friends_text_unencrypted">Friends don\'t let friends chat unencrypted.</string> <string name="InviteActivity_friends_dont_let_friends_text_unencrypted">Friends don\'t let friends chat unencrypted.</string>

View File

@ -115,7 +115,9 @@ public class InviteActivity extends PassphraseRequiredActionBarActivity implemen
} }
private void updateSmsButtonText() { private void updateSmsButtonText() {
smsSendButton.setText(getString(R.string.InviteActivity_send_to_friends, contactsFragment.getSelectedContacts().size())); smsSendButton.setText(getResources().getQuantityString(R.plurals.InviteActivity_send_to_friends,
contactsFragment.getSelectedContacts().size(),
contactsFragment.getSelectedContacts().size()));
smsSendButton.setEnabled(!contactsFragment.getSelectedContacts().isEmpty()); smsSendButton.setEnabled(!contactsFragment.getSelectedContacts().isEmpty());
} }
@ -166,7 +168,9 @@ public class InviteActivity extends PassphraseRequiredActionBarActivity implemen
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new AlertDialog.Builder(InviteActivity.this) new AlertDialog.Builder(InviteActivity.this)
.setTitle(getString(R.string.InviteActivity_send_sms_invites, contactsFragment.getSelectedContacts().size())) .setTitle(getResources().getQuantityString(R.plurals.InviteActivity_send_sms_invites,
contactsFragment.getSelectedContacts().size(),
contactsFragment.getSelectedContacts().size()))
.setMessage(inviteText.getText().toString()) .setMessage(inviteText.getText().toString())
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override public void onClick(DialogInterface dialog, int which) { @Override public void onClick(DialogInterface dialog, int which) {