Pluralize chat length limit custom setting.

This commit is contained in:
Cody Henthorne 2023-10-03 10:16:05 -04:00
parent 6279149cb8
commit 880ce18fd0
2 changed files with 8 additions and 4 deletions

View file

@ -93,7 +93,7 @@ public class StoragePreferenceFragment extends ListSummaryPreferenceFragment {
keepMessages.setSummary(SignalStore.settings().getKeepMessagesDuration().getStringResource()); keepMessages.setSummary(SignalStore.settings().getKeepMessagesDuration().getStringResource());
trimLength.setSummary(SignalStore.settings().isTrimByLengthEnabled() ? getString(R.string.preferences_storage__s_messages, NumberFormat.getInstance().format(SignalStore.settings().getThreadTrimLength())) trimLength.setSummary(SignalStore.settings().isTrimByLengthEnabled() ? getResources().getQuantityString(R.plurals.preferences_storage__s_messages_plural, SignalStore.settings().getThreadTrimLength(), NumberFormat.getInstance().format(SignalStore.settings().getThreadTrimLength()))
: getString(R.string.preferences_storage__none)); : getString(R.string.preferences_storage__none));
} }
@ -197,7 +197,7 @@ public class StoragePreferenceFragment extends ListSummaryPreferenceFragment {
for (int option : options) { for (int option : options) {
boolean isSelected = option == trimLength; boolean isSelected = option == trimLength;
String text = option == 0 ? activity.getString(R.string.preferences_storage__none) String text = option == 0 ? activity.getString(R.string.preferences_storage__none)
: activity.getString(R.string.preferences_storage__s_messages, NumberFormat.getInstance().format(option)); : activity.getResources().getQuantityString(R.plurals.preferences_storage__s_messages_plural, option, NumberFormat.getInstance().format(option));
settings.add(new SingleSelectSetting.Item(option, text, null, isSelected)); settings.add(new SingleSelectSetting.Item(option, text, null, isSelected));
@ -209,7 +209,7 @@ public class StoragePreferenceFragment extends ListSummaryPreferenceFragment {
activity.getString(R.string.preferences_storage__custom), activity.getString(R.string.preferences_storage__custom),
!hasSelection, !hasSelection,
currentValue, currentValue,
activity.getString(R.string.preferences_storage__s_messages, NumberFormat.getInstance().format(currentValue)))); activity.getResources().getQuantityString(R.plurals.preferences_storage__s_messages_plural, currentValue, NumberFormat.getInstance().format(currentValue))));
return settings; return settings;
} }

View file

@ -2999,7 +2999,11 @@
<string name="preferences_storage__six_months">6 months</string> <string name="preferences_storage__six_months">6 months</string>
<string name="preferences_storage__thirty_days">30 days</string> <string name="preferences_storage__thirty_days">30 days</string>
<string name="preferences_storage__none">None</string> <string name="preferences_storage__none">None</string>
<string name="preferences_storage__s_messages">%1$s messages</string> <plurals name="preferences_storage__s_messages_plural">
<item quantity="one">%1$s message</item>
<item quantity="other">%1$s messages</item>
</plurals>
<string name="preferences_storage__custom">Custom</string> <string name="preferences_storage__custom">Custom</string>
<string name="preferences_advanced__use_system_emoji">Use system emoji</string> <string name="preferences_advanced__use_system_emoji">Use system emoji</string>
<string name="preferences_advanced__relay_all_calls_through_the_signal_server_to_avoid_revealing_your_ip_address">Relay all calls through the Signal server to avoid revealing your IP address to your contact. Enabling will reduce call quality.</string> <string name="preferences_advanced__relay_all_calls_through_the_signal_server_to_avoid_revealing_your_ip_address">Relay all calls through the Signal server to avoid revealing your IP address to your contact. Enabling will reduce call quality.</string>