diff --git a/res/values/strings.xml b/res/values/strings.xml index 1f0549c740..daa5488e17 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -111,6 +111,7 @@ TextSecure Get with it: %s Install TextSecure: %s + Error leaving group... Message details @@ -150,13 +151,9 @@ Cancel Exporting - Exporting plaintext to SD card... - - Error, unable to write to SD - card! - - Error while writing to SD card. - + Exporting plaintext to SD card... + Error, unable to write to SD card! + Error while writing to SD card. Success! @@ -177,11 +174,12 @@ Create group Creating %1$s… Updating %1$s... - Loading group details Cannot add non-TextSecure contacts to an existing TextSecure group + Loading group details... Me + Members... Import @@ -232,6 +230,8 @@ Received a message encrypted using an old version of TextSecure that is no longer supported. Please ask the sender to upgrade to the most recent version and resend the message. + You have left the group. + Updated the group. Passphrases don\'t match! @@ -513,6 +513,11 @@ The text entered was not a valid URI The text entered was not a valid host + + %1$s joined the group. + Group updated. + Title is now \'%1$s\'. + Unlock @@ -817,6 +822,7 @@ You Failed to preview this image + Unsupported media type Save diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 755383cbcd..dfd2f14b9f 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -429,8 +429,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { + Context self = ConversationActivity.this; try { - Context self = ConversationActivity.this; byte[] groupId = GroupUtil.getDecodedId(getRecipients().getPrimaryRecipient().getNumber()); DatabaseFactory.getGroupDatabase(self).setActive(groupId, false); @@ -446,7 +446,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity initializeEnabledCheck(); } catch (IOException e) { Log.w(TAG, e); - Toast.makeText(ConversationActivity.this, "Error leaving group....", Toast.LENGTH_LONG).show(); + Toast.makeText(self, R.string.ConversationActivity_error_leaving_group, Toast.LENGTH_LONG).show(); } } }); diff --git a/src/org/thoughtcrime/securesms/GroupMembersDialog.java b/src/org/thoughtcrime/securesms/GroupMembersDialog.java index b1f3cb8884..0af456ee10 100644 --- a/src/org/thoughtcrime/securesms/GroupMembersDialog.java +++ b/src/org/thoughtcrime/securesms/GroupMembersDialog.java @@ -34,7 +34,7 @@ public class GroupMembersDialog extends AsyncTask { @Override public void onPreExecute() { - progress = ProgressDialog.show(context, "Members...", "Members...", true, false); + progress = ProgressDialog.show(context, context.getString(R.string.GroupMembersDialog_members), context.getString(R.string.GroupMembersDialog_members), true, false); } @Override diff --git a/src/org/thoughtcrime/securesms/MediaPreviewActivity.java b/src/org/thoughtcrime/securesms/MediaPreviewActivity.java index ca654b2807..bf5dd869f1 100644 --- a/src/org/thoughtcrime/securesms/MediaPreviewActivity.java +++ b/src/org/thoughtcrime/securesms/MediaPreviewActivity.java @@ -126,7 +126,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity { if (!isContentTypeSupported(mediaType)) { Log.w(TAG, "Unsupported media type sent to MediaPreviewActivity, finishing."); - Toast.makeText(getApplicationContext(), "Unsupported media type", Toast.LENGTH_LONG).show(); + Toast.makeText(getApplicationContext(), R.string.MediaPreviewActivity_unssuported_media_type, Toast.LENGTH_LONG).show(); finish(); } diff --git a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java index 848860fb64..491644e865 100644 --- a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -95,11 +95,11 @@ public abstract class MessageRecord extends DisplayRecord { @Override public SpannableString getDisplayBody() { if (isGroupUpdate() && isOutgoing()) { - return emphasisAdded("Updated the group."); + return emphasisAdded(context.getString(R.string.MessageRecord_updated_group)); } else if (isGroupUpdate()) { - return emphasisAdded(GroupUtil.getDescription(getBody().getBody())); + return emphasisAdded(GroupUtil.getDescription(context, getBody().getBody())); } else if (isGroupQuit() && isOutgoing()) { - return emphasisAdded("You have left the group."); + return emphasisAdded(context.getString(R.string.MessageRecord_left_group)); } else if (isGroupQuit()) { return emphasisAdded(context.getString(R.string.ConversationItem_group_action_left, getIndividualRecipient().toShortString())); } diff --git a/src/org/thoughtcrime/securesms/database/model/ThreadRecord.java b/src/org/thoughtcrime/securesms/database/model/ThreadRecord.java index fa2c7c30f2..cc1da2e198 100644 --- a/src/org/thoughtcrime/securesms/database/model/ThreadRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/ThreadRecord.java @@ -57,7 +57,7 @@ public class ThreadRecord extends DisplayRecord { if (SmsDatabase.Types.isDecryptInProgressType(type)) { return emphasisAdded(context.getString(R.string.MessageDisplayHelper_decrypting_please_wait)); } else if (isGroupUpdate()) { - return emphasisAdded(GroupUtil.getDescription(getBody().getBody())); + return emphasisAdded(GroupUtil.getDescription(context, getBody().getBody())); } else if (isGroupQuit()) { return emphasisAdded(context.getString(R.string.ThreadRecord_left_the_group)); } else if (isKeyExchange()) { diff --git a/src/org/thoughtcrime/securesms/util/GroupUtil.java b/src/org/thoughtcrime/securesms/util/GroupUtil.java index c0562f0fc8..e63cc71387 100644 --- a/src/org/thoughtcrime/securesms/util/GroupUtil.java +++ b/src/org/thoughtcrime/securesms/util/GroupUtil.java @@ -1,5 +1,6 @@ package org.thoughtcrime.securesms.util; +import android.content.Context; import android.util.Log; import com.google.protobuf.InvalidProtocolBufferException; @@ -7,6 +8,7 @@ import com.google.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.util.List; +import org.thoughtcrime.securesms.R; import static org.whispersystems.textsecure.internal.push.PushMessageProtos.PushMessageContent.GroupContext; public class GroupUtil { @@ -29,32 +31,32 @@ public class GroupUtil { return groupId.startsWith(ENCODED_GROUP_PREFIX); } - public static String getDescription(String encodedGroup) { + public static String getDescription(Context context, String encodedGroup) { if (encodedGroup == null) { - return "Group updated."; + return context.getString(R.string.GroupUtil_group_updated); } try { String description = ""; - GroupContext context = GroupContext.parseFrom(Base64.decode(encodedGroup)); - List members = context.getMembersList(); - String title = context.getName(); + GroupContext groupContext = GroupContext.parseFrom(Base64.decode(encodedGroup)); + List members = groupContext.getMembersList(); + String title = groupContext.getName(); if (!members.isEmpty()) { - description += Util.join(members, ", ") + " joined the group."; + description += context.getString(R.string.GroupUtil_joined_the_group, Util.join(members, ", ")); } if (title != null && !title.trim().isEmpty()) { - description += " Title is now '" + title + "'."; + description += context.getString(R.string.GroupUtil_title_is_now, title); } return description; } catch (InvalidProtocolBufferException e) { Log.w("GroupUtil", e); - return "Group updated."; + return context.getString(R.string.GroupUtil_group_updated); } catch (IOException e) { Log.w("GroupUtil", e); - return "Group updated."; + return context.getString(R.string.GroupUtil_group_updated); } } }