App reorganization

This commit is contained in:
adilallo
2026-04-18 14:12:49 -06:00
parent f866d11ff8
commit e9dab04b34
288 changed files with 2698 additions and 5029 deletions
-28
View File
@@ -26,31 +26,3 @@ export function getTranslation(messages: Messages, key: string): string {
return typeof value === "string" ? value : key;
}
/**
* Type-safe helper to get nested values from messages
* Usage: getNested(messages, "heroBanner", "title")
*/
export function getNested<T extends keyof Messages>(
messages: Messages,
namespace: T,
key: string,
): string {
const namespaceObj = messages[namespace];
if (!namespaceObj || typeof namespaceObj !== "object") {
return key;
}
const keys = key.split(".");
let value: unknown = namespaceObj;
for (const k of keys) {
if (value && typeof value === "object" && k in value) {
value = (value as Record<string, unknown>)[k];
} else {
return key;
}
}
return typeof value === "string" ? value : key;
}