mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-26 13:02:34 +01:00
use plural string for dynamic_seek_duration_description
This commit is contained in:
parent
09d36a5dbc
commit
54f71c623a
@ -1,6 +1,7 @@
|
|||||||
package org.schabi.newpipe.settings;
|
package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@ -22,12 +23,19 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
//initializing R.array.seek_duration_description to display the translation of seconds
|
//initializing R.array.seek_duration_description to display the translation of seconds
|
||||||
String[] durationsDescriptions = getResources().getStringArray(R.array.seek_duration_description);
|
Resources res = getResources();
|
||||||
String[] durationsValues = getResources().getStringArray(R.array.seek_duration_value);
|
String[] durationsValues = res.getStringArray(R.array.seek_duration_value);
|
||||||
|
String[] durationsDescriptions = res.getStringArray(R.array.seek_duration_description);
|
||||||
int currentDurationValue;
|
int currentDurationValue;
|
||||||
for (int i = 0; i < durationsDescriptions.length; i++) {
|
for (int i = 0; i < durationsDescriptions.length; i++) {
|
||||||
currentDurationValue = Integer.parseInt(durationsValues[i]) / 1000;
|
currentDurationValue = Integer.parseInt(durationsValues[i]) / 1000;
|
||||||
durationsDescriptions[i] = String.format(durationsDescriptions[i], currentDurationValue);
|
try {
|
||||||
|
durationsDescriptions[i] = String.format(
|
||||||
|
res.getQuantityString(R.plurals.dynamic_seek_duration_description, currentDurationValue),
|
||||||
|
currentDurationValue);
|
||||||
|
} catch (Resources.NotFoundException ignored) {
|
||||||
|
//if this happens, the translation is missing, and the english string will be displayed instead
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key));
|
ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key));
|
||||||
durations.setEntries(durationsDescriptions);
|
durations.setEntries(durationsDescriptions);
|
||||||
|
@ -538,10 +538,12 @@
|
|||||||
<string name="delete_downloaded_files">Forviŝi elŝutitajn dosierojn</string>
|
<string name="delete_downloaded_files">Forviŝi elŝutitajn dosierojn</string>
|
||||||
<string name="deleted_downloads">%1$s elŝutoj forviŝitaj</string>
|
<string name="deleted_downloads">%1$s elŝutoj forviŝitaj</string>
|
||||||
<string name="videos_string">Filmetoj</string>
|
<string name="videos_string">Filmetoj</string>
|
||||||
<string name="dynamic_seek_duration_description">%s sekundoj</string>
|
|
||||||
<string name="permission_display_over_apps">Doni la permeson por afiŝiĝi supre aliaj apoj</string>
|
<string name="permission_display_over_apps">Doni la permeson por afiŝiĝi supre aliaj apoj</string>
|
||||||
<string name="app_language_title">Lingvo de la apo</string>
|
<string name="app_language_title">Lingvo de la apo</string>
|
||||||
<string name="systems_language">Sistemnormo</string>
|
<string name="systems_language">Sistemnormo</string>
|
||||||
<string name="subtitle_activity_recaptcha">Premu « Finita » kiam solvita</string>
|
<string name="subtitle_activity_recaptcha">Premu « Finita » kiam solvita</string>
|
||||||
<string name="recaptcha_done_button">Finita</string>
|
<string name="recaptcha_done_button">Finita</string>
|
||||||
|
<plurals name="dynamic_seek_duration_description">
|
||||||
|
<item quantity="other">%s sekundoj</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
@ -31,12 +31,14 @@
|
|||||||
<string name="seek_duration_key" translatable="false">seek_duration</string>
|
<string name="seek_duration_key" translatable="false">seek_duration</string>
|
||||||
<string name="seek_duration_default_value" translatable="false">10000</string>
|
<string name="seek_duration_default_value" translatable="false">10000</string>
|
||||||
<string-array name="seek_duration_description" translatable="false">
|
<string-array name="seek_duration_description" translatable="false">
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
<!-- They are overridden in VideoAudioSettingsFragment.java if the translation
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
(dynamic_seek_duration_description) exist. Otherwise this array is picked-->
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
<item>5 seconds</item>
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
<item>10 seconds</item>
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
<item>15 seconds</item>
|
||||||
<item>@string/dynamic_seek_duration_description</item>
|
<item>20 seconds</item>
|
||||||
|
<item>25 seconds</item>
|
||||||
|
<item>30 seconds</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="seek_duration_value" translatable="false">
|
<string-array name="seek_duration_value" translatable="false">
|
||||||
<item>5000</item>
|
<item>5000</item>
|
||||||
|
@ -593,4 +593,9 @@
|
|||||||
<string name="app_language_title">App language</string>
|
<string name="app_language_title">App language</string>
|
||||||
<string name="systems_language">System default</string>
|
<string name="systems_language">System default</string>
|
||||||
<string name="dynamic_seek_duration_description">%s seconds</string>
|
<string name="dynamic_seek_duration_description">%s seconds</string>
|
||||||
|
<plurals name="dynamic_seek_duration_description">
|
||||||
|
<item quantity="few">%s seconds</item>
|
||||||
|
<item quantity="many">%s seconds</item>
|
||||||
|
<item quantity="other">%s seconds</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user