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
This commit is contained in:
evanpelle
2025-09-03 13:04:56 -07:00
committed by GitHub
parent 32fd6a83d0
commit 5699ef1e39
+5 -1
View File
@@ -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;
}