Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS & tvOS] Localize Existing Strings #1361

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Shared/Extensions/JellyfinAPI/DeviceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ enum DeviceType: String, Displayable, Codable, CaseIterable {
case .xbox:
return "Xbox"
case .other:
return "Other"
return L10n.other
}
}

Expand Down
10 changes: 5 additions & 5 deletions Shared/Extensions/JellyfinAPI/MediaStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension MediaStream {
var properties: [TextPair] = []

if let value = type {
properties.append(.init(title: "Type", subtitle: value.rawValue))
properties.append(.init(title: L10n.type, subtitle: value.rawValue))
}

if let value = codec {
Expand All @@ -63,7 +63,7 @@ extension MediaStream {
}

if let value = language {
properties.append(.init(title: "Language", subtitle: value))
properties.append(.init(title: L10n.language, subtitle: value))
}

if let value = timeBase {
Expand Down Expand Up @@ -107,15 +107,15 @@ extension MediaStream {
}

if let value = channels {
properties.append(.init(title: "Channels", subtitle: value.description))
properties.append(.init(title: L10n.channels, subtitle: value.description))
}

if let value = sampleRate {
properties.append(.init(title: "Sample Rate", subtitle: value.description))
}

if let value = isDefault {
properties.append(.init(title: "Default", subtitle: value.description))
properties.append(.init(title: L10n.default, subtitle: value.description))
}

if let value = isForced {
Expand Down Expand Up @@ -195,7 +195,7 @@ extension MediaStream {
}

if let value = deliveryURL {
properties.append(.init(title: "URL", subtitle: value))
properties.append(.init(title: L10n.url, subtitle: value))
}

if let value = deliveryURL {
Expand Down
2 changes: 1 addition & 1 deletion Shared/Objects/CustomDeviceProfileAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum CustomDeviceProfileAction: String, CaseIterable, Displayable, Storable {
var displayTitle: String {
switch self {
case .add:
return "Add"
return L10n.add
case .replace:
return "Replace"
}
Expand Down
16 changes: 8 additions & 8 deletions Shared/Objects/GestureAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum MultiTapAction: String, GestureAction {
case .none:
return L10n.none
case .jump:
return "Jump"
return L10n.jump
}
}
}
Expand All @@ -58,11 +58,11 @@ enum DoubleTouchAction: String, GestureAction {
case .none:
return L10n.none
case .aspectFill:
return "Aspect Fill"
return L10n.aspectFill
case .gestureLock:
return "Gesture Lock"
case .pausePlay:
return "Pause/Play"
return L10n.playAndPause
}
}
}
Expand All @@ -83,17 +83,17 @@ enum PanAction: String, GestureAction {
case .none:
return L10n.none
case .audioffset:
return "Audio Offset"
return L10n.audioOffset
case .brightness:
return "Brightness"
case .playbackSpeed:
return "Playback Speed"
return L10n.playbackSpeed
case .scrub:
return "Scrub"
case .slowScrub:
return "Slow Scrub"
case .subtitleOffset:
return "Subtitle Offset"
return L10n.subtitleOffset
case .volume:
return "Volume"
}
Expand All @@ -110,7 +110,7 @@ enum PinchAction: String, GestureAction {
case .none:
return L10n.none
case .aspectFill:
return "Aspect Fill"
return L10n.aspectFill
}
}
}
Expand All @@ -125,7 +125,7 @@ enum SwipeAction: String, GestureAction {
case .none:
return L10n.none
case .jump:
return "Jump"
return L10n.jump
}
}
}
4 changes: 2 additions & 2 deletions Shared/Objects/ItemFilter/ItemFilterType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension ItemFilterType: Displayable {
case .genres:
L10n.genres
case .letter:
"Letter"
L10n.letter
case .sortBy:
L10n.sort
case .sortOrder:
Expand All @@ -65,7 +65,7 @@ extension ItemFilterType: Displayable {
case .traits:
L10n.filters
case .years:
"Years"
L10n.years
}
}
}
8 changes: 4 additions & 4 deletions Shared/Objects/ItemFilter/ItemSortBy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ enum ItemSortBy: String, CaseIterable, Displayable, Codable {
var displayTitle: String {
switch self {
case .premiereDate:
return "Premiere date"
return L10n.premiereDate
case .name:
return "Name"
return L10n.name
case .dateAdded:
return "Date added"
return L10n.dateAdded
case .random:
return "Random"
return L10n.random
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Shared/Objects/OverlayType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum PlaybackButtonType: String, CaseIterable, Displayable, Defaults.Serializabl
case .large:
return "Large"
case .compact:
return "Compact"
return L10n.compact
}
}
}
4 changes: 2 additions & 2 deletions Shared/Objects/StreamType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ enum StreamType: String, Displayable {
var displayTitle: String {
switch self {
case .direct:
return "Direct"
return L10n.direct
case .transcode:
return "Transcode"
return L10n.transcode
case .hls:
return "HLS"
}
Expand Down
2 changes: 1 addition & 1 deletion Shared/Objects/TimeStampType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum TimestampType: String, CaseIterable, Defaults.Serializable, Displayable {
case .split:
return "Split"
case .compact:
return "Compact"
return L10n.compact
}
}
}
4 changes: 2 additions & 2 deletions Shared/Objects/UserAccessPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ enum UserAccessPolicy: String, CaseIterable, Codable, Displayable {
var displayTitle: String {
switch self {
case .none:
"None"
L10n.none
case .requireDeviceAuthentication:
"Device Authentication"
case .requirePin:
"Pin"
L10n.pin
}
}
}
18 changes: 9 additions & 9 deletions Shared/Objects/VideoPlayerActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ enum VideoPlayerActionButton: String, CaseIterable, Defaults.Serializable, Displ
var displayTitle: String {
switch self {
// case .advanced:
// return "Advanced"
// return L10n.advanced
case .aspectFill:
return "Aspect Fill"
return L10n.aspectFill
case .audio:
return "Audio"
return L10n.audio
case .autoPlay:
return "Auto Play"
return L10n.autoPlay
case .chapters:
return "Chapters"
return L10n.chapters
case .playbackSpeed:
return "Playback Speed"
return L10n.playbackSpeed
case .playNextItem:
return "Play Next Item"
return L10n.playNextItem
case .playPreviousItem:
return "Play Previous Item"
return L10n.playPreviousItem
case .subtitles:
return "Subtitles"
return L10n.subtitles
}
}

