From a58eb55e2614c7478856b1f5d74fd3af2ad2821c Mon Sep 17 00:00:00 2001 From: Adrian Bobrowski Date: Sun, 12 Nov 2017 14:32:34 +0100 Subject: [PATCH] Release 5.0.0 --- .../Example iOS/Scenes/Plurals/PluralsViewController.swift | 2 +- README.md | 2 +- Source/Extensions/String+Localizable.swift | 4 ++-- Tests/StringExtensionTests.swift | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Example/Example iOS/Scenes/Plurals/PluralsViewController.swift b/Example/Example iOS/Scenes/Plurals/PluralsViewController.swift index 179123d..7d50969 100644 --- a/Example/Example iOS/Scenes/Plurals/PluralsViewController.swift +++ b/Example/Example iOS/Scenes/Plurals/PluralsViewController.swift @@ -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 } diff --git a/README.md b/README.md index bab1903..9697620 100644 --- a/README.md +++ b/README.md @@ -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) ``` diff --git a/Source/Extensions/String+Localizable.swift b/Source/Extensions/String+Localizable.swift index d55dc8c..0588f63 100644 --- a/Source/Extensions/String+Localizable.swift +++ b/Source/Extensions/String+Localizable.swift @@ -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) } } diff --git a/Tests/StringExtensionTests.swift b/Tests/StringExtensionTests.swift index 5b8f639..509ebff 100644 --- a/Tests/StringExtensionTests.swift +++ b/Tests/StringExtensionTests.swift @@ -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") } }