diff options
author | Michael Bestas <mkbestas@lineageos.org> | 2018-08-04 16:35:32 +0300 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2018-08-30 20:21:55 +0200 |
commit | 7a51050f9fef78e4cccf919b57242e8f03cfc934 (patch) | |
tree | 199fa21e1f616a56d3aa9f128792a20cdd230124 | |
parent | f0a99b2aedaabb7ae50fca4d23e99d3198d4288f (diff) | |
download | android_packages_providers_DownloadProvider-7a51050f9fef78e4cccf919b57242e8f03cfc934.tar.gz android_packages_providers_DownloadProvider-7a51050f9fef78e4cccf919b57242e8f03cfc934.tar.bz2 android_packages_providers_DownloadProvider-7a51050f9fef78e4cccf919b57242e8f03cfc934.zip |
Fix plural translatability for download speed
Change-Id: I16ba80d0b8b0dbaddb03581a2ffa41cda5f4744c
-rw-r--r-- | res/values/cm_plurals.xml | 33 | ||||
-rw-r--r-- | res/values/cm_strings.xml | 11 | ||||
-rw-r--r-- | src/com/android/providers/downloads/DownloadNotifier.java | 8 |
3 files changed, 38 insertions, 14 deletions
diff --git a/res/values/cm_plurals.xml b/res/values/cm_plurals.xml new file mode 100644 index 00000000..b201ff51 --- /dev/null +++ b/res/values/cm_plurals.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Phrase describing a time duration using seconds [CHAR LIMIT=16] --> + <plurals name="duration_seconds"> + <item quantity="one"><xliff:g id="count">%d</xliff:g> sec</item> + <item quantity="other"><xliff:g id="count">%d</xliff:g> secs</item> + </plurals> + <!-- Phrase describing a time duration using minutes [CHAR LIMIT=16] --> + <plurals name="duration_minutes"> + <item quantity="one"><xliff:g id="count">%d</xliff:g> min</item> + <item quantity="other"><xliff:g id="count">%d</xliff:g> mins</item> + </plurals> + <!-- Phrase describing a time duration using hours [CHAR LIMIT=16] --> + <plurals name="duration_hours"> + <item quantity="one"><xliff:g id="count">%d</xliff:g> hr</item> + <item quantity="other"><xliff:g id="count">%d</xliff:g> hrs</item> + </plurals> +</resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 3a28aafa..842dbf45 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -16,16 +16,7 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Notification text containing download duration left and download speed --> - <string name="text_download_speed">%1$s, %2$s/s</string> - - <!-- Phrase describing a time duration using seconds [CHAR LIMIT=16] --> - <string name="duration_seconds">%d s</string> - - <!-- Phrase describing a time duration using minutes [CHAR LIMIT=16] --> - <string name="duration_minutes">%d min</string> - - <!-- Phrase describing a time duration using hours [CHAR LIMIT=16] --> - <string name="duration_hours">%d h</string> + <string name="text_download_speed"><xliff:g id="text">%1$s</xliff:g>, <xliff:g id="size" example="230 kB">%2$s</xliff:g>/s</string> <!-- Status indicating that the download has been paused to start in the future. Appears for an individual item in the download list. [CHAR LIMIT=24] --> diff --git a/src/com/android/providers/downloads/DownloadNotifier.java b/src/com/android/providers/downloads/DownloadNotifier.java index ee302b4c..db24db66 100644 --- a/src/com/android/providers/downloads/DownloadNotifier.java +++ b/src/com/android/providers/downloads/DownloadNotifier.java @@ -378,18 +378,18 @@ public class DownloadNotifier { if (remainingMillis >= DateUtils.HOUR_IN_MILLIS) { duration = (int) ((remainingMillis + 1800000) / DateUtils.HOUR_IN_MILLIS); - durationResId = R.string.duration_hours; + durationResId = R.plurals.duration_hours; } else if (remainingMillis >= DateUtils.MINUTE_IN_MILLIS) { duration = (int) ((remainingMillis + 30000) / DateUtils.MINUTE_IN_MILLIS); - durationResId = R.string.duration_minutes; + durationResId = R.plurals.duration_minutes; } else { duration = (int) ((remainingMillis + 500) / DateUtils.SECOND_IN_MILLIS); - durationResId = R.string.duration_seconds; + durationResId = R.plurals.duration_seconds; } remainingText = res.getString(R.string.download_remaining, - res.getString(durationResId, duration)); + res.getQuantityString(durationResId, duration, duration)); speedAsSizeText = Formatter.formatFileSize(mContext, speed); } |