Expand Down
4 changes: 2 additions & 2 deletions Swiftfin tvOS/Components/OrderedSectionSelectorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ struct OrderedSectionSelectorView<Element: Displayable & Hashable>: View {
Text(L10n.enabled)
Spacer()
if editMode?.wrappedValue.isEditing ?? false {
Button("Done") {
Button(L10n.done) {
withAnimation {
editMode?.wrappedValue = .inactive
}
}
} else {
Button("Edit") {
Button(L10n.edit) {
withAnimation {
editMode?.wrappedValue = .active
}
Expand Down
8 changes: 4 additions & 4 deletions Swiftfin tvOS/Views/BasicAppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct AppSettingsView: View {
// )
// }
//
// ChevronButton("Logs")
// ChevronButton(L10n.logs)
// .onSelect {
// router.route(to: \.log)
// }
Expand All @@ -68,7 +68,7 @@ struct AppSettingsView: View {
// Button {
// removeAllServersSelected = true
// } label: {
// Text("Remove All Servers")
// Text(L10n.removeAllServers)
// }
// }
// }
Expand All @@ -79,9 +79,9 @@ struct AppSettingsView: View {
//// viewModel.resetUserSettings()
// }
// } message: {
// Text("Reset all settings back to defaults.")
// Text(L10n.resetAllSettings)
// }
// .alert("Remove All Servers", isPresented: $removeAllServersSelected) {
// .alert(L10n.removeAllServers, isPresented: $removeAllServersSelected) {
// Button(L10n.reset, role: .destructive) {
//// viewModel.removeAllServers()
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extension ItemView {

var body: some View {
PosterHStack(
title: "Special Features",
title: L10n.specialFeatures,
type: .landscape,
items: items
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ extension SelectUserView {
.buttonBorderShape(.circleBackport)
.disabled(!isEnabled)

Text("Add User")
Text(L10n.addUser)
.font(.title3)
.fontWeight(.semibold)
.foregroundStyle(isEnabled ? .primary : .secondary)

if serverSelection == .all {
Text("Hidden")
Text(L10n.hidden)
.font(.footnote)
.hidden()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extension SelectUserView {
Group {
switch serverSelection {
case .all:
Label("All Servers", systemImage: "person.2.fill")
Label(L10n.allServers, systemImage: "person.2.fill")
case let .server(id):
if let server = viewModel.servers.keys.first(where: { $0.id == id }) {
Label(server.name, systemImage: "server.rack")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension SelectUserView {
.buttonStyle(.card)
.buttonBorderShape(.circleBackport)
// .contextMenu {
// Button("Delete", role: .destructive) {
// Button(L10n.delete, role: .destructive) {
// onDelete()
// }
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extension CustomDeviceProfileSettingsView {

profileDetailsView(
title: L10n.useAsTranscodingProfile,
detail: profile.useAsTranscodingProfile ? "Yes" : "No"
detail: profile.useAsTranscodingProfile ? L10n.yes : L10n.no
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ extension CustomDeviceProfileSettingsView {
HStack {
Text(L10n.customProfile)
Spacer()
Button("Save") {
Button(L10n.save) {
if createProfile {
customDeviceProfiles.append(profile.value)
}
Expand Down Expand Up @@ -135,7 +135,7 @@ extension CustomDeviceProfileSettingsView {
}
.navigationTitle(L10n.customProfile)
.alert("Profile not saved", isPresented: $isPresentingNotSaved) {
Button("Close", role: .destructive) {
Button(L10n.close, role: .destructive) {
router.dismissCoordinator()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct CustomDeviceProfileSettingsView: View {
Button(role: .destructive) {
deleteProfile(profile)
} label: {
Label("Delete", systemImage: "trash")
Label(L10n.delete, systemImage: "trash")
}
}
}
Expand All @@ -93,7 +93,7 @@ struct CustomDeviceProfileSettingsView: View {
Text(L10n.profiles)
Spacer()
if customProfiles.isNotEmpty {
Button("Add") {
Button(L10n.add) {
router.route(to: \.createCustomDeviceProfile)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct ListColumnsPickerView: View {

var body: some View {
StepperView(
title: "Columns",
title: L10n.columns,
value: $selection,
range: 1 ... 3,
step: 1
Expand Down
4 changes: 2 additions & 2 deletions Swiftfin tvOS/Views/VideoPlayer/Components/LoadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ extension VideoPlayer {

VStack(spacing: 10) {

Text("Retrieving media information")
Text(L10n.retrievingMediaInformation)
.foregroundColor(.white)

ProgressView()

Button {
router.dismissCoordinator()
} label: {
Text("Cancel")
Text(L10n.cancel)
.foregroundColor(.red)
.padding()
.overlay {
Expand Down
Loading