genstrings
可以很好地从 .m 文件中提取可本地化的内容,
find . -name \*.m | xargs genstrings -o en.lproj
但是,不适用于 .swift 文件,
find . -name \*.swift | xargs genstrings -o en.lproj
最佳答案
就我而言,genstrings
工具在 swift 上运行良好。这是我的测试:
// MyClass.swift
let message = NSLocalizedString("This is the test message.", comment: "Test")
然后,在类的文件夹中
# generate strings for all swift files (even in nested directories) $ find . -name \*.swift | xargs genstrings -o . # See results $ cat Localizable.strings /* Test */ "This is the test message." = "This is the test message."; $
关于objective-c - Swift 文件的 genstrings 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26340670/