From 9526fc1724af5bcb2cb2a1823dde148d4fdfe70a Mon Sep 17 00:00:00 2001 From: Adrian Bobrowski Date: Tue, 23 May 2017 09:30:53 +0200 Subject: [PATCH] Release 2.0.4 --- CHANGELOG.md | 3 +++ Example/L10n Tests/L10n_EnglishLanguage_Tests.swift | 4 ++++ Example/L10n Tests/L10n_PolishLanguage_Tests.swift | 4 ++++ Example/L10n Tests/L10n_UnsupportedLanguage_Tests.swift | 4 ++++ L10n-swift.podspec | 2 +- Source/Extensions/Int+l10n.swift | 9 +++++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5f5fff..6755752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log +## [2.0.4](https://github.com/Decybel07/L10n-swift/tree/2.0.4) (2017-05-23) +* Support for display integer with leading zeros + ## [2.0.3](https://github.com/Decybel07/L10n-swift/tree/2.0.3) (2017-05-20) * Create example for mac diff --git a/Example/L10n Tests/L10n_EnglishLanguage_Tests.swift b/Example/L10n Tests/L10n_EnglishLanguage_Tests.swift index cf71940..1f4e4a9 100644 --- a/Example/L10n Tests/L10n_EnglishLanguage_Tests.swift +++ b/Example/L10n Tests/L10n_EnglishLanguage_Tests.swift @@ -83,6 +83,10 @@ class L10n_EnglishLanguage_Tests: XCTestCase { XCTAssertEqual(1.l10n(), "1") XCTAssertEqual(15.l10n(), "15") XCTAssertEqual(7_215_633.l10n(), "7,215,633") + + XCTAssertEqual(0.l10n(minIntegerDigits: 3), "000") + XCTAssertEqual(1.l10n(minIntegerDigits: 2), "01") + XCTAssertEqual(15.l10n(minIntegerDigits: 1), "15") } func testDouble() { diff --git a/Example/L10n Tests/L10n_PolishLanguage_Tests.swift b/Example/L10n Tests/L10n_PolishLanguage_Tests.swift index 16bc157..ab275b4 100644 --- a/Example/L10n Tests/L10n_PolishLanguage_Tests.swift +++ b/Example/L10n Tests/L10n_PolishLanguage_Tests.swift @@ -83,6 +83,10 @@ class L10n_PolishLanguage_Tests: XCTestCase { XCTAssertEqual(1.l10n(), "1") XCTAssertEqual(15.l10n(), "15") XCTAssertEqual(7_215_633.l10n(), "7 215 633") + + XCTAssertEqual(0.l10n(minIntegerDigits: 3), "000") + XCTAssertEqual(1.l10n(minIntegerDigits: 2), "01") + XCTAssertEqual(15.l10n(minIntegerDigits: 1), "15") } func testDouble() { diff --git a/Example/L10n Tests/L10n_UnsupportedLanguage_Tests.swift b/Example/L10n Tests/L10n_UnsupportedLanguage_Tests.swift index e8c1d52..9088e26 100644 --- a/Example/L10n Tests/L10n_UnsupportedLanguage_Tests.swift +++ b/Example/L10n Tests/L10n_UnsupportedLanguage_Tests.swift @@ -68,6 +68,10 @@ class L10n_UnsupportedLanguage_Tests: XCTestCase { XCTAssertEqual(1.l10n(), "1") XCTAssertEqual(15.l10n(), "15") XCTAssertEqual(7_215_633.l10n(), "7215633") + + XCTAssertEqual(0.l10n(minIntegerDigits: 3), "000") + XCTAssertEqual(1.l10n(minIntegerDigits: 2), "01") + XCTAssertEqual(15.l10n(minIntegerDigits: 1), "15") } func testDouble() { diff --git a/L10n-swift.podspec b/L10n-swift.podspec index 5bb8710..34fb5af 100644 --- a/L10n-swift.podspec +++ b/L10n-swift.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'L10n-swift' s.module_name = 'L10n' - s.version = '2.0.3' + s.version = '2.0.4' s.summary = 'Localization of an application with ability to change language "on the fly" and support for plural forms in any language.' s.description = <<-DESC diff --git a/Source/Extensions/Int+l10n.swift b/Source/Extensions/Int+l10n.swift index 8760103..983365c 100644 --- a/Source/Extensions/Int+l10n.swift +++ b/Source/Extensions/Int+l10n.swift @@ -16,4 +16,13 @@ extension Int { public func l10n() -> String { return L10n.shared.string(format: "%d", self) } + + /** + Returns a localized self description value with leading zeros. + + - returns: A localized self description value with leading zeros. + */ + public func l10n(minIntegerDigits: Int) -> String { + return L10n.shared.string(format: "%0\(minIntegerDigits)d", self) + } }