Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #7813: Localize folder item count text. (#7840)
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub authored Aug 8, 2023
1 parent f6ce22b commit eb78399
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct PlaylistChangeFoldersView: View {
VStack(alignment: .leading) {
Text(folder.title ?? "")
.foregroundColor(Color(.braveLabel))
Text("\(folder.playlistItems?.count ?? 0) items")
Text(folderCountLabel(folder.playlistItems?.count ?? 0))
.foregroundColor(Color(.secondaryBraveLabel))
.font(.subheadline)
}
Expand Down Expand Up @@ -102,6 +102,10 @@ struct PlaylistChangeFoldersView: View {
}
}
}

private func folderCountLabel(_ count: Int) -> String {
String.localizedStringWithFormat(count == 1 ? Strings.PlayList.folderItemCountSingular : Strings.PlayList.folderItemCountPlural, count)
}
}

private struct CreateFolderView: View {
Expand Down
10 changes: 10 additions & 0 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,16 @@ extension Strings {
NSLocalizedString("playlist.playlistAlreadyShowingBody", tableName: "BraveShared", bundle: .module,
value: "Playlist is already active on another window",
comment: "Playlist alert message when playlist is already showing on a different window")

public static let folderItemCountSingular =
NSLocalizedString("playlist.foldersCountSingular", tableName: "BraveShared", bundle: .module,
value: "%d item",
comment: "Title for when there's a single item inside of a folder")

public static let folderItemCountPlural =
NSLocalizedString("playlist.folderItemCountPlural", tableName: "BraveShared", bundle: .module,
value: "%d items",
comment: "Number of items in the playlsit folder. Example: '10 items'")
}

public struct PlaylistFolders {
Expand Down

0 comments on commit eb78399

Please sign in to comment.