From eb35b3a249c7a630c1d061334b5a8185d475c21f Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Fri, 29 Aug 2025 13:36:46 +0800
Subject: [PATCH] =?UTF-8?q?Fix=20grammatical=20error=20in=20Awake=20taskba?=
=?UTF-8?q?r=20context=20menu:=20"1=20hours"=20=E2=86=92=20"1=20hour"=20(#?=
=?UTF-8?q?41454)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This PR fixes a grammatical mistake in the PowerToys Awake taskbar
context menu where "1 hours" was displayed instead of the correct "1
hour".
## Problem
When right-clicking the Awake icon in the taskbar and hovering over
"Keep awake on interval", the menu incorrectly showed "1 hours" for the
one-hour option, which is grammatically incorrect in English.

## Root Cause
The code always used the `AWAKE_HOURS` resource string (`"{0} hours"`)
regardless of the value, even when the count was 1. This resulted in
grammatically incorrect text like "1 hours".
## Solution
Added proper singular/plural handling by:
1. **Added new singular resources:**
- `AWAKE_HOUR`: `"{0} hour"` for singular form
- `AWAKE_MINUTE`: `"{0} minute"` for completeness and future-proofing
2. **Updated the logic in `Manager.cs`:**
- Modified `GetDefaultTrayOptions()` to use `AwakeHour` (singular) when
the value is 1
- Preserved existing behavior for all other values (30 minutes, 2 hours,
etc.)
3. **Generated corresponding code in `Resources.Designer.cs`** to expose
the new resource properties
## Impact
- ✅ "1 hours" → "1 hour" (grammatically correct)
- ✅ "2 hours" remains unchanged (still correct)
- ✅ "30 minutes" behavior preserved
- ✅ No breaking changes to existing functionality
- ✅ Future-proofed for potential 1-minute custom intervals
The fix follows established patterns in the PowerToys codebase (similar
to `TimeRemainingConverter.cs` in ImageResizer) and makes minimal,
surgical changes to address only the reported issue.
Fixes #41220.
> [!WARNING]
>
>
> Firewall rules blocked me from connecting to one or more
addresses (expand for details)
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `i1qvsblobprodcus353.vsblob.vsassets.io`
> - Triggering command: `dotnet build
src/modules/awake/Awake/Awake.csproj` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/microsoft/PowerToys/settings/copilot/coding_agent)
(admins only)
>
>
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
---
src/modules/awake/Awake/Core/Manager.cs | 4 +++-
.../Awake/Properties/Resources.Designer.cs | 18 ++++++++++++++++++
.../awake/Awake/Properties/Resources.resx | 8 ++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/modules/awake/Awake/Core/Manager.cs b/src/modules/awake/Awake/Core/Manager.cs
index 4ce733dfc3..df4ac87581 100644
--- a/src/modules/awake/Awake/Core/Manager.cs
+++ b/src/modules/awake/Awake/Core/Manager.cs
@@ -49,7 +49,9 @@ namespace Awake.Core
private static DateTimeOffset ExpireAt { get; set; }
+ private static readonly CompositeFormat AwakeMinute = CompositeFormat.Parse(Resources.AWAKE_MINUTE);
private static readonly CompositeFormat AwakeMinutes = CompositeFormat.Parse(Resources.AWAKE_MINUTES);
+ private static readonly CompositeFormat AwakeHour = CompositeFormat.Parse(Resources.AWAKE_HOUR);
private static readonly CompositeFormat AwakeHours = CompositeFormat.Parse(Resources.AWAKE_HOURS);
private static readonly BlockingCollection _stateQueue;
private static CancellationTokenSource _tokenSource;
@@ -451,7 +453,7 @@ namespace Awake.Core
Dictionary optionsList = new()
{
{ string.Format(CultureInfo.InvariantCulture, AwakeMinutes, 30), 1800 },
- { string.Format(CultureInfo.InvariantCulture, AwakeHours, 1), 3600 },
+ { string.Format(CultureInfo.InvariantCulture, AwakeHour, 1), 3600 },
{ string.Format(CultureInfo.InvariantCulture, AwakeHours, 2), 7200 },
};
return optionsList;
diff --git a/src/modules/awake/Awake/Properties/Resources.Designer.cs b/src/modules/awake/Awake/Properties/Resources.Designer.cs
index 1e2b941a6b..905518f6bc 100644
--- a/src/modules/awake/Awake/Properties/Resources.Designer.cs
+++ b/src/modules/awake/Awake/Properties/Resources.Designer.cs
@@ -159,6 +159,15 @@ namespace Awake.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to {0} hour.
+ ///
+ internal static string AWAKE_HOUR {
+ get {
+ return ResourceManager.GetString("AWAKE_HOUR", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {0} hours.
///
@@ -240,6 +249,15 @@ namespace Awake.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to {0} minute.
+ ///
+ internal static string AWAKE_MINUTE {
+ get {
+ return ResourceManager.GetString("AWAKE_MINUTE", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {0} minutes.
///
diff --git a/src/modules/awake/Awake/Properties/Resources.resx b/src/modules/awake/Awake/Properties/Resources.resx
index 375ac385d1..76ff5b234d 100644
--- a/src/modules/awake/Awake/Properties/Resources.resx
+++ b/src/modules/awake/Awake/Properties/Resources.resx
@@ -123,6 +123,10 @@
Exit
+
+ {0} hour
+ {0} shouldn't be removed. It will be replaced by the number 1 at runtime by the application. Used for defining a period to keep the PC awake.
+
{0} hours
{0} shouldn't be removed. It will be replaced by a number greater than 1 at runtime by the application. Used for defining a period to keep the PC awake.
@@ -142,6 +146,10 @@
Keep awake until expiration date and time
Keep the system awake until expiration date and time
+
+ {0} minute
+ {0} shouldn't be removed. It will be replaced by the number 1 at runtime by the application. Used for defining a period to keep the PC awake.
+
{0} minutes
{0} shouldn't be removed. It will be replaced by a number greater than 1 at runtime by the application. Used for defining a period to keep the PC awake.