feat: localize demo ui content
This commit is contained in:
@@ -750,6 +750,20 @@ var TRANSLATIONS = {
|
||||
'agents.toast.lifecycle_error_message': 'Failed to update agent lifecycle',
|
||||
'agents.toast.endpoint_title': 'MCP endpoint copied',
|
||||
|
||||
// Demo content
|
||||
'demo.agent.revops-copilot.display_name': 'RevOps Copilot',
|
||||
'demo.agent.revops-copilot.description': 'Revenue operations assistant with CRM and billing tools.',
|
||||
'demo.agent.support-triage.display_name': 'Support Triage',
|
||||
'demo.agent.support-triage.description': 'Draft support agent focused on unary gRPC workflows.',
|
||||
'demo.operation.crm_create_lead.display_name': 'Create CRM Lead',
|
||||
'demo.operation.crm_create_lead.description': 'Create a lead record in the CRM system.',
|
||||
'demo.operation.billing_get_invoice.display_name': 'Get Invoice Status',
|
||||
'demo.operation.billing_get_invoice.description': 'Fetch invoice state and amount from billing.',
|
||||
'demo.operation.support_lookup_ticket.display_name': 'Lookup Support Ticket',
|
||||
'demo.operation.support_lookup_ticket.description': 'Draft unary gRPC support lookup using a descriptor set.',
|
||||
'demo.operation.marketing_archive_contact.display_name': 'Archive Marketing Contact',
|
||||
'demo.operation.marketing_archive_contact.description': 'Legacy archived flow kept for audit only.',
|
||||
|
||||
// Login
|
||||
'login.title': 'Sign in',
|
||||
'login.subtitle': 'Welcome back to your workspace',
|
||||
@@ -1515,6 +1529,20 @@ var TRANSLATIONS = {
|
||||
'agents.toast.lifecycle_error_message': 'Не удалось обновить состояние агента',
|
||||
'agents.toast.endpoint_title': 'MCP endpoint скопирован',
|
||||
|
||||
// Demo content
|
||||
'demo.agent.revops-copilot.display_name': 'Помощник RevOps',
|
||||
'demo.agent.revops-copilot.description': 'Ассистент Revenue Operations с CRM- и billing-инструментами.',
|
||||
'demo.agent.support-triage.display_name': 'Триаж поддержки',
|
||||
'demo.agent.support-triage.description': 'Черновой агент поддержки, сфокусированный на unary gRPC-сценариях.',
|
||||
'demo.operation.crm_create_lead.display_name': 'Создать CRM-лид',
|
||||
'demo.operation.crm_create_lead.description': 'Создает запись лида в CRM-системе.',
|
||||
'demo.operation.billing_get_invoice.display_name': 'Статус инвойса',
|
||||
'demo.operation.billing_get_invoice.description': 'Получает состояние и сумму инвойса из billing-системы.',
|
||||
'demo.operation.support_lookup_ticket.display_name': 'Найти тикет поддержки',
|
||||
'demo.operation.support_lookup_ticket.description': 'Черновой unary gRPC lookup поддержки через descriptor set.',
|
||||
'demo.operation.marketing_archive_contact.display_name': 'Архивировать маркетинговый контакт',
|
||||
'demo.operation.marketing_archive_contact.description': 'Устаревший архивный сценарий, оставленный только для аудита.',
|
||||
|
||||
// Login
|
||||
'login.title': 'Войти',
|
||||
'login.subtitle': 'Добро пожаловать обратно',
|
||||
@@ -1547,6 +1575,64 @@ function tf(key, vars) {
|
||||
}, t(key));
|
||||
}
|
||||
|
||||
function hasTranslation(key) {
|
||||
return t(key) !== key;
|
||||
}
|
||||
|
||||
function localizeDemoAgent(agent) {
|
||||
if (!agent || !agent.slug) {
|
||||
return agent;
|
||||
}
|
||||
|
||||
var displayNameKey = 'demo.agent.' + agent.slug + '.display_name';
|
||||
var descriptionKey = 'demo.agent.' + agent.slug + '.description';
|
||||
|
||||
if (!hasTranslation(displayNameKey) && !hasTranslation(descriptionKey)) {
|
||||
return agent;
|
||||
}
|
||||
|
||||
return Object.assign({}, agent, {
|
||||
display_name: hasTranslation(displayNameKey) ? t(displayNameKey) : agent.display_name,
|
||||
description: hasTranslation(descriptionKey) ? t(descriptionKey) : agent.description,
|
||||
});
|
||||
}
|
||||
|
||||
function localizeDemoOperation(operation) {
|
||||
if (!operation || !operation.name) {
|
||||
return operation;
|
||||
}
|
||||
|
||||
var displayNameKey = 'demo.operation.' + operation.name + '.display_name';
|
||||
var descriptionKey = 'demo.operation.' + operation.name + '.description';
|
||||
|
||||
if (!hasTranslation(displayNameKey) && !hasTranslation(descriptionKey)) {
|
||||
return operation;
|
||||
}
|
||||
|
||||
var next = Object.assign({}, operation);
|
||||
|
||||
if (hasTranslation(displayNameKey)) {
|
||||
next.display_name = t(displayNameKey);
|
||||
if (Object.prototype.hasOwnProperty.call(operation, 'operation_display_name')) {
|
||||
next.operation_display_name = t(displayNameKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasTranslation(descriptionKey)) {
|
||||
if (Object.prototype.hasOwnProperty.call(operation, 'description')) {
|
||||
next.description = t(descriptionKey);
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(operation, 'tool_description')) {
|
||||
next.tool_description = t(descriptionKey);
|
||||
}
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
window.localizeDemoAgent = localizeDemoAgent;
|
||||
window.localizeDemoOperation = localizeDemoOperation;
|
||||
|
||||
function applyLang() {
|
||||
// text content
|
||||
document.querySelectorAll('[data-i18n]').forEach(function(el) {
|
||||
|
||||
Reference in New Issue
Block a user