Skip to content

Commit

Permalink
Move push notification interval text to string so that it can be tran…
Browse files Browse the repository at this point in the history
…slated
  • Loading branch information
Nishith Khanna authored and mar-v-in committed Aug 29, 2023
1 parent fcdeb0a commit 7335ef2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
}

private fun getSummaryString(value: Int, learnt: Int): String = when (value) {
-1 -> "OFF"
0 -> "ON / Automatic: " + getHeartbeatString(learnt)
else -> "ON / Manual: " + getHeartbeatString(value * 60000)
-1 -> getString(R.string.push_notifications_summary_off)
0 -> getString(R.string.push_notifications_summary_automatic, getHeartbeatString(learnt))
else -> getString(R.string.push_notifications_summary_manual, getHeartbeatString(value * 60000))
}

private fun getHeartbeatString(heartbeatMs: Int): String {
return if (heartbeatMs < 120000) {
(heartbeatMs / 1000).toString() + " seconds"
} else (heartbeatMs / 60000).toString() + " minutes"
getString(R.string.push_notifications_summary_values_seconds, (heartbeatMs / 1000).toString())
} else getString(R.string.push_notifications_summary_values_minutes, (heartbeatMs / 60000).toString())
}

companion object {
Expand Down
5 changes: 5 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,9 @@ This can take a couple of minutes."</string>
<string name="pref_safetynet_test_no_result">No result</string>
<string name="pref_safetynet_test_invalid_json">Invalid JSON</string>

<string name="push_notifications_summary_off">OFF</string>
<string name="push_notifications_summary_automatic">ON / Automatic: %s</string>
<string name="push_notifications_summary_manual">ON / Manual: %s</string>
<string name="push_notifications_summary_values_seconds">%s seconds</string>
<string name="push_notifications_summary_values_minutes">%s minutes</string>
</resources>

4 comments on commit 7335ef2

@Vavun
Copy link
Contributor

@Vavun Vavun commented on 7335ef2 Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mar-v-in
Could you please represent the seconds and minutes strings as quantity strings?
It is necessary for correct translation into slavic languages.
1 секунда
2,3,4, секунды
5 .... секунд

@Vavun
Copy link
Contributor

@Vavun Vavun commented on 7335ef2 Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mar-v-in please 😭😭😭

@ildar
Copy link

@ildar ildar commented on 7335ef2 Feb 25, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vavun
Copy link
Contributor

@Vavun Vavun commented on 7335ef2 Feb 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ildar I only have a phone at the moment.
I definitely won’t make a pull request without being able to check its functionality.

Please sign in to comment.