mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-31 15:48:51 +01:00
🌐 refactor: Interpolate Localization Keys (#10650)
* fix: replace string concatenation of localization keys with interpolations and add keys for unlocalized string literals * chore: update test for new localization key --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
baeed16e21
commit
36be5ac013
28 changed files with 130 additions and 85 deletions
|
|
@ -160,9 +160,9 @@ const AdminSettings = () => {
|
|||
</Button>
|
||||
</OGDialogTrigger>
|
||||
<OGDialogContent className="border-border-light bg-surface-primary text-text-primary lg:w-1/4">
|
||||
<OGDialogTitle>{`${localize('com_ui_admin_settings')} - ${localize(
|
||||
'com_ui_agents',
|
||||
)}`}</OGDialogTitle>
|
||||
<OGDialogTitle>
|
||||
{localize('com_ui_admin_settings_section', { section: localize('com_ui_agents') })}
|
||||
</OGDialogTitle>
|
||||
<div className="p-2">
|
||||
{/* Role selection dropdown */}
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
|||
|
|
@ -315,9 +315,18 @@ export default function AgentConfig() {
|
|||
{/* Agent Tools & Actions */}
|
||||
<div className="mb-4">
|
||||
<label className={labelClass}>
|
||||
{`${toolsEnabled === true ? localize('com_ui_tools') : ''}
|
||||
${toolsEnabled === true && actionsEnabled === true ? ' + ' : ''}
|
||||
${actionsEnabled === true ? localize('com_assistants_actions') : ''}`}
|
||||
{(() => {
|
||||
if (toolsEnabled === true && actionsEnabled === true) {
|
||||
return localize('com_ui_tools_and_actions');
|
||||
}
|
||||
if (toolsEnabled === true) {
|
||||
return localize('com_ui_tools');
|
||||
}
|
||||
if (actionsEnabled === true) {
|
||||
return localize('com_assistants_actions');
|
||||
}
|
||||
return '';
|
||||
})()}
|
||||
</label>
|
||||
<div>
|
||||
<div className="mb-1">
|
||||
|
|
|
|||
|
|
@ -335,7 +335,8 @@ describe('AgentPanel - Update Agent Toast Messages', () => {
|
|||
|
||||
await waitFor(() => {
|
||||
expect(mockShowToast).toHaveBeenCalledWith({
|
||||
message: 'com_assistants_update_success Test Agent',
|
||||
message: 'com_assistants_update_success_name',
|
||||
status: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -355,7 +356,8 @@ describe('AgentPanel - Update Agent Toast Messages', () => {
|
|||
|
||||
await waitFor(() => {
|
||||
expect(mockShowToast).toHaveBeenCalledWith({
|
||||
message: 'com_assistants_update_success com_ui_agent',
|
||||
message: 'com_assistants_update_success_name',
|
||||
status: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -375,7 +377,8 @@ describe('AgentPanel - Update Agent Toast Messages', () => {
|
|||
|
||||
await waitFor(() => {
|
||||
expect(mockShowToast).toHaveBeenCalledWith({
|
||||
message: 'com_assistants_update_success Test Agent',
|
||||
message: 'com_assistants_update_success_name',
|
||||
status: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function getUpdateToastMessage(
|
|||
if (noVersionChange) {
|
||||
return localize('com_ui_no_changes');
|
||||
}
|
||||
return `${localize('com_assistants_update_success')} ${name ?? localize('com_ui_agent')}`;
|
||||
return localize('com_assistants_update_success_name', { name: name ?? localize('com_ui_agent') });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -504,20 +504,10 @@ export default function AgentPanel() {
|
|||
setCurrentAgentId(undefined);
|
||||
}}
|
||||
disabled={agentQuery.isInitialLoading}
|
||||
aria-label={
|
||||
localize('com_ui_create') +
|
||||
' ' +
|
||||
localize('com_ui_new') +
|
||||
' ' +
|
||||
localize('com_ui_agent')
|
||||
}
|
||||
aria-label={localize('com_ui_create_new_agent')}
|
||||
>
|
||||
<Plus className="mr-1 h-4 w-4" />
|
||||
{localize('com_ui_create') +
|
||||
' ' +
|
||||
localize('com_ui_new') +
|
||||
' ' +
|
||||
localize('com_ui_agent')}
|
||||
{localize('com_ui_create_new_agent')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="submit"
|
||||
|
|
@ -526,7 +516,7 @@ export default function AgentPanel() {
|
|||
e.preventDefault();
|
||||
handleSelectAgent();
|
||||
}}
|
||||
aria-label={localize('com_ui_select') + ' ' + localize('com_ui_agent')}
|
||||
aria-label={localize('com_ui_select_agent')}
|
||||
>
|
||||
{localize('com_ui_select')}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export default function AgentSelect({
|
|||
};
|
||||
}, [selectedAgentId, agents, onSelect]);
|
||||
|
||||
const createAgent = localize('com_ui_create') + ' ' + localize('com_ui_agent');
|
||||
const createAgent = localize('com_ui_create_new_agent');
|
||||
|
||||
return (
|
||||
<Controller
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export default function DeleteButton({
|
|||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
aria-label={localize('com_ui_delete') + ' ' + localize('com_ui_agent')}
|
||||
aria-label={localize('com_ui_delete_agent')}
|
||||
type="button"
|
||||
>
|
||||
<div className="flex w-full items-center justify-center gap-2 text-red-500">
|
||||
|
|
@ -96,7 +96,7 @@ export default function DeleteButton({
|
|||
</Button>
|
||||
</OGDialogTrigger>
|
||||
<OGDialogTemplate
|
||||
title={localize('com_ui_delete') + ' ' + localize('com_ui_agent')}
|
||||
title={localize('com_ui_delete_agent')}
|
||||
className="max-w-[450px]"
|
||||
main={
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export default function DuplicateAgent({ agent_id }: { agent_id: string }) {
|
|||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
aria-label={localize('com_ui_duplicate') + ' ' + localize('com_ui_agent')}
|
||||
aria-label={localize('com_ui_duplicate_agent')}
|
||||
type="button"
|
||||
onClick={handleDuplicate}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ export default function AssistantSelect({
|
|||
};
|
||||
}, [selectedAssistant, query.data, onSelect]);
|
||||
|
||||
const createAssistant = localize('com_ui_create') + ' ' + localize('com_ui_assistant');
|
||||
const createAssistant = localize('com_ui_create_assistant');
|
||||
return (
|
||||
<SelectDropDown
|
||||
value={!value ? createAssistant : value}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export default function ContextButton({
|
|||
</button>
|
||||
</DialogTrigger>
|
||||
<DialogTemplate
|
||||
title={localize('com_ui_delete') + ' ' + localize('com_ui_assistant')}
|
||||
title={localize('com_ui_delete_assistant')}
|
||||
className="max-w-[450px]"
|
||||
main={
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ function MCPPanelContent() {
|
|||
variant="outline"
|
||||
className="flex-1 justify-start dark:hover:bg-gray-700"
|
||||
onClick={() => handleServerClickToEdit(server.serverName)}
|
||||
aria-label={localize('com_ui_edit') + ' ' + server.serverName}
|
||||
aria-label={localize('com_ui_edit_server', { serverName: server.serverName })}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<span>{server.serverName}</span>
|
||||
|
|
|
|||
|
|
@ -149,9 +149,9 @@ const AdminSettings = () => {
|
|||
</Button>
|
||||
</OGDialogTrigger>
|
||||
<OGDialogContent className="border-border-light bg-surface-primary text-text-primary lg:w-1/4">
|
||||
<OGDialogTitle>{`${localize('com_ui_admin_settings')} - ${localize(
|
||||
'com_ui_memories',
|
||||
)}`}</OGDialogTitle>
|
||||
<OGDialogTitle>
|
||||
{localize('com_ui_admin_settings_section', { section: localize('com_ui_memories') })}
|
||||
</OGDialogTitle>
|
||||
<div className="p-2">
|
||||
{/* Role selection dropdown */}
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue