Translate every Omarchy notification and the remaining prompts, matching templates longest first

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 22:16:55 -04:00
1 parent f63ecb6697
commit 619979a716
6 files changed
+89 -25

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ function tr(text) {
// Text built elsewhere around a name: the first English template that matches is translated with what %1.. captured.
function trMatch(text, templates) {
for (var i = 0; i < templates.length; i++) {
var pattern = "^" + templates[i].replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/%\d/g, "(.+?)") + "$"
var pattern = "^" + templates[i].replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/%\d/g, "(.+)") + "$"
var match = String(text).match(new RegExp(pattern))
if (match) return tr.apply(null, [templates[i]].concat(match.slice(1)))
}