diff --git a/UI/BigComponents/FilterviewWithFields.svelte b/UI/BigComponents/FilterviewWithFields.svelte
index 8e356eb2f2..f482b57e9e 100644
--- a/UI/BigComponents/FilterviewWithFields.svelte
+++ b/UI/BigComponents/FilterviewWithFields.svelte
@@ -1,57 +1,60 @@
- {#each parts as part, i}
- {#if part.endsWith("}")}
-
-
- {:else}
- {part}
- {/if}
- {/each}
+ {#each parts as part, i}
+ {#if part.subs}
+
+
+
+
+ {:else}
+ {part.message}
+ {/if}
+ {/each}
diff --git a/Utils.ts b/Utils.ts
index 62e4e2e65c..58916c5b13 100644
--- a/Utils.ts
+++ b/Utils.ts
@@ -1430,7 +1430,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return true
}
- static SameObject(a: any, b: any) {
+ public static SameObject(a: any, b: any) {
if (a === b) {
return true
}
@@ -1465,4 +1465,29 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
) {
return Math.abs(c0.r - c1.r) + Math.abs(c0.g - c1.g) + Math.abs(c0.b - c1.b)
}
+
+ /**
+ *
+ * Utils.splitIntoSubstitutionParts("abc") // => [{message: "abc"}]
+ * Utils.splitIntoSubstitutionParts("abc {search} def") // => [{message: "abc "}, {subs: "search"}, {message: " def"}]
+ *
+ */
+ public static splitIntoSubstitutionParts(template: string): ({ message: string } | {subs: string})[]{
+ const preparts = template.split("{")
+ const spec : ({ message: string } | {subs: string})[] = []
+ for (const prepart of preparts) {
+ const postParts = prepart.split("}")
+ if(postParts.length === 1){
+ // This was a normal part
+ spec.push({message: postParts[0]})
+ }else{
+ const [subs, message] = postParts
+ spec.push({subs})
+ if(message !== ""){
+ spec.push({message})
+ }
+ }
+ }
+ return spec
+ }
}