Skip to content

Commit 0ae882d

Browse files
authored
Added BG language (#8)
1 parent 03775e9 commit 0ae882d

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed
Binary file not shown.

Sources/units-swift/UnitsError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
enum UnitsError: Error {
10+
public enum UnitsError: Error {
1111
case notFound(type: String, inTable: [String: String])
1212
case unsupported(unit: String, type: String)
1313
case localization(error: Error)

Tests/units-swiftTests/LocalizatorTests.swift

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,38 @@ class LocalizatorTests: XCTestCase {
378378
}
379379
}
380380

381+
func testLocalizatorBG() {
382+
do {
383+
let localizator = try UnitsLocalizator(language: "bg")
384+
try self.checkAllLocalizations(language: "bg")
385+
386+
XCTAssertEqual(localizator.in.short, "в")
387+
XCTAssertEqual(localizator.in.full, "Инч")
388+
XCTAssertEqual(localizator.ft.short, "ft")
389+
XCTAssertEqual(localizator.ft.full, "Фут")
390+
XCTAssertEqual(localizator.mile.short, "ми")
391+
XCTAssertEqual(localizator.mile.full, "Миля")
392+
XCTAssertEqual(localizator.mm.short, "мм")
393+
XCTAssertEqual(localizator.mm.full, "Милиметър")
394+
XCTAssertEqual(localizator.cm.short, "см")
395+
XCTAssertEqual(localizator.cm.full, "Сантиметър")
396+
XCTAssertEqual(localizator.m.short, "м")
397+
XCTAssertEqual(localizator.m.full, "Метър")
398+
XCTAssertEqual(localizator.km.short, "км")
399+
XCTAssertEqual(localizator.km.full, "Километър")
400+
401+
} catch let error {
402+
XCTFail("error - \(error)")
403+
}
404+
}
405+
381406
// Is all language tested? Failed if not
382407
func testCheckTestCount() {
383408
let main = Bundle(for: UnitsLocalizator.self)
384409
let localizable = main.path(forResource: "Localizable", ofType: "bundle")
385410
.flatMap { Bundle(path: $0) }
386411

387-
XCTAssertEqual(localizable?.localizations, ["de", "en", "uk", "es", "et", "hu", "pl", "ru", "pt"])
412+
XCTAssertEqual(localizable?.localizations, ["de", "en", "uk", "es", "et", "bg", "hu", "pl", "ru", "pt"])
388413
XCTAssertEqual(localizable?.localizations.count, LocalizatorTests.allTests.count - 1)
389414
}
390415

@@ -398,6 +423,7 @@ class LocalizatorTests: XCTestCase {
398423
("testLocalizatorUK", testLocalizatorUK),
399424
("testLocalizatorPL", testLocalizatorPL),
400425
("testLocalizatorET", testLocalizatorET),
426+
("testLocalizatorBG", testLocalizatorBG),
401427
("testCheckTestCount", testCheckTestCount)
402428
]
403429
}

Tests/units-swiftTests/UnitTypeTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class UnitTypeTests: XCTestCase {
205205
let units = try Units.default(language: "ro")
206206
XCTFail("units - \(units)")
207207
} catch let error {
208-
XCTAssertEqual("\(error)", "localization(error: units_swift.UnitsLocalizator.E.unsupportedLanguage(language: \"ro\", supported: Optional([\"de\", \"en\", \"uk\", \"es\", \"et\", \"hu\", \"pl\", \"ru\", \"pt\"])))")
208+
XCTAssertEqual("\(error)", "localization(error: units_swift.UnitsLocalizator.E.unsupportedLanguage(language: \"ro\", supported: Optional([\"de\", \"en\", \"uk\", \"es\", \"et\", \"bg\", \"hu\", \"pl\", \"ru\", \"pt\"])))")
209209
}
210210
}
211211

@@ -221,7 +221,7 @@ class UnitTypeTests: XCTestCase {
221221
let units = try Units(units: [:], language: "ro")
222222
XCTFail("units - \(units)")
223223
} catch let error {
224-
XCTAssertEqual("\(error)", "localization(error: units_swift.UnitsLocalizator.E.unsupportedLanguage(language: \"ro\", supported: Optional([\"de\", \"en\", \"uk\", \"es\", \"et\", \"hu\", \"pl\", \"ru\", \"pt\"])))")
224+
XCTAssertEqual("\(error)", "localization(error: units_swift.UnitsLocalizator.E.unsupportedLanguage(language: \"ro\", supported: Optional([\"de\", \"en\", \"uk\", \"es\", \"et\", \"bg\", \"hu\", \"pl\", \"ru\", \"pt\"])))")
225225
}
226226
}
227227

0 commit comments

Comments
 (0)