update extension api

This commit is contained in:
vcoppe
2025-11-25 19:18:54 +01:00
parent f13d8c1e22
commit 467cb2e589
3 changed files with 50 additions and 8 deletions

View File

@@ -14,7 +14,7 @@ class Locale {
private _isLoadingInitial = $state(true);
private _isLoading = $state(true);
private dictionary: Dictionary = $state({});
private _t = $derived((key: string) => {
private _t = $derived((key: string, fallback?: string) => {
const keys = key.split('.');
let value: string | Dictionary = this.dictionary;
@@ -22,7 +22,7 @@ class Locale {
if (value && typeof value === 'object' && k in value) {
value = value[k];
} else {
return key;
return fallback || key;
}
}