feat: more prune

This commit is contained in:
tresabhi committed 2025-01-19 12:46:57 -06:00
1 parent d6a1357a82
commit 0506e361b2
9 files changed
+1238 -1432

No files matched your search

+5 -1
View File
@@ -19,9 +19,13 @@ function prune(defaultStrings: TranslationTree, strings: TranslationTree) {
if (typeof defaultStrings[key] === typeof strings[key]) {
if (typeof strings[key] === 'string') {
if (
// are equivalent regardless of %s flavor
(defaultStrings[key] as string).replaceAll(/%s\d/g, '%s') ===
(strings[key] as string).replaceAll(/%s\d/g, '%s') ||
strings[key] === ''
// string is empty
strings[key] === '' ||
// string has old flavor of %s
strings[key].match(/%s([^\d]|$)/g) !== null
) {
delete strings[key];
}