2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Use correct plural

Summary: Some languages have more plurals than the english language. This enables translaters to select the appropriate plural form.

Test Plan: No change in english

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D11001
This commit is contained in:
Nicolas Fella
2018-03-04 13:18:54 +01:00
parent 22e65626cc
commit fb7dc4be65
2 changed files with 7 additions and 11 deletions

View File

@@ -104,8 +104,10 @@
<string name="incoming_file_text">%1s</string> <string name="incoming_file_text">%1s</string>
<string name="outgoing_file_title">Sending file to %1s</string> <string name="outgoing_file_title">Sending file to %1s</string>
<string name="outgoing_files_title">Sending files to %1s</string> <string name="outgoing_files_title">Sending files to %1s</string>
<string name="outgoing_file_text">%1s</string> <plurals name="outgoing_files_text">
<string name="outgoing_files_text">Sent %1$d out of %2$d files</string> <item quantity="one">Sent %1$d file</item>
<item quantity="other">Sent %1$d out of %2$d files</item>
</plurals>
<string name="received_file_title">Received file from %1s</string> <string name="received_file_title">Received file from %1s</string>
<string name="received_file_fail_title">Failed receiving file from %1s</string> <string name="received_file_fail_title">Failed receiving file from %1s</string>
<string name="received_file_text">Tap to open \'%1s\'</string> <string name="received_file_text">Tap to open \'%1s\'</string>

View File

@@ -81,11 +81,7 @@ class NotificationUpdateCallback extends Device.SendPackageStatusCallback {
private void updateText() { private void updateText() {
String text; String text;
if (numFiles > 1) { text = res.getQuantityString(R.plurals.outgoing_files_text, numFiles, sentFiles, numFiles);
text = res.getString(R.string.outgoing_files_text, sentFiles, numFiles);
} else {
text = res.getString(R.string.outgoing_file_text, device.getName());
}
builder.setContentText(text); builder.setContentText(text);
} }
@@ -93,11 +89,10 @@ class NotificationUpdateCallback extends Device.SendPackageStatusCallback {
int icon; int icon;
String title; String title;
String text; String text;
int progress;
if (successful) { if (successful) {
progress = 1;
if (numFiles > 1) { if (numFiles > 1) {
text = res.getString(R.string.outgoing_files_text, sentFiles, numFiles); text = res.getQuantityString(R.plurals.outgoing_files_text, numFiles, sentFiles, numFiles);
} else { } else {
final String filename = toSend.get(0).getString("filename"); final String filename = toSend.get(0).getString("filename");
text = res.getString(R.string.sent_file_text, filename); text = res.getString(R.string.sent_file_text, filename);
@@ -105,7 +100,6 @@ class NotificationUpdateCallback extends Device.SendPackageStatusCallback {
title = res.getString(R.string.sent_file_title, device.getName()); title = res.getString(R.string.sent_file_title, device.getName());
icon = android.R.drawable.stat_sys_upload_done; icon = android.R.drawable.stat_sys_upload_done;
} else { } else {
progress = 0;
final String filename = toSend.get(sentFiles).getString("filename"); final String filename = toSend.get(sentFiles).getString("filename");
title = res.getString(R.string.sent_file_failed_title, device.getName()); title = res.getString(R.string.sent_file_failed_title, device.getName());
text = res.getString(R.string.sent_file_failed_text, filename); text = res.getString(R.string.sent_file_failed_text, filename);