chore(i18n): components.profile.*

This commit is contained in:
Slinetrac
2025-11-01 22:54:32 +08:00
Unverified
parent 730f607c68
commit d2cca2120d
22 changed files with 1679 additions and 903 deletions

View File

@@ -301,13 +301,26 @@ function logPreviewEntries(label, items) {
}
function removeKey(target, dottedKey) {
const parts = dottedKey.split(".");
const last = parts.pop();
if (
!target ||
typeof target !== "object" ||
Array.isArray(target) ||
dottedKey === ""
) {
return;
}
if (!last) return;
if (dottedKey in target) {
delete target[dottedKey];
return;
}
const parts = dottedKey.split(".").filter((part) => part !== "");
if (parts.length === 0) return;
let current = target;
for (const part of parts) {
for (let index = 0; index < parts.length; index += 1) {
const part = parts[index];
if (
!current ||
typeof current !== "object" ||
@@ -316,12 +329,12 @@ function removeKey(target, dottedKey) {
) {
return;
}
if (index === parts.length - 1) {
delete current[part];
return;
}
current = current[part];
}
if (current && typeof current === "object") {
delete current[last];
}
}
function cleanupEmptyBranches(target) {