diff --git a/Modules/Package.resolved b/Modules/Package.resolved index 5e4613747529..ca1e5f385613 100644 --- a/Modules/Package.resolved +++ b/Modules/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "394a1dae231289152fc0a7f94cfb495587468c99f146311d7a94ac6a25772e0b", + "originHash" : "5aaa821f72e65770fd41b53c0fd652330dc9ca29e3bd17557b2eb9812ef74c99", "pins" : [ { "identity" : "alamofire", @@ -131,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/wordpress-mobile/GutenbergKit", "state" : { - "revision" : "7180587f49d3c3bfdb34cc3e80b2a9d22a3cd93e", - "version" : "0.18.1" + "revision" : "ac9b899d189d20a0d51d20e75da9f5515fc183ab", + "version" : "0.19.0-alpha.0" } }, { diff --git a/Modules/Package.swift b/Modules/Package.swift index 9d07d6b80bb7..153d701c39b9 100644 --- a/Modules/Package.swift +++ b/Modules/Package.swift @@ -62,7 +62,7 @@ let package = Package( revision: "b34794c9a3f32312e1593d4a3d120572afa0d010" ), .package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"), - .package(url: "https://github.com/wordpress-mobile/GutenbergKit", from: "0.18.1"), + .package(url: "https://github.com/wordpress-mobile/GutenbergKit", from: "0.19.0-alpha.0"), .package( url: "https://github.com/automattic/wordpress-rs", exact: "0.6.0" diff --git a/WordPress/Classes/ViewRelated/NewGutenberg/GBKExtensions.swift b/WordPress/Classes/ViewRelated/NewGutenberg/GBKExtensions.swift index cb89424b2db9..0ac42da4fb9f 100644 --- a/WordPress/Classes/ViewRelated/NewGutenberg/GBKExtensions.swift +++ b/WordPress/Classes/ViewRelated/NewGutenberg/GBKExtensions.swift @@ -33,7 +33,7 @@ extension GutenbergKit.EditorViewControllerDelegate { } } -private func getLocalizedString(for value: GutenbergKit.EditorLocalizableString) -> String { +private func getLocalizedString(for value: GutenbergKit.EditorLocalizableString) -> String? { switch value { case .showMore: NSLocalizedString( @@ -91,6 +91,24 @@ private func getLocalizedString(for value: GutenbergKit.EditorLocalizableString) value: "All", comment: "Category name for section showing all patterns" ) + case .patternsCount(let count): + if count == 1 { + NSLocalizedString( + "editor.patterns.count.singular", + value: "1 pattern", + comment: "Singular label displaying the number of patterns in a category" + ) + } else { + String( + format: NSLocalizedString( + "editor.patterns.count.plural", + value: "%1$d patterns", + comment: + "Plural label displaying the number of patterns in a category. %1$d is a placeholder for the number of patterns." + ), + count + ) + } case .loadingEditor: NSLocalizedString( "editor.loading.title", @@ -134,11 +152,17 @@ private func getLocalizedString(for value: GutenbergKit.EditorLocalizableString) value: "Dismiss", comment: "Button title to dismiss the Lockdown Mode warning" ) + // Declining a key lets the editor render its own string, so strings added + // by a newer GutenbergKit appear in English rather than breaking this build. + // `@unknown` because a plain `default` warns that it will never execute + // while this switch happens to cover every case. + @unknown default: + nil } } extension EditorLocalizableString { - var localized: String { + var localized: String? { getLocalizedString(for: self) } }