SmartQuotes
Swift String
的简单扩展,用于将直接引用符号转换为印刷正确的弯曲版本。
此软件包在 String
上提供了 .withSmartQuotes
属性,默认转换为英语。
对于其他区域化设置,可以在 .withSmartQuotes(locale: Locale?)
中提供地区。目前仅实现了 de
、fi
和 sv
。欢迎其他地区的贡献!
使用
import SmartQuotes
"\"Crime peaked in the '90s\"".withSmartQuotes // “Crime peaked in the ’90s”
"\"Crime peaked in the '90s\"".withSmartQuotes( // „Crime peaked in the ‘90s“
Locale(identifier: "de")
)
安装
Carthage
# Cartfile
github "hallee/swift-smart-quotes" ~> 0.0.1
CocoaPods
# Podfile
pod 'SmartQuotes'
SwiftPM
dependencies: [
.package(url: "https://github.com/hallee/swift-smart-quotes", from: "0.0.1")
],
targets: [
.target(name: "YourTarget", dependencies: ["SmartQuotes"])
]
TODO
- 本地化