ios - Could not Localize strings in my xcframework - Stack Overflow

I have a SwiftUI framework that's i want to implement Localizable Strings for English and Brazilia

I have a SwiftUI framework that's i want to implement Localizable Strings for English and Brazilian Portuguese, here is my project, code and github repo:

My HomeLocalizable.swift:

enum HomeLocalizable {
    // MARK: - Home -
    enum Home {
        static let title = HomeLocalizable.tr("Localizable", "home.title", fallback: "Financial Control")
    }
}

// MARK: - Implementation Details -

extension HomeLocalizable {
  private static func tr(_ table: String, _ key: String, _ args: CVarArg..., fallback value: String = "") -> String {
    let format = BundleToken.bundle.localizedString(forKey: key, value: value, table: table)
    return String(format: format, locale: Locale.current, arguments: args)
  }
}

private final class BundleToken {
  static let bundle: Bundle = {
    #if SWIFT_PACKAGE
    return Bundle.module
    #else
    return Bundle(for: BundleToken.self)
    #endif
  }()
}

String files: String file 1 String file 2

Github project:

I tried using Localizable in Text() view, the example above, and i couldn't get the translated value, only the keys or fallback

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745646271a4637991.html

相关推荐

  • ios - Could not Localize strings in my xcframework - Stack Overflow

    I have a SwiftUI framework that's i want to implement Localizable Strings for English and Brazilia

    22天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信