fix: normalize JSON5 slash escaping and add i18n for OpenClaw panels

- Fix json-five output unescaping forward slashes (\/ → /)
- Add structured error codes for env validation (EMPTY, INVALID_JSON, OBJECT_REQUIRED)
- Add i18n keys (zh/en/ja) for health warnings, tool profiles, env editor hints,
  and agents legacy timeout migration
- Update env validation test to match new error codes
This commit is contained in:
Jason
2026-03-06 18:35:47 +08:00
Unverified
parent 7e6f803035
commit c0fe0d6e07
3 changed files with 69 additions and 0 deletions
+23
View File
@@ -1244,6 +1244,7 @@
}
},
"openclaw": {
"backupCreated": "Backup created: {{path}}",
"providerKey": "Provider Key",
"providerKeyPlaceholder": "my-provider",
"providerKeyHint": "Unique identifier in config file. Cannot be changed after creation. Use lowercase letters, numbers, and hyphens only.",
@@ -1277,6 +1278,10 @@
"env": {
"title": "Environment Variables",
"description": "Manage environment variables in openclaw.json (API keys, custom variables, etc.)",
"editorHint": "Edit the full env section as JSON. Nested objects such as env.vars and env.shellEnv are supported.",
"objectRequired": "OpenClaw env must be a JSON object.",
"invalidJson": "OpenClaw env must be valid JSON.",
"empty": "OpenClaw env cannot be empty. Use {} for an empty object.",
"keyPlaceholder": "Variable name",
"valuePlaceholder": "Value",
"add": "Add Variable",
@@ -1289,6 +1294,14 @@
"title": "Tool Permissions",
"description": "Manage tool permissions in openclaw.json (allow/deny lists)",
"profile": "Permission Profile",
"profileMinimal": "Minimal",
"profileCoding": "Coding",
"profileMessaging": "Messaging",
"profileFull": "Full",
"profileUnset": "Not set",
"unsupportedProfileTitle": "Unsupported tools profile detected",
"unsupportedProfileDescription": "The current tools.profile value '{{value}}' is not in the supported OpenClaw list. It will be preserved until you choose a new value.",
"unsupportedProfileLabel": "unsupported",
"profiles": {
"default": "Default",
"strict": "Strict",
@@ -1321,9 +1334,19 @@
"timeout": "Timeout (seconds)",
"contextTokens": "Context Tokens",
"maxConcurrent": "Max Concurrent",
"legacyTimeoutTitle": "Legacy timeout detected",
"legacyTimeoutDescription": "This config still uses agents.defaults.timeout. Saving here will migrate it to timeoutSeconds.",
"saveSuccess": "Agents config saved",
"saveFailed": "Failed to save agents config",
"loadFailed": "Failed to load agents config"
},
"health": {
"title": "OpenClaw config warnings detected",
"invalidToolsProfile": "tools.profile contains an unsupported value. OpenClaw currently expects minimal, coding, messaging, or full.",
"legacyTimeout": "agents.defaults.timeout is deprecated. Save the Agents panel to migrate it to timeoutSeconds.",
"stringifiedEnvVars": "env.vars should be an object, but the current value looks stringified or malformed.",
"stringifiedShellEnv": "env.shellEnv should be an object, but the current value looks stringified or malformed.",
"parseFailed": "openclaw.json could not be parsed as valid JSON5. Fix the file before editing it here."
}
},
"env": {
+23
View File
@@ -1244,6 +1244,7 @@
}
},
"openclaw": {
"backupCreated": "バックアップを作成しました: {{path}}",
"providerKey": "プロバイダーキー",
"providerKeyPlaceholder": "my-provider",
"providerKeyHint": "設定ファイル内のユニーク識別子。作成後は変更できません。小文字、数字、ハイフンのみ使用可能。",
@@ -1277,6 +1278,10 @@
"env": {
"title": "環境変数",
"description": "openclaw.json の環境変数設定を管理(APIキー、カスタム変数など)",
"editorHint": "env セクション全体を JSON として編集します。env.vars や env.shellEnv などのネストしたオブジェクトにも対応しています。",
"objectRequired": "OpenClaw の env は JSON オブジェクトである必要があります。",
"invalidJson": "OpenClaw の env は有効な JSON である必要があります。",
"empty": "OpenClaw の env は空にできません。空オブジェクトの場合は {} を使用してください。",
"keyPlaceholder": "変数名",
"valuePlaceholder": "値",
"add": "変数を追加",
@@ -1289,6 +1294,14 @@
"title": "ツール権限",
"description": "openclaw.json のツール権限設定を管理(許可/拒否リスト)",
"profile": "権限プロファイル",
"profileMinimal": "最小",
"profileCoding": "コーディング",
"profileMessaging": "メッセージ",
"profileFull": "フルアクセス",
"profileUnset": "未設定",
"unsupportedProfileTitle": "未対応のツールプロファイルを検出しました",
"unsupportedProfileDescription": "現在の tools.profile の値 '{{value}}' は OpenClaw の対応リストにありません。新しい値を選択するまでこの値を保持します。",
"unsupportedProfileLabel": "未対応",
"profiles": {
"default": "デフォルト",
"strict": "厳格",
@@ -1321,9 +1334,19 @@
"timeout": "タイムアウト(秒)",
"contextTokens": "コンテキストトークン数",
"maxConcurrent": "最大同時実行数",
"legacyTimeoutTitle": "旧タイムアウト設定を検出しました",
"legacyTimeoutDescription": "この設定ではまだ agents.defaults.timeout を使用しています。ここで保存すると timeoutSeconds に移行されます。",
"saveSuccess": "Agents 設定を保存しました",
"saveFailed": "Agents 設定の保存に失敗しました",
"loadFailed": "Agents 設定の読み込みに失敗しました"
},
"health": {
"title": "OpenClaw 設定の警告を検出しました",
"invalidToolsProfile": "tools.profile に未対応の値が設定されています。OpenClaw が現在サポートしているのは minimal、coding、messaging、full です。",
"legacyTimeout": "agents.defaults.timeout は非推奨です。Agents パネルを保存すると timeoutSeconds に移行されます。",
"stringifiedEnvVars": "env.vars はオブジェクトである必要がありますが、現在の値は文字列化または破損しているようです。",
"stringifiedShellEnv": "env.shellEnv はオブジェクトである必要がありますが、現在の値は文字列化または破損しているようです。",
"parseFailed": "openclaw.json を有効な JSON5 として解析できませんでした。ここで編集する前にファイルを修正してください。"
}
},
"env": {
+23
View File
@@ -1244,6 +1244,7 @@
}
},
"openclaw": {
"backupCreated": "已创建备份:{{path}}",
"providerKey": "供应商标识",
"providerKeyPlaceholder": "my-provider",
"providerKeyHint": "配置文件中的唯一标识符,创建后无法修改,只能使用小写字母、数字和连字符",
@@ -1277,6 +1278,10 @@
"env": {
"title": "环境变量",
"description": "管理 openclaw.json 中的环境变量配置(API Key、自定义变量等)",
"editorHint": "以 JSON 形式编辑整个 env 节点。支持 env.vars、env.shellEnv 等嵌套对象。",
"objectRequired": "OpenClaw 的 env 必须是 JSON 对象。",
"invalidJson": "OpenClaw 的 env 必须是合法 JSON。",
"empty": "OpenClaw 的 env 不能为空。空对象请使用 {}。",
"keyPlaceholder": "变量名",
"valuePlaceholder": "值",
"add": "添加变量",
@@ -1289,6 +1294,14 @@
"title": "工具权限",
"description": "管理 openclaw.json 中的工具权限配置(允许/拒绝列表)",
"profile": "权限模式",
"profileMinimal": "最小权限",
"profileCoding": "编码",
"profileMessaging": "对话",
"profileFull": "完全访问",
"profileUnset": "未设置",
"unsupportedProfileTitle": "检测到不受支持的工具配置",
"unsupportedProfileDescription": "当前 tools.profile 的值“{{value}}”不在 OpenClaw 支持列表内。在你手动选择新值之前,它会被保留。",
"unsupportedProfileLabel": "不受支持",
"profiles": {
"default": "默认",
"strict": "严格",
@@ -1321,9 +1334,19 @@
"timeout": "超时时间(秒)",
"contextTokens": "上下文 Token 数",
"maxConcurrent": "最大并发数",
"legacyTimeoutTitle": "检测到旧版超时字段",
"legacyTimeoutDescription": "当前配置仍在使用 agents.defaults.timeout。保存本页面时会迁移为 timeoutSeconds。",
"saveSuccess": "Agents 配置已保存",
"saveFailed": "保存 Agents 配置失败",
"loadFailed": "读取 Agents 配置失败"
},
"health": {
"title": "检测到 OpenClaw 配置警告",
"invalidToolsProfile": "tools.profile 使用了不受支持的值。OpenClaw 当前只支持 minimal、coding、messaging、full。",
"legacyTimeout": "agents.defaults.timeout 已废弃。打开并保存 Agents 面板即可迁移到 timeoutSeconds。",
"stringifiedEnvVars": "env.vars 应为对象,但当前值看起来像被字符串化或已损坏。",
"stringifiedShellEnv": "env.shellEnv 应为对象,但当前值看起来像被字符串化或已损坏。",
"parseFailed": "openclaw.json 不是合法 JSON5。请先修复文件,再通过这里编辑。"
}
},
"env": {