Refactor to use _val for translation handling across components

This commit is contained in:
Stela Augustinova
2025-11-07 14:40:52 +01:00
parent bda5c4f5dd
commit e694aca70b
7 changed files with 21 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import { commands } from '../stores';
import { invalidateCommandDefinitions } from './invalidateCommands';
import _ from 'lodash';
import { _val } from '../translations';
export interface SubCommand {
text: string;
@@ -43,11 +44,9 @@ export default function registerCommand(command: GlobalCommand) {
...x,
[command.id]: {
text:
_.isFunction(command.category) || _.isFunction(command.name)
_val(command.category) || _val(command.name)
? () =>
`${_.isFunction(command.category) ? command.category() : command.category}: ${
_.isFunction(command.name) ? command.name() : command.name
}`
`${_val(command.category)}: ${_val(command.name)}`
: `${command.category}: ${command.name}`,
...command,
enabled: !testEnabled,