Skip to content

Commit de22332

Browse files
author
Claw English Translation
committed
feat: Translate entire app to English
- Translate all string resources (strings.xml, arrays.xml) to English - Translate all 8 layout XML files with hardcoded Chinese text - Translate all UI Composables (OnboardingFlow, SettingsSheet, SkillTabScreen, ChatComposer, NodeForegroundService, NodeRuntime) - Translate all Channel Activities (WeChat, Feishu, Discord, Signal, Telegram, Slack, WhatsApp, MCP) - Translate all agent tool descriptions (~80 files: EyeSkill, ScreenshotSkill, TapSkill, SwipeSkill, etc.) - Translate all Feishu extension tools (doc, sheet, wiki, calendar, task, drive, etc.) - Translate Discord, Weixin, and Observer extension strings - Translate MyApplication tool descriptions - Translate AgentLoop, SkillsLoader, QueryExpansion prompts - Translate Java files (ApkInfo, InstallManager, ClawIME, WakeLockManager) - Translate observer PermissionActivity layout Total: ~155 source files translated Note: self-control module excluded due to pre-existing compilation error
1 parent f50b4b1 commit de22332

File tree

144 files changed

+2557
-2554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2557
-2554
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,6 @@ local.properties
123123
test.keystore
124124
.cc-connect/
125125
termux-app-upstream/
126+
release.jks
127+
keystore.properties
128+
local.properties

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ dependencies {
251251
implementation project(':base')
252252

253253
// ========== Self-Control Module ==========
254-
implementation project(':self-control')
254+
// implementation project(':self-control') // Temporarily excluded - pre-existing compilation error
255255

256256
// ========== OpenClaw Android Module ==========
257257
implementation project(':openclaw-android')

app/src/main/java/com/xiaomo/androidforclaw/DeviceController.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object DeviceController {
3030
try {
3131
val uriString = AccessibilityProxy.captureScreen()
3232
if (uriString.isEmpty()) {
33-
Log.w(TAG, "截图失败:URI 为空")
33+
Log.w(TAG, "ScreenshotFailed:URI 为Empty")
3434
return@runBlocking null
3535
}
3636

@@ -55,11 +55,11 @@ object DeviceController {
5555
if (bitmap != null) {
5656
Pair(bitmap, uriString)
5757
} else {
58-
Log.e(TAG, "无法解码截图: $uriString")
58+
Log.e(TAG, "None法DecodeScreenshot: $uriString")
5959
null
6060
}
6161
} catch (e: Exception) {
62-
Log.e(TAG, "截图失败", e)
62+
Log.e(TAG, "ScreenshotFailed", e)
6363
null
6464
}
6565
}
@@ -88,7 +88,7 @@ object DeviceController {
8888
fun isAdbKeyboardVisible(service: AccessibilityService, context: Context): Boolean {
8989
val focusedNode = findFocusedEditText(service)
9090
val isClawIme = isClawKeyboardActive(context)
91-
Log.d("ADB键盘判断", "是否焦点在EditText: ${focusedNode != null}")
91+
Log.d("ADBKeyboard判断", "YesNo焦点在EditText: ${focusedNode != null}")
9292
return focusedNode != null && isClawIme
9393
}
9494

@@ -97,7 +97,7 @@ object DeviceController {
9797
fun detectIcons(context: Context): Pair<List<ViewNode>, List<ViewNode>>? {
9898
// 检查无障碍服务是否连接
9999
if (!AccessibilityProxy.isServiceReady()) {
100-
Log.w(TAG, "无障碍服务未就绪")
100+
Log.w(TAG, "Accessibility ServiceNot Ready")
101101
return null
102102
}
103103

@@ -116,7 +116,7 @@ object DeviceController {
116116
}
117117

118118
if (dumpView.isEmpty()) {
119-
Log.w(TAG, "无法获取 UI 树(已重试 $retryCount 次)")
119+
Log.w(TAG, "None法获取 UI 树(已Retry $retryCount 次)")
120120
return@runBlocking null
121121
}
122122

@@ -128,7 +128,7 @@ object DeviceController {
128128

129129
Pair(originalNodes, processedNodes)
130130
} catch (e: Exception) {
131-
Log.e(TAG, "获取 UI 树失败", e)
131+
Log.e(TAG, "获取 UI 树Failed", e)
132132
null
133133
}
134134
}

app/src/main/java/com/xiaomo/androidforclaw/agent/context/ContextBuilder.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class ContextBuilder(
261261
// Aligned with OpenClaw: sections joined by "\n" (no "---" separators)
262262
val finalPrompt = parts.filter { it.isNotBlank() }.joinToString("\n")
263263

264-
Log.d(TAG, "✅ System prompt 构建完成:")
264+
Log.d(TAG, "✅ System prompt 构建Done:")
265265
Log.d(TAG, " - 模式: $promptMode")
266266
Log.d(TAG, " - 总长度: ${finalPrompt.length} chars")
267267
Log.d(TAG, " - 预估 Tokens: ~${finalPrompt.length / 4}")
@@ -958,7 +958,7 @@ If something needs attention, do NOT include "HEARTBEAT_OK"; reply with the aler
958958
val stats = skillsLoader.getStatistics()
959959
return stats.getReport()
960960
} catch (e: Exception) {
961-
Log.e(TAG, "获取 Skills 统计失败", e)
961+
Log.e(TAG, "获取 Skills 统计Failed", e)
962962
return ""
963963
}
964964
}

app/src/main/java/com/xiaomo/androidforclaw/agent/context/ContextErrors.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ object ContextErrors {
4040
if (msg.contains("exceed context limit")) return true
4141

4242
// Chinese error messages
43-
if (msg.contains("上下文过长")) return true
44-
if (msg.contains("上下文超出")) return true
45-
if (msg.contains("请压缩上下文")) return true
43+
if (msg.contains("Context过长")) return true
44+
if (msg.contains("Context超出")) return true
45+
if (msg.contains("PleaseCompressContext")) return true
4646

4747
// Token quantity related
4848
if (msg.contains("tokens") && (

app/src/main/java/com/xiaomo/androidforclaw/agent/context/ContextManager.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class ContextManager(
5656
): ContextRecoveryResult {
5757
val errorMessage = ContextErrors.extractErrorMessage(error)
5858

59-
Log.e(TAG, "检测到上下文超限: $errorMessage")
60-
Log.d(TAG, "当前消息数: ${messages.size}")
59+
Log.e(TAG, "检测到Context Exceeded: $errorMessage")
60+
Log.d(TAG, "当前Message数: ${messages.size}")
6161
Log.d(TAG, "已尝试 compaction: $compactionAttempts")
6262
Log.d(TAG, "已尝试截断: $toolResultTruncationAttempted")
6363

@@ -83,7 +83,7 @@ class ContextManager(
8383
compactionAttempts++
8484
val compacted = compactionResult.getOrNull()!!
8585

86-
Log.d(TAG, "Compaction 成功: ${legacyMessages.size} -> ${compacted.size} 条消息")
86+
Log.d(TAG, "Compaction Success: ${legacyMessages.size} -> ${compacted.size} 条Message")
8787

8888
// 转换回 Message
8989
val newMessages = convertFromLegacyMessages(compacted)
@@ -94,7 +94,7 @@ class ContextManager(
9494
attempt = compactionAttempts
9595
)
9696
} else {
97-
Log.e(TAG, "Compaction 失败: ${compactionResult.exceptionOrNull()?.message}")
97+
Log.e(TAG, "Compaction Failed: ${compactionResult.exceptionOrNull()?.message}")
9898

9999
// Compaction failed, check if it's due to compaction itself causing overflow
100100
if (ContextErrors.isCompactionFailureError(errorMessage)) {
@@ -119,15 +119,15 @@ class ContextManager(
119119
val truncated = ToolResultTruncator.truncateToolResults(legacyMessages)
120120
val newMessages = convertFromLegacyMessages(truncated)
121121

122-
Log.d(TAG, "工具结果截断完成")
122+
Log.d(TAG, "Tool Result截断Done")
123123

124124
return ContextRecoveryResult.Recovered(
125125
messages = newMessages,
126126
strategy = "truncation",
127127
attempt = 1
128128
)
129129
} else {
130-
Log.d(TAG, "没有检测到超大工具结果")
130+
Log.d(TAG, "没Has检测到超大Tool Result")
131131
}
132132
}
133133

@@ -157,16 +157,16 @@ class ContextManager(
157157
suspend fun preemptivelyCompact(
158158
messages: List<Message>
159159
): List<Message> {
160-
Log.d(TAG, "预防性压缩...")
160+
Log.d(TAG, "预防性Compress...")
161161

162162
val legacyMessages = convertToLegacyMessages(messages)
163163
val result = compactor.compactMessages(legacyMessages, keepLastN = 5)
164164

165165
return if (result.isSuccess) {
166-
Log.d(TAG, "预防性压缩成功")
166+
Log.d(TAG, "预防性CompressSuccess")
167167
convertFromLegacyMessages(result.getOrNull()!!)
168168
} else {
169-
Log.w(TAG, "预防性压缩失败,使用原消息")
169+
Log.w(TAG, "预防性CompressFailed,使用原Message")
170170
messages
171171
}
172172
}

app/src/main/java/com/xiaomo/androidforclaw/agent/context/ToolResultTruncator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object ToolResultTruncator {
4747
}
4848

4949
if (truncatedCount > 0) {
50-
Log.d(TAG, "截断了 $truncatedCount 个超大工具结果")
50+
Log.d(TAG, "截断了 $truncatedCount 个超大Tool Result")
5151
}
5252

5353
return result

app/src/main/java/com/xiaomo/androidforclaw/agent/loop/AgentLoop.kt

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,18 @@ class AgentLoop(
320320
return try {
321321
runInternal(systemPrompt, userMessage, contextHistory, reasoningEnabled, images)
322322
} catch (e: Exception) {
323-
Log.e(TAG, "❌ AgentLoop 未捕获的错误", e)
323+
Log.e(TAG, "❌ AgentLoop 未捕获的Error", e)
324324
LayoutExceptionLogger.log("AgentLoop#run", e)
325325

326326
// 返回友好的错误信息给用户
327327
val errorMessage = buildString {
328-
append("❌ Agent 执行失败\n\n")
329-
append("**错误信息**: ${e.message ?: "未知错误"}\n\n")
330-
append("**错误类型**: ${e.javaClass.simpleName}\n\n")
331-
append("**建议**: \n")
332-
append("- 请检查网络连接\n")
333-
append("- 如果问题持续,请使用 /new 重新开始对话\n")
334-
append("- 查看日志获取更多详细信息")
328+
append("❌ Agent 执RowFailed\n\n")
329+
append("**Error Info**: ${e.message ?: "未知错误"}\n\n")
330+
append("**ErrorType**: ${e.javaClass.simpleName}\n\n")
331+
append("**Recommend**: \n")
332+
append("- Please检查网络Connection\n")
333+
append("- 如果Issue持续,Please使用 /new 重新StartConversation\n")
334+
append("- ViewLog获取更多VerboseInfo")
335335
}
336336

337337
AgentResult(
@@ -367,7 +367,7 @@ class AgentLoop(
367367
// Reset context manager
368368
contextManager?.reset()
369369

370-
writeLog("========== Agent Loop 开始 ==========")
370+
writeLog("========== Agent Loop Start ==========")
371371
writeLog("Model: ${modelRef ?: "default"}")
372372
writeLog("Reasoning: ${if (reasoningEnabled) "enabled" else "disabled"}")
373373
writeLog("🔧 Universal tools: ${toolRegistry.getToolCount()}")
@@ -415,7 +415,7 @@ class AgentLoop(
415415
}
416416
}
417417

418-
writeLog("📤 准备发送第一次 LLM 请求...")
418+
writeLog("📤 准备Send第一次 LLM Request...")
419419

420420
var iteration = 0
421421
var finalContent: String? = null
@@ -432,9 +432,9 @@ class AgentLoop(
432432

433433
try {
434434
// 4.1 Call LLM
435-
writeLog("📢 发送迭代进度更新...")
435+
writeLog("📢 SendIterativeProgressUpdate...")
436436
_progressFlow.emit(ProgressUpdate.Iteration(iteration))
437-
writeLog("迭代进度已发送")
437+
writeLog("IterativeProgress已Send")
438438

439439
// ===== Context Management (aligned with OpenClaw) =====
440440
val contextWindowTokens = resolveContextWindowTokens()
@@ -490,7 +490,7 @@ class AgentLoop(
490490
)
491491
}
492492
} catch (e: kotlinx.coroutines.TimeoutCancellationException) {
493-
val errorMsg = "LLM 调用超时 (${LLM_TIMEOUT_MS / 1000}s)"
493+
val errorMsg = "LLM 调用Timeout (${LLM_TIMEOUT_MS / 1000}s)"
494494
writeLog("$errorMsg")
495495
Log.w(TAG, errorMsg)
496496

@@ -532,17 +532,17 @@ class AgentLoop(
532532
// No compaction possible — surface timeout to user
533533
// (aligned with OpenClaw: surface error when compaction exhausted)
534534
writeLog("❌ LLM timeout after $timeoutCompactionAttempts compaction attempts, surfacing error")
535-
finalContent = "⏰ LLM 调用超时。请简化问题或使用 /new 开始新对话"
535+
finalContent = "⏰ LLM 调用Timeout。Please简化Issue或使用 /new Start新Conversation"
536536
break
537537
}
538538

539539
val llmDuration = System.currentTimeMillis() - llmStartTime
540540

541-
writeLog("✅ LLM 响应已收到 [耗时: ${llmDuration}ms]")
541+
writeLog("✅ LLM Response已收到 [耗时: ${llmDuration}ms]")
542542

543543
// ⚠️ Log warning if response time is too long
544544
if (llmDuration > 30_000) {
545-
writeLog("⚠️ LLM 响应耗时较长: ${llmDuration}ms")
545+
writeLog("⚠️ LLM Response耗时较长: ${llmDuration}ms")
546546
}
547547

548548
// 4.2 Display reasoning thinking process
@@ -695,13 +695,13 @@ class AgentLoop(
695695
totalExecDuration += execDuration
696696

697697
writeLog(" Result: ${result.success}, ${result.content.take(200)}")
698-
writeLog(" ⏱️ 执行耗时: ${execDuration}ms")
698+
writeLog(" ⏱️ 执Row耗时: ${execDuration}ms")
699699

700700
// Log tool execution errors (aligned with OpenClaw: no consecutive error abort)
701701
// OpenClaw lets the LLM see tool errors and decide how to proceed.
702702
// ToolLoopDetection handles runaway loops separately.
703703
if (!result.success) {
704-
writeLog(" ⚠️ 工具执行失败: ${result.content.take(200)}")
704+
writeLog(" ⚠️ Tool执RowFailed: ${result.content.take(200)}")
705705
}
706706

707707
// Record tool call result (for loop detection)
@@ -770,7 +770,7 @@ class AgentLoop(
770770
}
771771

772772
val iterationDuration = System.currentTimeMillis() - iterationStartTime
773-
writeLog("⏱️ 本轮迭代总耗时: ${iterationDuration}ms (LLM: ${llmDuration}ms, 执行: ${totalExecDuration}ms)")
773+
writeLog("⏱️ 本轮Iterative总耗时: ${iterationDuration}ms (LLM: ${llmDuration}ms, 执Row: ${totalExecDuration}ms)")
774774

775775
// 单次 iteration 耗时告警(仅 warn,不中断)
776776
if (iterationDuration > ITERATION_WARN_THRESHOLD_MS) {
@@ -804,8 +804,8 @@ class AgentLoop(
804804
val isContextOverflow = ContextErrors.isLikelyContextOverflowError(errorMessage)
805805

806806
if (isContextOverflow && contextManager != null) {
807-
writeLog("🔄 检测到上下文超限,尝试恢复...")
808-
Log.w(TAG, "🔄 检测到上下文超限,尝试恢复...")
807+
writeLog("🔄 检测到Context Exceeded,尝试Restore...")
808+
Log.w(TAG, "🔄 检测到Context Exceeded,尝试Restore...")
809809
_progressFlow.emit(ProgressUpdate.ContextOverflow("Context overflow detected, attempting recovery..."))
810810

811811
// Attempt recovery
@@ -816,8 +816,8 @@ class AgentLoop(
816816

817817
when (recoveryResult) {
818818
is ContextRecoveryResult.Recovered -> {
819-
writeLog("上下文恢复成功: ${recoveryResult.strategy} (attempt ${recoveryResult.attempt})")
820-
Log.d(TAG, "上下文恢复成功: ${recoveryResult.strategy} (attempt ${recoveryResult.attempt})")
819+
writeLog("ContextRestoreSuccess: ${recoveryResult.strategy} (attempt ${recoveryResult.attempt})")
820+
Log.d(TAG, "ContextRestoreSuccess: ${recoveryResult.strategy} (attempt ${recoveryResult.attempt})")
821821
_progressFlow.emit(ProgressUpdate.ContextRecovered(
822822
strategy = recoveryResult.strategy,
823823
attempt = recoveryResult.attempt
@@ -831,14 +831,14 @@ class AgentLoop(
831831
continue
832832
}
833833
is ContextRecoveryResult.CannotRecover -> {
834-
writeLog("上下文恢复失败: ${recoveryResult.reason}")
835-
Log.e(TAG, "上下文恢复失败: ${recoveryResult.reason}")
834+
writeLog("ContextRestoreFailed: ${recoveryResult.reason}")
835+
Log.e(TAG, "ContextRestoreFailed: ${recoveryResult.reason}")
836836
_progressFlow.emit(ProgressUpdate.Error("Context overflow: ${recoveryResult.reason}"))
837837

838838
finalContent = buildString {
839-
append("上下文溢出\n\n")
840-
append("**错误**: ${recoveryResult.reason}\n\n")
841-
append("**建议**: 对话历史过长,请使用 /new 或 /reset 开始新对话")
839+
append("Context溢出\n\n")
840+
append("**Error**: ${recoveryResult.reason}\n\n")
841+
append("**Recommend**: Chat History过长,Please使用 /new 或 /reset Start新Conversation")
842842
}
843843
break
844844
}
@@ -896,21 +896,21 @@ class AgentLoop(
896896
if (isBilling) {
897897
append("⚠️ Billing error — please check your account balance or API key quota.")
898898
} else {
899-
append("执行出错\n\n")
899+
append("Execution Error\n\n")
900900

901901
when (e) {
902902
is com.xiaomo.androidforclaw.providers.LLMException -> {
903-
append("**错误类型**: API 调用失败\n")
904-
append("**错误信息**: ${e.message}\n\n")
905-
append("**建议**: 请检查模型配置和 API Key 是否正确\n")
906-
append("**配置文件**: ${StoragePaths.openclawConfig.absolutePath}\n")
903+
append("**ErrorType**: API 调用Failed\n")
904+
append("**Error Info**: ${e.message}\n\n")
905+
append("**Recommend**: Please检查Model Configuration和 API Key YesNo正确\n")
906+
append("**Configure文件**: ${StoragePaths.openclawConfig.absolutePath}\n")
907907
}
908908
else -> {
909-
append("**错误信息**: ${e.message}\n")
909+
append("**Error Info**: ${e.message}\n")
910910
}
911911
}
912912

913-
append("\n**调试信息**:\n```\n")
913+
append("\n**Debug Info**:\n```\n")
914914
append(e.stackTraceToString().take(800))
915915
append("\n```")
916916
}
@@ -933,8 +933,8 @@ class AgentLoop(
933933
// Add final content as assistant message if not empty
934934
val effectiveFinalContent = when {
935935
finalContent != null -> finalContent
936-
shouldStop -> "任务已停止"
937-
else -> "无响应"
936+
shouldStop -> "任务已Stop"
937+
else -> "NoneResponse"
938938
}
939939
if (effectiveFinalContent.isNotEmpty()) {
940940
messages.add(com.xiaomo.androidforclaw.providers.llm.Message(

app/src/main/java/com/xiaomo/androidforclaw/agent/memory/QueryExpansion.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ object QueryExpansion {
4040

4141
/** Chinese stop words (67) */
4242
private val STOP_WORDS_ZH = setOf(
43-
"", "", "", "", "", "", "", "", "", "",
43+
"", "", "", "Yes", "", "", "", "", "", "",
4444
"", "", "", "什么", "怎么", "为什么", "如何", "哪里", "哪个",
4545
"", "", "", "", "", "", "", "", "", "",
4646
"", "", "", "", "", "", "", "", "", "",
47-
"所以", "因为", "虽然", "但是", "如果", "那么",
48-
"", "没有", "", "不是", "可以", "", "", "",
47+
"所以", "因为", "虽然", "但Yes", "如果", "那么",
48+
"Has", "没Has", "", "不Yes", "Can", "", "", "",
4949
"一个", "一些", "这个", "那个", "", "非常", "比较",
5050
"", "", "", "", "", "",
5151
"", "帮我", "", "", "告诉", "给我"

0 commit comments

Comments
 (0)