Skip to content

Change Alarm Text in Clock Widget#1341

Open
abdul2801 wants to merge 3 commits intoMM2-0:mainfrom
abdul2801:main
Open

Change Alarm Text in Clock Widget#1341
abdul2801 wants to merge 3 commits intoMM2-0:mainfrom
abdul2801:main

Conversation

@abdul2801
Copy link
Copy Markdown

@abdul2801 abdul2801 commented Apr 3, 2025

fixes #1310
Changed Alarm Text from
in x hours to in x hrs y mins

Comment on lines +70 to +81
private fun formatRemainingTime(alarmTime: Long, currentTime: Long): String {
val diff = alarmTime - currentTime
val minutes = (diff / (1000 * 60)) % 60
val hours = diff / (1000 * 60 * 60)

return if (hours > 0) {
"in $hours hr${if (hours > 1) "s" else ""} $minutes min${if (minutes != 1L) "s" else ""}"
} else {
"in $minutes min${if (minutes != 1L) "s" else ""}"
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This isn't translatable. It will look out of place in languages that aren't English.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah, I see the challenge with translation here. Since DateUtils.getRelativeTimeSpanString doesn’t support formatting like “x hrs y mins,” and I’m not aware of any other built-in function that does, I’m not quite sure how to approach this. Please feel free to close the PR or share any ideas on how to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants