Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Fix some plural and puzzle strings, and remove other unused ones #2444

Merged
merged 14 commits into from
Aug 21, 2018
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Bugfix:
- Fix issue when changing device name in the settings (#2416)
- Fix issue on verifying device, update the wording of the description message (#1067)
- Messages with code blocks show other HTML as plain text (#2280)
- Fix some plural and puzzle strings, and remove other unused ones (#2444)

Translations:
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,21 @@ private void finish(final List<ParticipantAdapterItem> participantAdapterItems)
.setTitle(R.string.dialog_title_confirmation);

String message = "";
String msgPartA = "";
String msgPartB = "";

if (displayNames.size() == 1) {
message = displayNames.get(0);
} else {
for (int i = 0; i < (displayNames.size() - 2); i++) {
message += displayNames.get(i) + ", ";
msgPartA += getString(R.string.room_participants_invite_join_names, displayNames.get(i));
}

message += displayNames.get(displayNames.size() - 2) + " " + getText(R.string.and) + " " + displayNames.get(displayNames.size() - 1);
msgPartB = getString(R.string.room_participants_invite_join_names_and,
displayNames.get(displayNames.size() - 2),
displayNames.get(displayNames.size() - 1));
message = getString(R.string.room_participants_invite_join_names_combined,
msgPartA, msgPartB);
}

builder.setMessage(getString(R.string.room_participants_invite_prompt_msg, message))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,9 @@ public View getView(int position, View convertView, ViewGroup parent) {
roomNameTxtView.setText(roomName);

// display the number of users
String usersText;
if (publicRoom.numJoinedMembers > 1) {
usersText = publicRoom.numJoinedMembers + " " + mContext.getString(R.string.users);
} else {
usersText = publicRoom.numJoinedMembers + " " + mContext.getString(R.string.user);
}

timestampTxtView.setText(usersText);
timestampTxtView.setText(mContext.getResources().getQuantityString(R.plurals.public_room_nb_users,
publicRoom.numJoinedMembers,
publicRoom.numJoinedMembers));

// separator
separatorView.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public void refreshViews() {
int roomCount = (null != group.getGroupRooms()) ? group.getGroupRooms().getEstimatedRoomCount() : 0;
int memberCount = (null != group.getGroupUsers()) ? group.getGroupUsers().getEstimatedUsersCount() : 1;

mGroupRoomsTextView.setText((1 == roomCount) ? getString(R.string.group_one_room) : getString(R.string.group_rooms, roomCount));
mGroupMembersTextView.setText((1 == memberCount) ? getString(R.string.group_one_member) : getString(R.string.group_members, memberCount));
mGroupRoomsTextView.setText(getResources().getQuantityString(R.plurals.group_rooms, roomCount, roomCount));
mGroupMembersTextView.setText(getResources().getQuantityString(R.plurals.group_members, memberCount, memberCount));

if (!TextUtils.isEmpty(group.getLongDescription())) {
mGroupHtmlTextView.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ public void onSelectUserId(String userId) {
List<String> userIds = mAdapter.getSelectedUserIds();

if (0 != userIds.size()) {
setActivityTitle(userIds.size() + " " + getString(R.string.room_details_selected));
setActivityTitle(getResources().getQuantityString(R.plurals.room_details_selected,
userIds.size(), userIds.size()));
} else {
resetActivityTitle();
}
Expand Down
7 changes: 4 additions & 3 deletions vector/src/main/java/im/vector/util/VectorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,11 @@ public void onUnexpectedError(Exception e) {

if (presenceText != null) {
if ((null != user.currently_active) && user.currently_active) {
presenceText += " " + context.getString(R.string.room_participants_now);
presenceText = context.getString(R.string.room_participants_now, presenceText);
} else if ((null != user.lastActiveAgo) && (user.lastActiveAgo > 0)) {
presenceText += " " + formatSecondsIntervalFloored(context,
user.getAbsoluteLastActiveAgo() / 1000L) + " " + context.getString(R.string.room_participants_ago);
presenceText = context.getString(R.string.room_participants_ago, presenceText,
formatSecondsIntervalFloored(context,
user.getAbsoluteLastActiveAgo() / 1000L));
}
}

Expand Down
40 changes: 28 additions & 12 deletions vector/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@
<string name="logout">Log out</string>
<string name="hs_url">Home Server URL</string>
<string name="identity_url">Identity Server URL</string>
<string name="user">user</string>
<string name="users">users</string>
<string name="search">Search</string>

<string name="start_new_chat">Start New Chat</string>
Expand Down Expand Up @@ -387,8 +385,13 @@
<string name="room_participants_online">Online</string>
<string name="room_participants_offline">Offline</string>
<string name="room_participants_idle">Idle</string>
<string name="room_participants_now">now</string>
<string name="room_participants_ago">ago</string>
<!--The variable is one of "Online", "Offline" or "Idle" states above.-->
<string name="room_participants_now">%1$s now</string>
<!--
The first variable is one of "Online", "Offline" or "Idle" states (with or without " now" part).
The second variable is the time in seconds.
-->
<string name="room_participants_ago">%1$s %2$s ago</string>

<string name="room_participants_header_admin_tools">ADMIN TOOLS</string>
<string name="room_participants_header_call">CALL</string>
Expand All @@ -410,10 +413,18 @@
<string name="room_participants_action_devices_list">Show Device List</string>
<string name="room_participants_power_level_prompt">You will not be able to undo this change as you are promoting the user to have the same power level as yourself.\nAre you sure?</string>

<string name="room_participants_invite_prompt_msg">"Are you sure you want to invite %s to this chat?"</string>
<string name="room_participants_kick_prompt_msg">Are you sure that you want to kick this user from this chat?</string>
<string name="room_participants_ban_prompt_msg">Are you sure that you want to ban this user from this chat?</string>

<!-- The variable can be a single name or a string of names ("A, ""B, ""C and D" > "A, B, C and D) -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand the usage of " in this comment. Is there some typo?
Maybe write an example for clarity: "Bob" or "Bob and Alice" or "Bob, Alice and Charlie"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to give the translator an idea how the block is built, to show that there is a space after the comma.
And yes, human names are better :)
Will work now on it.

<string name="room_participants_invite_prompt_msg">"Are you sure you want to invite %s to this chat?"</string>
<!-- The building block of the first part of the string of names ("A, "/"B, ") -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark for this one

<string name="room_participants_invite_join_names">%1$s, </string>
<!-- The second part of the string of names ("C and D") -->
<string name="room_participants_invite_join_names_and">%1$s and %2$s</string>
<!-- First variable is the first part, and second is the second part -->
<string name="room_participants_invite_join_names_combined">%1$s %2$s</string>

<!-- invitation -->
<string name="people_search_invite_by_id"><u>Invite by ID</u></string>
<string name="people_search_local_contacts">LOCAL CONTACTS (%d)</string>
Expand Down Expand Up @@ -465,7 +476,10 @@
<string name="room_details_people">People</string>
<string name="room_details_files">Files</string>
<string name="room_details_settings">Settings</string>
<string name="room_details_selected">selected</string>
<plurals name="room_details_selected">
<item quantity="one">1 selected</item>
<item quantity="other">%d selected</item>
</plurals>
<string name="malformed_id">Malformed ID. Should be an email address or a Matrix ID like \'@localpart:domain\'</string>
<string name="room_details_people_invited_group_name">INVITED</string>
<string name="room_details_people_present_group_name">JOINED</string>
Expand Down Expand Up @@ -513,12 +527,10 @@

<!-- Directory -->
<string name="directory_search_results_title">Browse directory</string>
<string name="directory_search_room">%1$d room</string>
<plurals name="directory_search_rooms">
<item quantity="one">1 room</item>
<item quantity="other">%d rooms</item>
</plurals>
<string name="directory_search_room_for">%1$d room found for %2$s</string>
<plurals name="directory_search_rooms_for">
<item quantity="one">%1$s room found for %2$s</item>
<item quantity="other">%1$s rooms found for %2$s</item>
Expand Down Expand Up @@ -959,11 +971,15 @@
<string name="filter_group_members">Filter group members</string>
<string name="filter_group_rooms">Filter group rooms</string>

<string name="group_one_member">1 member</string>
<string name="group_members">%d members</string>
<plurals name="group_members">
<item quantity="one">1 member</item>
<item quantity="other">%d members</item>
</plurals>

<string name="group_one_room">1 room</string>
<string name="group_rooms">%d rooms</string>
<plurals name="group_rooms">
<item quantity="one">1 room</item>
<item quantity="other">%d rooms</item>
</plurals>
<string name="group_no_long_description">The community admin has not provided a long description for this community.</string>

<string name="has_been_kicked">You have been kicked from %1$s by %2$s</string>
Expand Down