Improve translations with pluralized string resources.
This commit is contained in:
parent
8f3e62245f
commit
5d15eef61d
4 changed files with 36 additions and 15 deletions
|
@ -131,7 +131,7 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
||||||
|
|
||||||
clickPref(
|
clickPref(
|
||||||
title = DSLSettingsText.from(R.string.PrivacySettingsFragment__blocked),
|
title = DSLSettingsText.from(R.string.PrivacySettingsFragment__blocked),
|
||||||
summary = DSLSettingsText.from(getString(R.string.PrivacySettingsFragment__d_contacts, state.blockedCount)),
|
summary = DSLSettingsText.from(resources.getQuantityString(R.plurals.PrivacySettingsFragment__d_contacts, state.blockedCount, state.blockedCount)),
|
||||||
onClick = {
|
onClick = {
|
||||||
Navigation.findNavController(requireView())
|
Navigation.findNavController(requireView())
|
||||||
.safeNavigate(R.id.action_privacySettingsFragment_to_blockedUsersActivity)
|
.safeNavigate(R.id.action_privacySettingsFragment_to_blockedUsersActivity)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.PluralsRes;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
|
@ -141,7 +142,7 @@ public class CallParticipantsListUpdatePopupWindow extends PopupWindow {
|
||||||
description = context.getString(getThreeMemberDescriptionResourceId(isAdded), getNextDisplayName(iterator), getNextDisplayName(iterator), getNextDisplayName(iterator));
|
description = context.getString(getThreeMemberDescriptionResourceId(isAdded), getNextDisplayName(iterator), getNextDisplayName(iterator), getNextDisplayName(iterator));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
description = context.getString(getManyMemberDescriptionResourceId(isAdded), getNextDisplayName(iterator), getNextDisplayName(iterator), recipients.size() - 2);
|
description = context.getResources().getQuantityString(getManyMemberDescriptionResourceId(isAdded), recipients.size() - 2, getNextDisplayName(iterator), getNextDisplayName(iterator), recipients.size() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptionTextView.setText(description);
|
descriptionTextView.setText(description);
|
||||||
|
@ -181,11 +182,11 @@ public class CallParticipantsListUpdatePopupWindow extends PopupWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @StringRes int getManyMemberDescriptionResourceId(boolean isAdded) {
|
private static @PluralsRes int getManyMemberDescriptionResourceId(boolean isAdded) {
|
||||||
if (isAdded) {
|
if (isAdded) {
|
||||||
return R.string.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined;
|
return R.plurals.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined;
|
||||||
} else {
|
} else {
|
||||||
return R.string.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left;
|
return R.plurals.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment {
|
||||||
|
|
||||||
public static ReviewCardDialogFragment createForReviewRequest(@NonNull RecipientId recipientId) {
|
public static ReviewCardDialogFragment createForReviewRequest(@NonNull RecipientId recipientId) {
|
||||||
return create(R.string.ReviewCardDialogFragment__review_request,
|
return create(R.string.ReviewCardDialogFragment__review_request,
|
||||||
R.string.ReviewCardDialogFragment__if_youre_not_sure,
|
R.plurals.ReviewCardDialogFragment__if_youre_not_sure,
|
||||||
R.string.ReviewCardDialogFragment__no_groups_in_common,
|
R.string.ReviewCardDialogFragment__no_groups_in_common,
|
||||||
R.plurals.ReviewCardDialogFragment__d_groups_in_common,
|
R.plurals.ReviewCardDialogFragment__d_groups_in_common,
|
||||||
recipientId,
|
recipientId,
|
||||||
|
@ -47,7 +47,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment {
|
||||||
|
|
||||||
public static ReviewCardDialogFragment createForReviewMembers(@NonNull GroupId.V2 groupId) {
|
public static ReviewCardDialogFragment createForReviewMembers(@NonNull GroupId.V2 groupId) {
|
||||||
return create(R.string.ReviewCardDialogFragment__review_members,
|
return create(R.string.ReviewCardDialogFragment__review_members,
|
||||||
R.string.ReviewCardDialogFragment__d_group_members_have_the_same_name,
|
R.plurals.ReviewCardDialogFragment__d_group_members_have_the_same_name,
|
||||||
R.string.ReviewCardDialogFragment__no_other_groups_in_common,
|
R.string.ReviewCardDialogFragment__no_other_groups_in_common,
|
||||||
R.plurals.ReviewCardDialogFragment__d_other_groups_in_common,
|
R.plurals.ReviewCardDialogFragment__d_other_groups_in_common,
|
||||||
null,
|
null,
|
||||||
|
@ -55,7 +55,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ReviewCardDialogFragment create(@StringRes int titleResId,
|
private static ReviewCardDialogFragment create(@StringRes int titleResId,
|
||||||
@StringRes int descriptionResId,
|
@PluralsRes int descriptionResId,
|
||||||
@StringRes int noGroupsInCommonResId,
|
@StringRes int noGroupsInCommonResId,
|
||||||
@PluralsRes int groupsInCommonResId,
|
@PluralsRes int groupsInCommonResId,
|
||||||
@Nullable RecipientId recipientId,
|
@Nullable RecipientId recipientId,
|
||||||
|
@ -92,7 +92,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment {
|
||||||
|
|
||||||
viewModel.getReviewCards().observe(getViewLifecycleOwner(), cards -> {
|
viewModel.getReviewCards().observe(getViewLifecycleOwner(), cards -> {
|
||||||
adapter.submitList(cards);
|
adapter.submitList(cards);
|
||||||
description.setText(getString(getDescriptionResId(), cards.size()));
|
description.setText(getResources().getQuantityString(getDescriptionResId(), cards.size(), cards.size()));
|
||||||
});
|
});
|
||||||
|
|
||||||
viewModel.getReviewEvents().observe(getViewLifecycleOwner(), this::onReviewEvent);
|
viewModel.getReviewEvents().observe(getViewLifecycleOwner(), this::onReviewEvent);
|
||||||
|
@ -105,7 +105,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment {
|
||||||
viewModel = new ViewModelProvider(this, factory).get(ReviewCardViewModel.class);
|
viewModel = new ViewModelProvider(this, factory).get(ReviewCardViewModel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private @StringRes int getDescriptionResId() {
|
private @PluralsRes int getDescriptionResId() {
|
||||||
return requireArguments().getInt(EXTRA_DESCRIPTION_RES_ID);
|
return requireArguments().getInt(EXTRA_DESCRIPTION_RES_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4227,8 +4227,16 @@
|
||||||
<string name="ReviewCardDialogFragment__review_members">Review members</string>
|
<string name="ReviewCardDialogFragment__review_members">Review members</string>
|
||||||
<!-- Title of a screen where the user will be prompted to review a message request matching the name of someone they already know -->
|
<!-- Title of a screen where the user will be prompted to review a message request matching the name of someone they already know -->
|
||||||
<string name="ReviewCardDialogFragment__review_request">Review request</string>
|
<string name="ReviewCardDialogFragment__review_request">Review request</string>
|
||||||
<string name="ReviewCardDialogFragment__d_group_members_have_the_same_name">%1$d group members have the same name, review the members below and choose to take action.</string>
|
<!-- Message of a screen where the user will be prompted to review a message request matching the name of someone they already know -->
|
||||||
<string name="ReviewCardDialogFragment__if_youre_not_sure">If you\'re not sure who the request is from, review the contacts below and take action.</string>
|
<plurals name="ReviewCardDialogFragment__d_group_members_have_the_same_name">
|
||||||
|
<item quantity="one">%1$d group member have the same name, review the member below and choose to take action.</item>
|
||||||
|
<item quantity="other">%1$d group members have the same name, review the members below and choose to take action.</item>
|
||||||
|
</plurals>
|
||||||
|
<!-- Message of a screen where the user will be prompted to review a message request matching the name of someone they already know -->
|
||||||
|
<plurals name="ReviewCardDialogFragment__if_youre_not_sure">
|
||||||
|
<item quantity="one">If you\'re not sure who the request is from, review the contact below and take action.</item>
|
||||||
|
<item quantity="other">If you\'re not sure who the request is from, review the contacts below and take action.</item>
|
||||||
|
</plurals>
|
||||||
<string name="ReviewCardDialogFragment__no_other_groups_in_common">No other groups in common.</string>
|
<string name="ReviewCardDialogFragment__no_other_groups_in_common">No other groups in common.</string>
|
||||||
<string name="ReviewCardDialogFragment__no_groups_in_common">No groups in common.</string>
|
<string name="ReviewCardDialogFragment__no_groups_in_common">No groups in common.</string>
|
||||||
<plurals name="ReviewCardDialogFragment__d_other_groups_in_common">
|
<plurals name="ReviewCardDialogFragment__d_other_groups_in_common">
|
||||||
|
@ -4259,12 +4267,20 @@
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_joined">%1$s joined</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_joined">%1$s joined</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_and_s_joined">%1$s and %2$s joined</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_and_s_joined">%1$s and %2$s joined</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_s_joined">%1$s, %2$s and %3$s joined</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_s_joined">%1$s, %2$s and %3$s joined</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined">%1$s, %2$s and %3$d others joined</string>
|
<!-- Toast message shown in group call when 3 or more people join -->
|
||||||
|
<plurals name="CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined">
|
||||||
|
<item quantity="one">%1$s, %2$s and %3$d other joined</item>
|
||||||
|
<item quantity="other">%1$s, %2$s and %3$d others joined</item>
|
||||||
|
</plurals>
|
||||||
<!-- Toast/popup text shown when someone leaves a group call -->
|
<!-- Toast/popup text shown when someone leaves a group call -->
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_left">%1$s left</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_left">%1$s left</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_and_s_left">%1$s and %2$s left</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_and_s_left">%1$s and %2$s left</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_s_left">%1$s, %2$s and %3$s left</string>
|
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_s_left">%1$s, %2$s and %3$s left</string>
|
||||||
<string name="CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left">%1$s, %2$s and %3$d others left</string>
|
<!-- Toast message shown in group call when 3 or more people leave -->
|
||||||
|
<plurals name="CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left">
|
||||||
|
<item quantity="one">%1$s, %2$s and %3$d other left</item>
|
||||||
|
<item quantity="other">%1$s, %2$s and %3$d others left</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
<string name="CallParticipant__you">You</string>
|
<string name="CallParticipant__you">You</string>
|
||||||
<string name="CallParticipant__you_on_another_device">You (on another device)</string>
|
<string name="CallParticipant__you_on_another_device">You (on another device)</string>
|
||||||
|
@ -4634,7 +4650,11 @@
|
||||||
|
|
||||||
<!-- PrivacySettingsFragment -->
|
<!-- PrivacySettingsFragment -->
|
||||||
<string name="PrivacySettingsFragment__blocked">Blocked</string>
|
<string name="PrivacySettingsFragment__blocked">Blocked</string>
|
||||||
<string name="PrivacySettingsFragment__d_contacts">%1$d contacts</string>
|
<!-- Settings label that shows the number blocked contacts -->
|
||||||
|
<plurals name="PrivacySettingsFragment__d_contacts">
|
||||||
|
<item quantity="one">%1$d contact</item>
|
||||||
|
<item quantity="other">%1$d contacts</item>
|
||||||
|
</plurals>
|
||||||
<string name="PrivacySettingsFragment__messaging">Messaging</string>
|
<string name="PrivacySettingsFragment__messaging">Messaging</string>
|
||||||
<string name="PrivacySettingsFragment__disappearing_messages">Disappearing messages</string>
|
<string name="PrivacySettingsFragment__disappearing_messages">Disappearing messages</string>
|
||||||
<string name="PrivacySettingsFragment__app_security">App security</string>
|
<string name="PrivacySettingsFragment__app_security">App security</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue