Skip to content

Commit

Permalink
Release 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Decybel07 committed Nov 12, 2017
1 parent 207faa0 commit a58eb55
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension PluralsViewController: UITableViewDataSource {
let item = self.items[indexPath.row]

cell.textLabel?.text = L10n.shared.locale?.localizedString(forLanguageCode: item.language)
cell.detailTextLabel?.text = "plurals.numberOfApples".l10n(item, self.value)
cell.detailTextLabel?.text = "plurals.numberOfApples".l10n(item, arg: self.value)

return cell
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ github "Decybel07/L10n-swift", ~> 5.0

### Get plural

Add `.l10(_ arg: CVarArg)` following any `String` object you want translated with plurals:
Add `.l10(arg: CVarArg)` following any `String` object you want translated with plurals:
```swift
"numberOfApples".l10n(2)
```
Expand Down
4 changes: 2 additions & 2 deletions Source/Extensions/String+Localizable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ extension String: Localizable {
Returns a localized plural version of the string designated by `self` and residing in *resource*.

- parameter instance: The instance of `L10n` used for localization.
- parameter args: The values for which the appropriate plural form is selected.
- parameter arg: The value for which the appropriate plural form is selected.

- returns: A localized plural version of the string designated by `self` or `self` if not found.
*/
public func l10n(_ instance: L10n = .shared, resource: String? = nil, _ arg: CVarArg) -> String {
public func l10n(_ instance: L10n = .shared, resource: String? = nil, arg: CVarArg) -> String {
return instance.plural(for: self, resource: resource, arg: arg)
}
}
4 changes: 2 additions & 2 deletions Tests/StringExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class StringExtensionTests: XCTestCase {
}

func testStringWithArgs() {
XCTAssertEqual("numberOfApples".l10n(self.instance, 2), "2 jabłka")
XCTAssertEqual("numberOfApples".l10n(self.instance, arg: 2), "2 jabłka")
}

func testStringWithArgsAsArray() {
XCTAssertEqual("numberOfApples".l10n(self.instance, 5), "5 jabłek")
XCTAssertEqual("numberOfApples".l10n(self.instance, arg: 5), "5 jabłek")
}
}

0 comments on commit a58eb55

Please sign in to comment.