diff --git a/web/app.js b/web/app.js
index 9498b27f0..ecbaed046 100644
--- a/web/app.js
+++ b/web/app.js
@@ -213,6 +213,9 @@ function afNextDialog(){
if(rerunFields)rerunFields.hidden=true;
const okBtn=$('#confirmOkBtn'),cancelBtn=$('#confirmCancelBtn');
cancelBtn.hidden=false;
+ // afConfirm({messageData}) marks the shared message node for one dialog; clear it first so afPrompt,
+ // afAlert and other setups that write #confirmMessage directly translate normally.
+ $('#confirmMessage')?.removeAttribute('data-i18n-data');
let opened;
try{opened=job.setup(modal)||{}}catch(err){job.resolve(null);console.error(err);return afNextDialog()}
window.HuiPopover?.closeAll?.();
@@ -280,7 +283,10 @@ function afConfirm(options){
return afOpenDialog(()=>{
const danger=!!opt.danger;
$('#confirmTitle').textContent=opt.title||(danger?'危险操作确认':'操作确认');
- $('#confirmMessage').textContent=opt.message||'确定要继续吗?';
+ // messageData: the message quotes user data (a name), so English mode only takes whole-message dictionary hits.
+ const message=$('#confirmMessage');
+ if(opt.messageData)message.setAttribute('data-i18n-data','');
+ message.textContent=opt.message||'确定要继续吗?';
const okBtn=$('#confirmOkBtn');
okBtn.textContent=opt.confirmText||(danger?'确定执行':'确定');
okBtn.className=`button ${danger?'danger-btn':'primary'}`;
diff --git a/web/app/assets.js b/web/app/assets.js
index c619de30b..c1c3e8707 100644
--- a/web/app/assets.js
+++ b/web/app/assets.js
@@ -17,10 +17,18 @@ function assetMatchesQuery(a,query){const q=String(query||'').trim().toLowerCase
function assetFilteredItems(){return assetScopeItems(state[assetScopeKey(state.assetType)]).filter(a=>assetMatchesQuery(a,state.assetQuery))}
// Owned assets win over a same-id shared copy so the editable one opens.
function assetFindVisible(id){if(!id)return null;const owned=assetScopeItems('project').find(x=>x.id===id);if(owned)return {asset:owned,scope:'project'};const shared=assetScopeItems('shared').find(x=>x.id===id);return shared?{asset:shared,scope:'shared'}:null}
-function assetProjectName(a){return (state.data.projects||[]).find(p=>p.id===a?.projectId)?.name||a?.projectId||'平台'}
+// Platform-owned assets (projectId "platform", e.g. generic-docker) have no
+// project entry; they read as 平台 rather than the raw id.
+function assetOwnerProjectName(a){return (state.data.projects||[]).find(p=>p.id===a?.projectId)?.name||(a?.projectId&&a.projectId!=='platform'?a.projectId:'')}
+function assetProjectName(a){return assetOwnerProjectName(a)||'平台'}
+// Names people typed stay as typed in English mode (data-i18n-skip): even a
+// whole-string dictionary hit would rename a project called 「测试」 to Testing.
+// Only the 平台 fallback is product copy and still translates.
+function assetProjectNameHTML(a){const name=assetOwnerProjectName(a);return name?`${escapeHTML(name)} `:'平台'}
+function assetUserDataAttr(value){return value?' data-i18n-skip':''}
function assetIsBuiltin(a,type=state.assetType){return type==='sandboxes'&&a?.id==='generic-docker'}
function assetStatusHTML(a){
- if(!catalogOwned(a.projectId))return ` 来自 ${escapeHTML(assetProjectName(a))} `;
+ if(!catalogOwned(a.projectId))return ` 来自 ${assetProjectNameHTML(a)} `;
return ` ${a.shared?'已共享':'未共享'} `;
}
function assetMetaHTML(a){
@@ -33,19 +41,20 @@ function assetMetaHTML(a){
}
if(state.assetType==='sandboxes'){
const driver=sandboxDriverOption(a.driver);meta.push(item('server',sandboxDriverLabel(driver)));
- if(driver==='docker'&&a.dockerfile?.content)meta.push(item('layers',`Dockerfile ${a.dockerfile.content.trimEnd().split('\n').length} 行`));
+ if(driver==='docker'&&a.dockerfile?.content){const lines=a.dockerfile.content.trimEnd().split('\n').length;meta.push(item('layers',lfT(`Dockerfile ${lines} 行`,`Dockerfile · ${lines} ${lines===1?'line':'lines'}`)))}
}
const refs=assetReferenceNames(a).length;
- meta.push(item(assetRefIconName(),refs?`${refs} 个${assetRefKindLabel()}引用`:'未被引用'));
+ meta.push(item(assetRefIconName(),refs?lfT(`${refs} 个${assetRefKindLabel()}引用`,`Used by ${refs} ${assetRefKindLabelEn(refs)}`):'未被引用'));
return meta.join('');
}
function assetCardHTML(a){
const readonly=!catalogOwned(a.projectId);const go=readonly?'查看':'编辑';
- return `${huiIcon(assetIconName())}
${escapeHTML(a.name||a.id)} ${escapeHTML(a.id)}${escapeHTML(a.description||'暂无说明')}
${assetMetaHTML(a)}
`;
+ const name=a.name||a.id,label=lfT(`${go}${assetKindLabel()}「${name}」`,`${readonly?'View':'Edit'} ${assetKindLabelEn()} "${name}"`);
+ return `${huiIcon(assetIconName())}
${escapeHTML(name)} ${escapeHTML(a.id)}${escapeHTML(a.description||'暂无说明')}
${assetMetaHTML(a)}
`;
}
function assetGridEmptyHTML(){
const kind=assetKindLabel(),copy=assetPageCopy();
- if(String(state.assetQuery||'').trim())return `
没有匹配「${escapeHTML(state.assetQuery.trim())}」的${escapeHTML(kind)} 换个关键词试试。
`;
+ if(String(state.assetQuery||'').trim())return `${escapeHTML(lfT(`没有匹配「${state.assetQuery.trim()}」的${kind}`,`No ${assetKindLabelEn()} matches "${state.assetQuery.trim()}"`))} 换个关键词试试。
`;
if(state[assetScopeKey(state.assetType)]==='shared'){const hint=['rules','skills'].includes(state.assetType)?'请在资产所属项目中共享,或共享一个引用它的角色。':'请在沙箱所属项目中共享。';return `其他项目还没有共享${escapeHTML(kind)} ${hint}
`}
return `当前项目还没有${/^[A-Za-z]/.test(kind)?' ':''}${escapeHTML(kind)} ${assetEmptyHint()}
${huiIcon('plus')}${escapeHTML(copy.create)} `;
}
@@ -53,7 +62,7 @@ function renderAssetGrid(){
const list=$('#assetList');if(!list)return;
const scope=state[assetScopeKey(state.assetType)];
const items=assetFilteredItems();
- const count=$('#assetCount');if(count)count.innerHTML=`${scope==='shared'?'共享':'本项目'}${escapeHTML(assetKindLabel())}${items.length} `;
+ const count=$('#assetCount');if(count)count.innerHTML=`${escapeHTML(lfT(`${scope==='shared'?'共享':'本项目'}${assetKindLabel()}`,scope==='shared'?`Shared ${assetKindLabelEn(true)}`:`${assetKindLabelEn(true).replace(/^./,c=>c.toUpperCase())} in this project`))}${items.length} `;
list.innerHTML=items.map(assetCardHTML).join('')||assetGridEmptyHTML();
const emptyAction=list.querySelector('[data-empty-new]');
if($('#newAsset'))$('#newAsset').hidden=scope!=='project'||!!emptyAction;
@@ -100,7 +109,7 @@ function assetCurrent(){
}
function assetDetailHeadHTML(a,{creating=false,dirty=false}={}){
const kind=assetKindLabel(),copy=assetPageCopy(),readonly=!creating&&!catalogOwned(a.projectId);
- const badge=creating?'':readonly?`来自 ${escapeHTML(assetProjectName(a))} `:`${a.shared?'已共享':'未共享'} `;
+ const badge=creating?'':readonly?`来自 ${assetProjectNameHTML(a)} `:`${a.shared?'已共享':'未共享'} `;
const title=creating?`新建${kind}`:(a.name||a.id);
const desc=creating?`填写标识和名称后创建${state.assetType==='skills'?',创建后即可上传文件':''}。`:(a.description||'暂无说明');
let actions;
@@ -111,15 +120,15 @@ function assetDetailHeadHTML(a,{creating=false,dirty=false}={}){
actions=` 未保存 `+
`${huiIcon(a.shared?'close':'arrow-up')}${a.shared?'取消共享':'共享给其他项目'} `+
`${huiIcon('more-horizontal')} `+
- `
`+
+ ``+
`${huiIcon('save')}保存修改 `;
}
- return `${huiIcon('arrow-left')} ${escapeHTML(title)} ${badge}${escapeHTML(desc)}
${actions}
`;
+ return `${huiIcon('arrow-left')} ${escapeHTML(title)} ${badge}${escapeHTML(desc)}
${actions}
`;
}
function renderAssetDetailHead(a){
const creating=state.selectedAsset==='__new__',copy=assetPageCopy();
const crumbs=$('#assetCrumbs');
- if(crumbs)crumbs.innerHTML=`${escapeHTML(copy.crumb||`${copy.page} · ${copy.tab}`)} ${huiIcon('chevron-right')}${escapeHTML(creating?`新建${assetKindLabel()}`:(a.name||a.id))} `;
+ if(crumbs)crumbs.innerHTML=`${escapeHTML(copy.crumb||`${copy.page} · ${copy.tab}`)} ${huiIcon('chevron-right')}${escapeHTML(creating?`新建${assetKindLabel()}`:(a.name||a.id))} `;
const head=$('#assetDetailHead');if(!head)return;
closeAssetMenu();
head.innerHTML=assetDetailHeadHTML(a,{creating,dirty:!!state.assetDirty});
@@ -155,7 +164,7 @@ function updateAssetStuck(){
}
function assetRefsCardHTML(a){
const refs=assetReferenceNames(a),kind=assetRefKindLabel();
- return `被引用${refs.length} ${refs.length?refs.map(name=>`${huiIcon(assetRefIconName())}${escapeHTML(name)} `).join(''):`还没有${kind}引用这个${escapeHTML(assetKindLabel())} `} `;
+ return `被引用${refs.length} ${refs.length?refs.map(name=>`${huiIcon(assetRefIconName())}${escapeHTML(name)} `).join(''):`还没有${kind}引用这个${escapeHTML(assetKindLabel())} `} `;
}
function assetSkillSource(a){const s=a?.source;return state.assetType==='skills'&&s&&s.provider==='skillhub'?s:null}
function assetSkillLatest(src){return typeof skillhubLatestFor==='function'?skillhubLatestFor(src):''}
@@ -172,7 +181,7 @@ function assetSkillSourceActionHTML(a){
}
function assetOverviewCardHTML(a){
const readonly=!catalogOwned(a.projectId);
- return `概览 归属 ${readonly?escapeHTML(assetProjectName(a)):'本项目'} 共享 ${readonly?'其他项目共享':a.shared?'已共享':'未共享'} ${assetIsBuiltin(a)?'类型 内置 ':''}${assetSkillSourceRowsHTML(a)} ${assetSkillSourceActionHTML(a)}`;
+ return `概览 归属 ${readonly?assetProjectNameHTML(a):'本项目'} 共享 ${readonly?'其他项目共享':a.shared?'已共享':'未共享'} ${assetIsBuiltin(a)?'类型 内置 ':''}${assetSkillSourceRowsHTML(a)} ${assetSkillSourceActionHTML(a)}`;
}
function bindAssetSourceActions(a){
const card=$('#assetForm [data-asset-overview]');if(!card||!assetSkillSource(a))return;
@@ -202,7 +211,7 @@ function scrollAssetTop(){
}
async function confirmAssetLeave(){
if(!state.selectedAsset||!state.assetDirty||!isProjectSharedAsset(activeViewName()))return true;
- const ok=await afConfirm({title:'未保存的修改',message:`当前${assetKindLabel()}有未保存修改,离开将放弃这些修改。继续?`,confirmText:'放弃并离开',danger:true});
+ const ok=await afConfirm({title:lfT('未保存的修改','Unsaved changes'),message:lfT(`当前${assetKindLabel()}有未保存修改,离开将放弃这些修改。继续?`,`This ${assetKindLabelEn()} has unsaved changes. Leaving discards them. Continue?`),confirmText:'放弃并离开',danger:true});
if(ok)state.assetDirty=false;
return ok;
}
@@ -259,7 +268,9 @@ async function toggleAssetShare(id){
}
function assetEmptyHint(){return ({rules:'规则是写给 Agent 的行为约束,例如编码规范、禁止事项。建好后在「角色定义」里绑定到角色。',skills:'技能是 Agent 可按需加载的说明和附加文件,例如某个框架的操作手册。建好后在「角色定义」里绑定到角色。',sandboxes:'沙箱决定 LOOP 节点和对话工作区在什么隔离环境里执行:docker 沙箱自带 Dockerfile,native 沙箱使用执行机器上已安装的工具。建好后在流程设置里选用;也可以直接用「共享」里的现成配置。'})[state.assetType]||''}
function assetKindLabel(){return ({rules:'规则',skills:'技能',sandboxes:'沙箱'})[state.assetType]||'资产'}
+function assetKindLabelEn(plural=false){return (plural?{rules:'rules',skills:'skills',sandboxes:'sandboxes'}:{rules:'rule',skills:'skill',sandboxes:'sandbox'})[state.assetType]||(plural?'assets':'asset')}
function assetRefKindLabel(){return ({rules:'角色',skills:'角色',sandboxes:'流程'})[state.assetType]||'引用'}
+function assetRefKindLabelEn(n){return n===1?(state.assetType==='sandboxes'?'LOOP':'role'):(state.assetType==='sandboxes'?'LOOPs':'roles')}
function assetReferenceNames(a){
if(!a?.id)return [];
if(state.assetType==='rules')return (state.data.agents||[]).filter(x=>(x.rules||[]).includes(a.id)).map(x=>x.name||x.id);
@@ -270,9 +281,9 @@ function assetReferenceNames(a){
function assetDeleteBlocked(a){
if(!a?.id)return '无法删除';
if(state.assetType==='sandboxes'&&a.id==='generic-docker')return `内置沙箱 ${a.id} 不能删除`;
- if(a.shared)return `共享状态的${assetKindLabel()}不能删除,请先取消共享`;
+ if(a.shared)return lfT(`共享状态的${assetKindLabel()}不能删除,请先取消共享`,`A shared ${assetKindLabelEn()} can't be deleted. Stop sharing it first`);
const refs=assetReferenceNames(a);
- if(refs.length)return `${assetKindLabel()}仍被 ${refs.length} 个${assetRefKindLabel()}引用(${refs.join('、')}),请先解除引用`;
+ if(refs.length)return lfT(`${assetKindLabel()}仍被 ${refs.length} 个${assetRefKindLabel()}引用(${refs.join('、')}),请先解除引用`,`This ${assetKindLabelEn()} is still used by ${refs.length} ${assetRefKindLabelEn(refs.length)} (${refs.join(', ')}). Remove those references first`);
return '';
}
async function deleteAsset(id){
@@ -282,13 +293,13 @@ async function deleteAsset(id){
const blocked=assetDeleteBlocked(item);
if(blocked)return toast(blocked);
const label=assetKindLabel();
- if(!await afConfirm({title:`删除${label}确认`,message:`确认删除${label}「${item.name}」?此操作不可恢复。`,confirmText:'确认删除',danger:true}))return;
+ if(!await afConfirm({title:lfT(`删除${label}确认`,`Delete ${assetKindLabelEn()}`),message:lfT(`确认删除${label}「${item.name}」?此操作不可恢复。`,`Delete ${assetKindLabelEn()} "${item.name}"? This can't be undone.`),messageData:true,confirmText:'确认删除',danger:true}))return;
try{
await api(`/api/${state.assetType}?id=${encodeURIComponent(id)}`,{method:'DELETE'});
state.data[state.assetType]=(state.data[state.assetType]||[]).filter(x=>x.id!==id);
if(state.selectedAsset===id)await closeAssetDetail({force:true});
else renderAssets();
- toast(`${label}已删除`);
+ toast(lfT(`${label}已删除`,`${assetKindLabelEn().replace(/^./,c=>c.toUpperCase())} deleted`));
}catch(e){toast(e.message||'删除失败')}
}
function assetKind(){return assetKindLabel()}
@@ -311,8 +322,8 @@ function syncSandboxDriverFields(select){
}
function resolveAssetSaveIdentity(items,selectedID,requestedID){if(selectedID!=='__new__'){const existing=(items||[]).find(item=>item.id===selectedID);return existing?{id:existing.id,existing,created:false}:{error:'选中的资产已不存在,请刷新后重试'}}if((items||[]).some(item=>item.id===requestedID))return {error:'该标识已存在,请换一个标识,或回到列表打开已有资产修改'};return {id:requestedID,existing:null,created:true}}
function assetPaneTabs(type=state.assetType){return ({rules:[['edit','编辑'],['preview','预览']],skills:[['files','文件']],sandboxes:[['setup','配置']]})[type]||[['edit','编辑']]}
-function assetPaneHint(type=state.assetType){return ({rules:'支持 Markdown',skills:'每次上传都会完整替换现有文件',sandboxes:'隔离方式决定沙箱在哪里、怎样执行'})[type]||''}
-function assetFieldLabel(text,help,forId=''){return `${forId?`${escapeHTML(text)} `:`${escapeHTML(text)} `}${help?`? `:''}
`}
+function assetPaneHint(type=state.assetType){return ({rules:lfT('支持 Markdown','Markdown supported'),skills:'每次上传都会完整替换现有文件',sandboxes:'隔离方式决定沙箱在哪里、怎样执行'})[type]||''}
+function assetFieldLabel(text,help,forId=''){return `${forId?`${escapeHTML(text)} `:`${escapeHTML(text)} `}${help?`? `:''}
`}
function sandboxSetupHTML(a){
const driver=sandboxDriverOption(a.driver);
const privilegeHelp=lfT('执行机器须允许特权沙箱。容器内进程可访问宿主机设备,并可能控制执行机器。','The execution machine must allow privileged sandboxes. Processes in the container can access host devices and may take control of the machine.');
diff --git a/web/app/mcp.js b/web/app/mcp.js
index a4d0bccf0..c83346394 100644
--- a/web/app/mcp.js
+++ b/web/app/mcp.js
@@ -187,11 +187,12 @@ function renderMCPManagement(){
const matchedInstalled=installed.filter(item=>mcpMatchesQuery(item,query));
const installedCount=$('#mcpInstalledCount');
if(installedCount)installedCount.textContent=String(matchedInstalled.length);
- hint.innerHTML=personal?`个人 MCP 仅 ${escapeHTML(userDisplay(state.currentUser)||'当前用户')} 可见。 `:`项目 MCP 添加到「${escapeHTML(project?.name||'未选择项目')}」,不会出现在其他项目中。 `;
+ const owner=personal?(userDisplay(state.currentUser)||lfT('当前用户','you')):(project?.name||lfT('未选择项目','no project selected'));
+ hint.innerHTML=personal?`个人 MCP ${escapeHTML(lfT(`仅 ${owner} 可见。`,`Only visible to ${owner}.`))} `:`项目 MCP ${escapeHTML(lfT(`添加到「${owner}」,不会出现在其他项目中。`,`Added to "${owner}"; it won't appear in other projects.`))} `;
if(personal&&(!state.currentUser||state.currentUser.isGuest)){grid.innerHTML='登录后才能管理个人 MCP 项目级 MCP 仍可在当前项目中管理。
';return}
const pagedMCP=paginateList('mcp',matchedInstalled);
const catalog=personal?'':mcpCatalogSuggestionsHTML(installed,query);
- const cards=pagedMCP.items.map(item=>`${mcpMarketLogo(item)}
${escapeHTML(item.name)} ${personal?'个人专属':escapeHTML(project?.name||item.projectId)} ${item.marketId?'市场':'自定义'} ${escapeHTML(item.description||'暂无说明')}
${item.authType==='github-token'?'GitHub 令牌认证 ':'自定义认证 '}${escapeHTML(item.transport||'http')}
${item.marketId?'':`修改 `}移除
`).join('');
+ const cards=pagedMCP.items.map(item=>`${mcpMarketLogo(item)}
${escapeHTML(item.name)} ${personal?'个人专属':escapeHTML(project?.name||item.projectId)} ${item.marketId?'市场':'自定义'} ${escapeHTML(item.description||'暂无说明')}
${item.authType==='github-token'?'GitHub 令牌认证 ':'自定义认证 '}${escapeHTML(item.transport||'http')}
${item.marketId?'':`修改 `}移除
`).join('');
grid.innerHTML=catalog+(cards||(query?'':`当前范围还没有 MCP 点击右上角「添加 MCP」,${personal?'创建个人专属配置':'为本项目接入工具'}。
`));
if(cards)grid.insertAdjacentHTML('beforeend',pagerHTML('mcp',pagedMCP));
bindMCPLogoFallbacks(grid);
diff --git a/web/assets_detail_test.js b/web/assets_detail_test.js
index 8278ab517..7ce6055b3 100644
--- a/web/assets_detail_test.js
+++ b/web/assets_detail_test.js
@@ -74,7 +74,7 @@ const shared = ctx.assetCardHTML(ctx.state.data.rules[1]);
assert.ok(shared.includes(' 已共享 '), shared);
assert.ok(shared.includes('暂无说明') && shared.includes('未被引用'), shared);
const foreign = ctx.assetCardHTML(ctx.state.data.rules[2]);
-assert.ok(foreign.includes(' 来自 平台公共 '), foreign);
+assert.ok(foreign.includes(' 来自 平台公共 '), foreign);
assert.ok(foreign.includes('查看'), foreign);
for (const html of [own, shared, foreign]) {
assert.ok(!/平台公共') && head.includes('只读 · 可直接在本项目使用'));
// ---------- Routes ----------
const route = hash => { ctx.location.hash = hash; return ctx.assetRouteId(); };
diff --git a/web/i18n-en.js b/web/i18n-en.js
index bcbb89c8d..bac92346a 100644
--- a/web/i18n-en.js
+++ b/web/i18n-en.js
@@ -1090,6 +1090,79 @@ Object.assign(window.LF_I18N_EN, {
"容器可访问宿主机设备,需执行机器开启特权许可。": "Allows container access to host devices; the execution machine must permit privileged mode.",
"默认不限": "Unlimited",
});
+// Capability assets (rules, skills, MCP) and sandboxes. Names, descriptions and
+// project names on these pages are user data and keep the language they were typed in.
+Object.assign(window.LF_I18N_EN, {
+ "搜索名称或标识…": "Search by name or ID…",
+ "搜索资产": "Search assets",
+ "未共享": "Not shared",
+ "已共享": "Shared",
+ "其他项目共享":"Shared by another project","未被引用": "Not used yet",
+ "维护当前项目的运行沙箱:隔离方式、Dockerfile 和环境变量。": "Maintain this project's run sandboxes: isolation, Dockerfile and environment variables.",
+ "查看其他项目共享的沙箱;共享沙箱只读,可直接用于本项目。": "Sandboxes shared by other projects. They are read-only and can be used in this project directly.",
+ "请在沙箱所属项目中共享。": "Share it from the project that owns the sandbox.",
+ "沙箱决定 LOOP 节点和对话工作区在什么隔离环境里执行:docker 沙箱自带 Dockerfile,native 沙箱使用执行机器上已安装的工具。建好后在流程设置里选用;也可以直接用「共享」里的现成配置。": "A sandbox decides the isolated environment LOOP nodes and chat workspaces run in: a docker sandbox brings its own Dockerfile, a native sandbox uses the tools installed on the execution machine. Pick it in the LOOP settings once created, or use a ready-made one under \"Shared\".",
+ "面包屑": "Breadcrumb",
+ "返回能力资产": "Back to capability assets",
+ "返回沙箱管理": "Back to sandboxes",
+ "只读 · 可直接在本项目使用": "Read-only · usable in this project as is",
+ "未保存": "Unsaved",
+ "放弃并离开": "Discard and leave",
+ "被引用": "Used by",
+ "归属": "Owner",
+ "还没有角色引用这个规则": "No role uses this rule yet",
+ "还没有角色引用这个技能": "No role uses this skill yet",
+ "还没有流程引用这个沙箱": "No LOOP uses this sandbox yet",
+ "规则内容": "Rule content",
+ "技能内容": "Skill content",
+ "沙箱内容": "Sandbox content",
+ "每次上传都会完整替换现有文件": "Each upload replaces all existing files",
+ "隔离方式决定沙箱在哪里、怎样执行": "The isolation driver decides where and how the sandbox runs",
+ "给规则起个名字": "Name this rule",
+ "给技能起个名字": "Name this skill",
+ "给沙箱起个名字": "Name this sandbox",
+ "一句话说明用途": "Describe its purpose in one sentence",
+ "如 loopforge-core": "e.g. loopforge-core",
+ "创建后不可修改,用于资产引用。": "Can't be changed after creation; used to reference the asset.",
+ "数值越大越先注入。": "Higher values are injected first.",
+ "填写标识和名称后创建。": "Fill in the ID and name, then create it.",
+ "填写标识和名称后创建,创建后即可上传文件。": "Fill in the ID and name, then create it. You can upload files afterwards.",
+ "创建规则": "Create rule",
+ "创建技能": "Create skill",
+ "创建沙箱": "Create sandbox",
+ "先创建技能,再上传文件": "Create the skill first, then upload files",
+ "支持文件夹、.zip 压缩包或单独的 SKILL.md。": "Folders, .zip archives or a single SKILL.md are supported.",
+ "还没有内容": "No content yet",
+ "SKILL.md 超过 10MB 限制": "SKILL.md exceeds the 10 MB limit",
+ "该标识已存在,请换一个标识,或回到列表打开已有资产修改": "This ID already exists. Use another ID, or go back to the list and edit the existing asset",
+ "安装于": "Installed",
+ "检查更新": "Check for updates",
+ "· 可更新": "· Update available",
+ "隔离方式说明": "About isolation",
+ "工具链说明": "Toolchain notes",
+ "Agent 自动选择沙箱时参考这些工具和版本。": "Agents consult these tools and versions when they pick a sandbox automatically.",
+ "例如 Python 3.12、uv、PostgreSQL 客户端": "e.g. Python 3.12, uv, PostgreSQL client",
+ "环境变量说明": "About environment variables",
+ "JSON 对象,叠加到沙箱基础环境并随资产保存;不要在这里保存凭证。平台凭证、HOME/TMPDIR 和遥测变量优先级更高。": "A JSON object layered onto the sandbox base environment and saved with the asset. Don't store credentials here. Platform credentials, HOME/TMPDIR and telemetry variables take precedence.",
+ "Dockerfile说明": "About the Dockerfile",
+ "保存在这个沙箱里。沙箱初始化时用它 docker build 出镜像;内容相同的沙箱共用同一个镜像。不要指向仓库目录或现成镜像名。": "Saved in this sandbox and used to docker build its image when the sandbox initializes; sandboxes with identical content share one image. Don't point it at a repository directory or an existing image name.",
+ "构建上下文文件": "Build context files",
+ "构建上下文文件说明": "About build context files",
+ "JSON 对象:键是构建上下文里的相对路径,值是文件内容,和 Dockerfile 一起保存,可在 Dockerfile 里 COPY。": "A JSON object: keys are relative paths in the build context and values are file contents. Saved with the Dockerfile, which can COPY them.",
+ "容器根文件系统只读": "Read-only container root filesystem",
+ "容器根文件系统只读说明": "About the read-only root filesystem",
+ "开启后 /usr、/etc 等系统目录只读,/tmp 使用临时内存盘,缺少的 CLI 无法在容器内自动安装;工作区 /workspace 仍可写。默认建议关闭。": "When on, system directories such as /usr and /etc are read-only, /tmp is an in-memory disk and missing CLIs can't be installed in the container; the /workspace workspace stays writable. Off is recommended.",
+ "CPU 上限(核)": "CPU limit (cores)",
+ "内存上限(MiB)": "Memory limit (MiB)",
+ "留空使用执行机器配置。两处都配置上限时,较低值生效。": "Leave empty to use the execution machine's settings. When both set a limit, the lower one applies.",
+ "搜索名称、描述或地址": "Search by name, description or URL",
+ "自定义认证": "Custom auth",
+ "GitHub 令牌认证": "GitHub token auth",
+ "个人专属": "Personal",
+ "点击右上角「添加 MCP」,为本项目接入工具。": "Click \"Add MCP\" at the top right to connect tools to this project.",
+ "点击右上角「添加 MCP」,创建个人专属配置。": "Click \"Add MCP\" at the top right to create a personal configuration.",
+ "仅自己可见": "Only you"
+});
Object.assign(window.LF_I18N_EN, {
"对话处理": "Handled in chat",
"在对话里澄清和改代码": "Clarify and change code in chat",
diff --git a/web/i18n.js b/web/i18n.js
index a0efcdc7f..6e14bb896 100644
--- a/web/i18n.js
+++ b/web/i18n.js
@@ -93,6 +93,10 @@
// rewrites, so a sentence typed by a person is not turned into mixed prose.
const DATA_SEL = '[data-i18n-data],.ai-user-bubble,.ai-think-body,.collab-process-body,.collab-list-item,.issue-title-cell b,#issueDetailTitle,.detail-desc,.comment-row p';
const ATTRS = ['placeholder', 'title', 'aria-label', 'data-tip', 'data-tooltip'];
+ // data-i18n-data-attrs="aria-label title" marks only those attributes as
+ // user data, for an element whose own copy must still be translated (a card
+ // labelled with the asset name it shows).
+ const dataAttr = (el, name) => !!el.closest(DATA_SEL) || (el.getAttribute('data-i18n-data-attrs') || '').split(/\s+/).includes(name);
const escape = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const fragments = Object.keys(dict).filter(k => k.length > 1).sort((a, b) => b.length - a.length);
const fragmentRE = fragments.length ? new RegExp('(?