Make priority strings translatable, #192

This commit is contained in:
Philipp Heckel 2022-03-30 20:15:01 -04:00
parent 8c2615091f
commit f35c598ae8
5 changed files with 22 additions and 11 deletions

View file

@ -194,7 +194,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
1 -> getString(R.string.settings_notifications_min_priority_summary_any) 1 -> getString(R.string.settings_notifications_min_priority_summary_any)
5 -> getString(R.string.settings_notifications_min_priority_summary_max) 5 -> getString(R.string.settings_notifications_min_priority_summary_max)
else -> { else -> {
val minPriorityString = toPriorityString(minPriorityValue) val minPriorityString = toPriorityString(requireContext(), minPriorityValue)
getString(R.string.settings_notifications_min_priority_summary_x_or_higher, minPriorityValue, minPriorityString) getString(R.string.settings_notifications_min_priority_summary_x_or_higher, minPriorityValue, minPriorityString)
} }
} }

View file

@ -84,14 +84,14 @@ fun toPriority(priority: Int?): Int {
else return 3 else return 3
} }
fun toPriorityString(priority: Int): String { fun toPriorityString(context: Context, priority: Int): String {
return when (priority) { return when (priority) {
1 -> "min" 1 -> context.getString(R.string.settings_notifications_priority_min)
2 -> "low" 2 -> context.getString(R.string.settings_notifications_priority_low)
3 -> "default" 3 -> context.getString(R.string.settings_notifications_priority_default)
4 -> "high" 4 -> context.getString(R.string.settings_notifications_priority_high)
5 -> "max" 5 -> context.getString(R.string.settings_notifications_priority_max)
else -> "default" else -> context.getString(R.string.settings_notifications_priority_default)
} }
} }

View file

@ -148,6 +148,11 @@
<string name="settings_notifications_min_priority_low">Niedrige Priorität und höher</string> <string name="settings_notifications_min_priority_low">Niedrige Priorität und höher</string>
<string name="settings_notifications_min_priority_default">Standard-Priorität und höher</string> <string name="settings_notifications_min_priority_default">Standard-Priorität und höher</string>
<string name="settings_notifications_min_priority_high">Hohe Priorität und höher</string> <string name="settings_notifications_min_priority_high">Hohe Priorität und höher</string>
<string name="settings_notifications_priority_min">min</string>
<string name="settings_notifications_priority_low">gering</string>
<string name="settings_notifications_priority_default">standard</string>
<string name="settings_notifications_priority_high">hoch</string>
<string name="settings_notifications_priority_max">max</string>
<string name="settings_notifications_auto_download_title">Anhänge herunterladen</string> <string name="settings_notifications_auto_download_title">Anhänge herunterladen</string>
<string name="settings_notifications_auto_download_summary_never">Anhänge nie automatisch herunterladen</string> <string name="settings_notifications_auto_download_summary_never">Anhänge nie automatisch herunterladen</string>
<string name="settings_notifications_auto_download_1m">Kleiner 1 MB</string> <string name="settings_notifications_auto_download_1m">Kleiner 1 MB</string>

View file

@ -236,6 +236,11 @@
<string name="settings_notifications_min_priority_default">Default priority and above</string> <string name="settings_notifications_min_priority_default">Default priority and above</string>
<string name="settings_notifications_min_priority_high">High priority and above</string> <string name="settings_notifications_min_priority_high">High priority and above</string>
<string name="settings_notifications_min_priority_max">Only max priority</string> <string name="settings_notifications_min_priority_max">Only max priority</string>
<string name="settings_notifications_priority_min">min</string>
<string name="settings_notifications_priority_low">low</string>
<string name="settings_notifications_priority_default">default</string>
<string name="settings_notifications_priority_high">high</string>
<string name="settings_notifications_priority_max">max</string>
<string name="settings_notifications_auto_download_title">Download attachments</string> <string name="settings_notifications_auto_download_title">Download attachments</string>
<string name="settings_notifications_auto_download_summary_always">Auto-download all attachments</string> <string name="settings_notifications_auto_download_summary_always">Auto-download all attachments</string>
<string name="settings_notifications_auto_download_summary_never">Never auto-download attachments</string> <string name="settings_notifications_auto_download_summary_never">Never auto-download attachments</string>

View file

@ -7,17 +7,18 @@ Bugs:
* IllegalStateException: Failed to build unique file (#177, thanks to @Fallenbagel for reporting) * IllegalStateException: Failed to build unique file (#177, thanks to @Fallenbagel for reporting)
* SQLiteConstraintException: Crash during UP registration (#185) * SQLiteConstraintException: Crash during UP registration (#185)
* Refresh preferences screen after settings import (#183, thanks to @cmeis for reporting) * Refresh preferences screen after settings import (#183, thanks to @cmeis for reporting)
* Add priority strings to strings.xml to make it translatable (#192, thanks to @StoyanDimitrov)
Translations: Translations:
* English language improvements (thanks to @comradekingu) * English language improvements (thanks to @comradekingu)
* Bulgarian (thanks to @StoyanDimitrov) * Bulgarian (thanks to @StoyanDimitrov)
* Dutch (incomplete, thanks to @diony](https://hosted.weblate.org/user/diony)) * Chinese/Simplified (thanks to @poi and @PeterCxy)
* Chinese (incomplete, thanks to @poi) * Dutch (incomplete, thanks to @diony)
* French (incomplete, thanks to @Kusoneko) * French (incomplete, thanks to @Kusoneko)
* German (thanks to @cmeis) * German (thanks to @cmeis)
* Italian (thanks to @theTranslator) * Italian (thanks to @theTranslator)
* Norwegian (incomplete, thanks to @comradekingu) * Norwegian (incomplete, thanks to @comradekingu)
* Portuguese (Brazil, thanks to @LW) * Portuguese/Brazil (thanks to @LW)
* Spanish (thanks to @rogeliodh) * Spanish (thanks to @rogeliodh)
* Turkish (thanks to @ersen) * Turkish (thanks to @ersen)