Quellcode durchsuchen

[*] 增加注释

SuperC vor 11 Monaten
Ursprung
Commit
31b0b65e24
1 geänderte Dateien mit 11 neuen und 0 gelöschten Zeilen
  1. 11 0
      bugu/bugu/HXCore/Generated/Strings+Generated.swift

+ 11 - 0
bugu/bugu/HXCore/Generated/Strings+Generated.swift

@@ -1206,18 +1206,29 @@ internal enum L10n {
 // MARK: - Implementation Details
 
 extension L10n {
+    /// 根据指定的键和参数获取本地化字符串
+    /// - Parameters:
+    ///   - key: 本地化字符串的键
+    ///   - args: 可变参数,用于格式化字符串
+    ///   - fallback: 当本地化字符串未找到时的默认值
+    /// - Returns: 格式化后的本地化字符串
   private static func tr(_ key: String, _ args: CVarArg..., fallback value: String) -> String {
+      // 从指定的 Bundle 中获取本地化字符串
     let format = BundleToken.bundle.localizedString(forKey: key, value: value, table: nil)
+      // 使用当前区域设置格式化字符串
     return String(format: format, locale: Locale.current, arguments: args)
   }
 }
 
 // swiftlint:disable convenience_type
+/// 用于获取当前模块的 Bundle
 private final class BundleToken {
   static let bundle: Bundle = {
     #if SWIFT_PACKAGE
+      // 如果使用 Swift Package Manager,返回模块的 Bundle
     return Bundle.module
     #else
+      // 否则,返回当前类所在的 Bundle
     return Bundle(for: BundleToken.self)
     #endif
   }()