Update docs

This commit is contained in:
David Jennes
2019-03-03 20:54:51 +01:00
parent 53e2db8c49
commit 742e272b09
5 changed files with 26 additions and 18 deletions
@@ -39,8 +39,8 @@ enum L10n {
return L10n.tr("Localizable", "apples.count", p1)
}
/// Those %d bananas belong to %@.
static func bananasOwner(_ p1: Int, _ p2: String) -> String {
return L10n.tr("Localizable", "bananas.owner", p1, p2)
static func bananasOwner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("Localizable", "bananas.owner", p1, String(describing: p2))
}
```
@@ -28,15 +28,19 @@ You can customize some elements of this template by overriding the following par
**Extract:**
```swift
enum L10n {
internal enum L10n {
/// Some alert body there
case alertMessage
internal static let alertMessage = L10n.tr("Localizable", "alert__message")
/// Title of the alert
case alertTitle
internal static let alertTitle = L10n.tr("Localizable", "alert__title")
/// You have %d apples
case applesCount(Int)
internal static func applesCount(_ p1: Int) -> String {
return L10n.tr("Localizable", "apples.count", p1)
}
/// Those %d bananas belong to %@.
case bananasOwner(Int, String)
internal static func bananasOwner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("Localizable", "bananas.owner", p1, String(describing: p2))
}
}
```
@@ -50,8 +50,8 @@ enum L10n {
enum Bananas {
/// Those %d bananas belong to %@.
static func owner(_ p1: Int, _ p2: String) -> String {
return L10n.tr("bananas.owner", p1, p2)
static func owner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("bananas.owner", p1, String(describing: p2))
}
}
}
@@ -49,8 +49,8 @@ enum L10n {
enum Bananas {
/// Those %d bananas belong to %@.
static func owner(_ p1: Int, _ p2: String) -> String {
return L10n.tr("bananas.owner", p1, p2)
static func owner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("bananas.owner", p1, String(describing: p2))
}
}
}
+11 -7
View File
@@ -711,8 +711,8 @@ enum L10n {
enum Bananas {
/// Those %d bananas belong to %@.
static func owner(_ p1: Int, _ p2: String) -> String {
return L10n.tr("bananas.owner", p1, p2)
static func owner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("bananas.owner", p1, String(describing: p2))
}
}
}
@@ -741,15 +741,19 @@ SwiftGen also has a template to support flat strings files (i.e. no dot syntax).
<summary>Example of code generated by the flat bundled template</summary>
```swift
enum L10n {
internal enum L10n {
/// Some alert body there
case alertMessage
internal static let alertMessage = L10n.tr("Localizable", "alert__message")
/// Title of the alert
case alertTitle
internal static let alertTitle = L10n.tr("Localizable", "alert__title")
/// You have %d apples
case applesCount(Int)
internal static func applesCount(_ p1: Int) -> String {
return L10n.tr("Localizable", "apples.count", p1)
}
/// Those %d bananas belong to %@.
case bananasOwner(Int, String)
internal static func bananasOwner(_ p1: Int, _ p2: Any) -> String {
return L10n.tr("Localizable", "bananas.owner", p1, String(describing: p2))
}
}
```
</details>