mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:20:45 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user