diff --git a/Examples/LocalizedStringApp/LocalizedStringAppTests/LocalizedStringAppTests.swift b/Examples/LocalizedStringApp/LocalizedStringAppTests/LocalizedStringAppTests.swift index a180e156..b0a94705 100644 --- a/Examples/LocalizedStringApp/LocalizedStringAppTests/LocalizedStringAppTests.swift +++ b/Examples/LocalizedStringApp/LocalizedStringAppTests/LocalizedStringAppTests.swift @@ -208,6 +208,12 @@ class LocalizedStringAppTests: XCTestCase { R.string.ten.ten1(things: 1), String(format: NSLocalizedString("ten1", tableName: "ten", comment: ""), 1) ) + + /* default preferred language */ + XCTAssertEqual( + R.string(preferredLanguages: nil).one.one1(), + NSLocalizedString("one1", tableName: "one", comment: "") + ) } diff --git a/Sources/RswiftGenerators/StringsTable+Generator.swift b/Sources/RswiftGenerators/StringsTable+Generator.swift index 9073b273..395750e5 100644 --- a/Sources/RswiftGenerators/StringsTable+Generator.swift +++ b/Sources/RswiftGenerators/StringsTable+Generator.swift @@ -47,7 +47,7 @@ extension Struct { deploymentTarget: deploymentTarget, name: SwiftIdentifier(name: name), params: [ - .init(name: "preferredLanguages", localName: nil, typeReference: .init(module: .stdLib, rawName: "[String]"), defaultValue: nil), + .init(name: "preferredLanguages", localName: nil, typeReference: .init(module: .stdLib, rawName: "[String]?"), defaultValue: "nil"), .init(name: "locale", localName: nil, typeReference: .init(module: .stdLib, rawName: "Locale?"), defaultValue: "nil") ], returnType: TypeReference(module: .host, rawName: self.name.value),