diff --git a/packages/web/src/commands/CommandPalette.svelte b/packages/web/src/commands/CommandPalette.svelte
index 795cd4fd3..2983b135c 100644
--- a/packages/web/src/commands/CommandPalette.svelte
+++ b/packages/web/src/commands/CommandPalette.svelte
@@ -114,8 +114,8 @@
($visibleCommandPalette == 'database'
? extractDbItems($databaseInfo, { conid, database }, $connectionList)
: parentCommand
- ? parentCommand.getSubCommands()
- : sortedComands
+ ? parentCommand.getSubCommands()
+ : sortedComands
).filter(x => !x.isGroupCommand),
{
extract: x => _tval(x.text),
@@ -163,10 +163,10 @@
on:clickOutside={() => {
$visibleCommandPalette = null;
}}
- data-testid='CommandPalette_main'
+ data-testid="CommandPalette_main"
>
-
{
$visibleCommandPalette = null;
}}
diff --git a/packages/web/src/commands/registerCommand.ts b/packages/web/src/commands/registerCommand.ts
index 50ae84015..0fae2bc48 100644
--- a/packages/web/src/commands/registerCommand.ts
+++ b/packages/web/src/commands/registerCommand.ts
@@ -45,7 +45,9 @@ export default function registerCommand(command: GlobalCommand) {
[command.id]: {
text:
isDefferedTranslationResult(command.category) || isDefferedTranslationResult(command.name)
- ? () => `${_tval(command.category)}: ${_tval(command.name)}`
+ ? {
+ _transCallback: () => `${_tval(command.category)}: ${_tval(command.name)}`,
+ }
: `${command.category}: ${command.name}`,
...command,
enabled: !testEnabled,
diff --git a/packages/web/src/translations.ts b/packages/web/src/translations.ts
index 04f16c79c..848beefa8 100644
--- a/packages/web/src/translations.ts
+++ b/packages/web/src/translations.ts
@@ -84,8 +84,9 @@ export function _t(key: string, options: TranslateOptions): string {
}
export type DefferedTranslationResult = {
- _transKey: string;
- _transOptions: TranslateOptions;
+ _transKey?: string;
+ _transOptions?: TranslateOptions;
+ _transCallback?: () => string;
};
export function __t(key: string, options: TranslateOptions): DefferedTranslationResult {
@@ -100,6 +101,10 @@ export function _tval(x: string | DefferedTranslationResult): string {
if (typeof x?._transKey === 'string') {
return _t(x._transKey, x._transOptions);
}
+ if (typeof x?._transCallback === 'function') {
+ return x._transCallback();
+ }
+ return '';
}
export function isDefferedTranslationResult(