2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +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="outgoing_file_title">Sending file to %1s</string>
<string name="outgoing_files_title">Sending files to %1s</string>
<string name="outgoing_file_text">%1s</string>
<string name="outgoing_files_text">Sent %1$d out of %2$d files</string>
<plurals name="outgoing_files_text">
<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_fail_title">Failed receiving file from %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() {
String text;
if (numFiles > 1) {
text = res.getString(R.string.outgoing_files_text, sentFiles, numFiles);
} else {
text = res.getString(R.string.outgoing_file_text, device.getName());
}
text = res.getQuantityString(R.plurals.outgoing_files_text, numFiles, sentFiles, numFiles);
builder.setContentText(text);
}
@ -93,11 +89,10 @@ class NotificationUpdateCallback extends Device.SendPackageStatusCallback {
int icon;
String title;
String text;
int progress;
if (successful) {
progress = 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 {
final String filename = toSend.get(0).getString("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());
icon = android.R.drawable.stat_sys_upload_done;
} else {
progress = 0;
final String filename = toSend.get(sentFiles).getString("filename");
title = res.getString(R.string.sent_file_failed_title, device.getName());
text = res.getString(R.string.sent_file_failed_text, filename);