Skip to content

Commit ede3c76

Browse files
committed
docs(国际化): 为错误信息和调试输出添加英文翻译
在错误信息和调试输出中添加英文翻译,方便国际开发者理解
1 parent c059301 commit ede3c76

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

GameFrameX.Foundation.Options/CommandLineArgumentConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public List<string> ConvertToStandardFormat(string[] args)
196196
}
197197
catch (Exception ex)
198198
{
199-
throw new ArgumentException($"处理命令行参数时发生错误: {ex.Message}", ex);
199+
throw new ArgumentException($"处理命令行参数时发生错误 (An error occurred while processing command-line arguments): {ex.Message}", ex);
200200
}
201201
}
202202

@@ -231,4 +231,4 @@ private static bool ParseBooleanValue(string value)
231231
var normalizedValue = value.Trim().ToLowerInvariant();
232232
return normalizedValue is "true" or "1" or "yes" or "on";
233233
}
234-
}
234+
}

GameFrameX.Foundation.Options/OptionsBuilder.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public T Build(bool skipValidation = false)
212212
}
213213
catch (Exception ex)
214214
{
215-
throw new ArgumentException($"处理命令行参数时发生错误: {ex.Message}", ex);
215+
throw new ArgumentException($"处理命令行参数时发生错误 (An error occurred while processing command-line arguments): {ex.Message}", ex);
216216
}
217217
}
218218

@@ -230,7 +230,7 @@ public T Build(bool skipValidation = false)
230230
catch (Exception ex)
231231
{
232232
// 发生异常时抛出异常
233-
throw new ArgumentException($"构建选项时发生错误: {ex.Message}", ex);
233+
throw new ArgumentException($"构建选项时发生错误 (An error occurred while building options): {ex.Message}", ex);
234234
}
235235
}
236236

@@ -261,7 +261,7 @@ private void ApplyDefaultValues(T target)
261261
}
262262
catch (Exception ex)
263263
{
264-
Console.WriteLine($"设置属性 {property.Name} 的默认值时发生错误: {ex.Message}");
264+
Console.WriteLine($"设置属性 {property.Name} 的默认值时发生错误 (An error occurred while setting default value for property {property.Name}): {ex.Message}");
265265
Console.WriteLine(ex);
266266
}
267267
}
@@ -319,7 +319,7 @@ private void ValidateRequiredOptions(T target)
319319

320320
if (missingOptions.Count > 0)
321321
{
322-
throw new ArgumentException($"缺少必需的选项: {string.Join(", ", missingOptions)}");
322+
throw new ArgumentException($"缺少必需的选项 (Missing required options): {string.Join(", ", missingOptions)}");
323323
}
324324
}
325325

@@ -425,7 +425,7 @@ private Dictionary<string, object> GetEnvironmentVariables()
425425
}
426426
catch (Exception ex)
427427
{
428-
Console.WriteLine($"获取环境变量时发生错误: {ex.Message}");
428+
Console.WriteLine($"获取环境变量时发生错误 (An error occurred while retrieving environment variables): {ex.Message}");
429429
Console.WriteLine(ex);
430430
}
431431

@@ -782,7 +782,7 @@ private void ApplyOptions(T target, Dictionary<string, object> options)
782782
}
783783
catch (Exception ex)
784784
{
785-
Console.WriteLine($"设置属性 {property.Name} 时发生错误: {ex.Message}");
785+
Console.WriteLine($"设置属性 {property.Name} 时发生错误 (An error occurred while setting property {property.Name}): {ex.Message}");
786786
Console.WriteLine(ex);
787787
}
788788
}

GameFrameX.Foundation.Options/OptionsDebugger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ private static string FormatPropertyValue(object value)
438438
var result = $"[{string.Join(", ", elements)}]";
439439
if (array.Length > 5)
440440
{
441-
result += $" (共{array.Length}个元素)";
441+
result += $" (Total {array.Length} elements / {array.Length}个元素)";
442442
}
443443

444444
return result;
@@ -456,7 +456,7 @@ private static string FormatPropertyValue(object value)
456456
var result = $"[{string.Join(", ", elements)}]";
457457
if (list.Count > 5)
458458
{
459-
result += $" (共{list.Count}个元素)";
459+
result += $" (Total {list.Count} elements / {list.Count}个元素)";
460460
}
461461

462462
return result;

GameFrameX.Foundation.Options/OptionsProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private static bool ShouldEnableDebugOutput(bool? enableDebugOutput = null)
101101
// 如果启用调试输出,打印缓存的选项对象
102102
if (shouldDebug)
103103
{
104-
Console.WriteLine("⚠️ 使用缓存的配置对象");
104+
Console.WriteLine("⚠️ 使用缓存的配置对象 (Using cached configuration object)");
105105
OptionsDebugger.PrintParsedOptions(cachedResult);
106106
}
107107

@@ -206,4 +206,4 @@ public static bool IsDebugModeEnabled()
206206
{
207207
return ShouldEnableDebugOutput();
208208
}
209-
}
209+
}

0 commit comments

Comments
 (0)