From 5699ef1e3911eb7ab7c8103b4f1473b95cab875b Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 3 Sep 2025 13:04:56 -0700 Subject: [PATCH] Better pattern name formatting (#1998) ## Description: Remove underscores and capitalize when no translation key if found for pattern. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan --- src/client/components/PatternButton.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/components/PatternButton.ts b/src/client/components/PatternButton.ts index 00e4d5940..557967107 100644 --- a/src/client/components/PatternButton.ts +++ b/src/client/components/PatternButton.ts @@ -25,7 +25,11 @@ export class PatternButton extends LitElement { private translatePatternName(prefix: string, patternName: string): string { const translation = translateText(`${prefix}.${patternName}`); if (translation.startsWith(prefix)) { - return patternName[0].toUpperCase() + patternName.substring(1); + return patternName + .split("_") + .filter((word) => word.length > 0) + .map((word) => word[0].toUpperCase() + word.substring(1)) + .join(" "); } return translation; }