Skip to content

Commit

Permalink
Migrate away from using the .localized string extension which could c…
Browse files Browse the repository at this point in the history
…ause issues with genstrings
  • Loading branch information
72A12F4E committed Jun 29, 2024
1 parent 55941b5 commit df05fdb
Show file tree
Hide file tree
Showing 54 changed files with 637 additions and 567 deletions.
399 changes: 219 additions & 180 deletions Localizable.xcstrings

Large diffs are not rendered by default.

61 changes: 41 additions & 20 deletions Meshtastic/Enums/AppSettingsEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ enum MeshMapTypes: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .standard:
return "standard".localized
return NSLocalizedString("standard", comment: "No comment provided")
case .mutedStandard:
return "standard.muted".localized
return NSLocalizedString("standard.muted", comment: "No comment provided")
case .hybrid:
return "hybrid".localized
return NSLocalizedString("hybrid", comment: "No comment provided")
case .hybridFlyover:
return "hybrid.flyover".localized
return NSLocalizedString("hybrid.flyover", comment: "No comment provided")
case .satellite:
return "satellite".localized
return NSLocalizedString("satellite", comment: "No comment provided")
case .satelliteFlyover:
return "satellite.flyover".localized
return NSLocalizedString("satellite.flyover", comment: "No comment provided")
}
}
func MKMapTypeValue() -> MKMapType {
Expand Down Expand Up @@ -63,7 +63,10 @@ enum MeshMapDistances: Double, CaseIterable, Identifiable {
var id: Double { self.rawValue }
var description: String {
let distanceFormatter = MKDistanceFormatter()
return String.localizedStringWithFormat("nodelist.filter.distance %@".localized, distanceFormatter.string(fromDistance: Double(self.rawValue)))
return String.localizedStringWithFormat(
NSLocalizedString("nodelist.filter.distance %@", comment: "No comment provided"),
distanceFormatter.string(fromDistance: Double(self.rawValue))
)
}
}

Expand All @@ -75,11 +78,11 @@ enum UserTrackingModes: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .none:
return "map.usertrackingmode.none".localized
return NSLocalizedString("map.usertrackingmode.none", comment: "No comment provided")
case .follow:
return "map.usertrackingmode.follow".localized
return NSLocalizedString("map.usertrackingmode.follow", comment: "No comment provided")
case .followWithHeading:
return "map.usertrackingmode.followwithheading".localized
return NSLocalizedString("map.usertrackingmode.followwithheading", comment: "No comment provided")
}
}
var icon: String {
Expand Down Expand Up @@ -114,21 +117,21 @@ enum LocationUpdateInterval: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .tenSeconds:
return "interval.ten.seconds".localized
return NSLocalizedString("interval.ten.seconds", comment: "No comment provided")
case .fifteenSeconds:
return "interval.fifteen.seconds".localized
return NSLocalizedString("interval.fifteen.seconds", comment: "No comment provided")
case .thirtySeconds:
return "interval.thirty.seconds".localized
return NSLocalizedString("interval.thirty.seconds", comment: "No comment provided")
case .fortyFiveSeconds:
return "interval.fortyfive.seconds".localized
return NSLocalizedString("interval.fortyfive.seconds", comment: "No comment provided")
case .oneMinute:
return "interval.one.minute".localized
return NSLocalizedString("interval.one.minute", comment: "No comment provided")
case .fiveMinutes:
return "interval.five.minutes".localized
return NSLocalizedString("interval.five.minutes", comment: "No comment provided")
case .tenMinutes:
return "interval.ten.minutes".localized
return NSLocalizedString("interval.ten.minutes", comment: "No comment provided")
case .fifteenMinutes:
return "interval.fifteen.minutes".localized
return NSLocalizedString("interval.fifteen.minutes", comment: "No comment provided")
}
}
}
Expand All @@ -138,7 +141,18 @@ enum MapLayer: String, CaseIterable, Equatable, Decodable {
case hybrid
case satellite
case offline
var localized: String { self.rawValue.localized }
var localized: String {
switch self {
case .standard:
NSLocalizedString("standard", comment: "")
case .hybrid:
NSLocalizedString("hybrid", comment: "")
case .satellite:
NSLocalizedString("satellite", comment: "")
case .offline:
NSLocalizedString("offline", comment: "")
}
}
}

enum MapTileServer: String, CaseIterable, Identifiable, Decodable {
Expand Down Expand Up @@ -273,7 +287,14 @@ enum MapTileServer: String, CaseIterable, Identifiable, Decodable {
enum OverlayType: String, CaseIterable, Equatable {
case tileServer
case geoJson
var localized: String { self.rawValue.localized }
var localized: String {
switch self {
case .tileServer:
NSLocalizedString("tileServer", comment: "The Tile Server overlay type for the map overlay server")
case .geoJson:
NSLocalizedString("geoJson", comment: "The GeoJSON overlay type for the map overlay server")
}
}
}

enum MapOverlayServer: String, CaseIterable, Identifiable, Decodable {
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic/Enums/BluetoothModes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ enum BluetoothModes: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .randomPin:
return "bluetooth.mode.randompin".localized
return NSLocalizedString("bluetooth.mode.randompin", comment: "No comment provided")
case .fixedPin:
return "bluetooth.mode.fixedpin".localized
return NSLocalizedString("bluetooth.mode.fixedpin", comment: "No comment provided")
case .noPin:
return "bluetooth.mode.nopin".localized
return NSLocalizedString("bluetooth.mode.nopin", comment: "No comment provided")
}
}
func protoEnumValue() -> Config.BluetoothConfig.PairingMode {
Expand Down
22 changes: 11 additions & 11 deletions Meshtastic/Enums/CannedMessagesConfigEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ enum ConfigPresets: Int, CaseIterable, Identifiable {
switch self {

case .unset:
return "canned.messages.preset.manual".localized
return NSLocalizedString("canned.messages.preset.manual", comment: "No comment provided")
case .rakRotaryEncoder:
return "canned.messages.preset.rakrotary".localized
return NSLocalizedString("canned.messages.preset.rakrotary", comment: "No comment provided")
case .cardKB:
return "canned.messages.preset.cardkb".localized
return NSLocalizedString("canned.messages.preset.cardkb", comment: "No comment provided")
}
}
}
Expand All @@ -45,21 +45,21 @@ enum InputEventChars: Int, CaseIterable, Identifiable {
switch self {

case .none:
return "inputevent.none".localized
return NSLocalizedString("inputevent.none", comment: "No comment provided")
case .up:
return "inputevent.up".localized
return NSLocalizedString("inputevent.up", comment: "No comment provided")
case .down:
return "inputevent.down".localized
return NSLocalizedString("inputevent.down", comment: "No comment provided")
case .left:
return "inputevent.left".localized
return NSLocalizedString("inputevent.left", comment: "No comment provided")
case .right:
return "inputevent.right".localized
return NSLocalizedString("inputevent.right", comment: "No comment provided")
case .select:
return "inputevent.select".localized
return NSLocalizedString("inputevent.select", comment: "No comment provided")
case .back:
return "inputevent.back".localized
return NSLocalizedString("inputevent.back", comment: "No comment provided")
case .cancel:
return "inputevent.cancel".localized
return NSLocalizedString("inputevent.cancel", comment: "No comment provided")
}
}
func protoEnumValue() -> ModuleConfig.CannedMessageConfig.InputEventChar {
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic/Enums/ChannelRoles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ enum ChannelRoles: Int, CaseIterable, Identifiable {
switch self {

case .disabled:
return "channel.role.disabled".localized
return NSLocalizedString("channel.role.disabled", comment: "No comment provided")
case .primary:
return "channel.role.primary".localized
return NSLocalizedString("channel.role.primary", comment: "No comment provided")
case .secondary:
return "channel.role.secondary".localized
return NSLocalizedString("channel.role.secondary", comment: "No comment provided")
}
}
func protoEnumValue() -> Channel.Role {
Expand Down
22 changes: 11 additions & 11 deletions Meshtastic/Enums/DeviceEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ enum DeviceRoles: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .client:
return "device.role.client".localized
return NSLocalizedString("device.role.client", comment: "No comment provided")
case .clientMute:
return "device.role.clientmute".localized
return NSLocalizedString("device.role.clientmute", comment: "No comment provided")
case .router:
return "device.role.router".localized
return NSLocalizedString("device.role.router", comment: "No comment provided")
case .routerClient:
return "device.role.routerclient".localized
return NSLocalizedString("device.role.routerclient", comment: "No comment provided")
case .repeater:
return "device.role.repeater".localized
return NSLocalizedString("device.role.repeater", comment: "No comment provided")
case .tracker:
return "device.role.tracker".localized
return NSLocalizedString("device.role.tracker", comment: "No comment provided")
case .sensor:
return "device.role.sensor".localized
return NSLocalizedString("device.role.sensor", comment: "No comment provided")
case .tak:
return "device.role.tak".localized
return NSLocalizedString("device.role.tak", comment: "No comment provided")
case .takTracker:
return "device.role.taktracker".localized
return NSLocalizedString("device.role.taktracker", comment: "No comment provided")
case .clientHidden:
return "device.role.clienthidden".localized
return NSLocalizedString("device.role.clienthidden", comment: "No comment provided")
case .lostAndFound:
return "device.role.lostandfound".localized
return NSLocalizedString("device.role.lostandfound", comment: "No comment provided")
}
}

Expand Down
34 changes: 17 additions & 17 deletions Meshtastic/Enums/DisplayEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ enum ScreenOnIntervals: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .fifteenSeconds:
return "interval.fifteen.seconds".localized
return NSLocalizedString("interval.fifteen.seconds", comment: "No comment provided")
case .thirtySeconds:
return "interval.thirty.seconds".localized
return NSLocalizedString("interval.thirty.seconds", comment: "No comment provided")
case .oneMinute:
return "interval.one.minute".localized
return NSLocalizedString("interval.one.minute", comment: "No comment provided")
case .fiveMinutes:
return "interval.five.minutes".localized
return NSLocalizedString("interval.five.minutes", comment: "No comment provided")
case .tenMinutes:
return "interval.ten.minutes".localized
return NSLocalizedString("interval.ten.minutes", comment: "No comment provided")
case .fifteenMinutes:
return "interval.fifteen.minutes".localized
return NSLocalizedString("interval.fifteen.minutes", comment: "No comment provided")
case .thirtyMinutes:
return "interval.thirty.minutes".localized
return NSLocalizedString("interval.thirty.minutes", comment: "No comment provided")
case .oneHour:
return "interval.one.hour".localized
return NSLocalizedString("interval.one.hour", comment: "No comment provided")
case .max:
return "always.on".localized
return NSLocalizedString("always.on", comment: "No comment provided")
}
}
}
Expand All @@ -85,19 +85,19 @@ enum ScreenCarouselIntervals: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .off:
return "off".localized
return NSLocalizedString("off", comment: "No comment provided")
case .fifteenSeconds:
return "interval.fifteen.seconds".localized
return NSLocalizedString("interval.fifteen.seconds", comment: "No comment provided")
case .thirtySeconds:
return "interval.thirty.seconds".localized
return NSLocalizedString("interval.thirty.seconds", comment: "No comment provided")
case .oneMinute:
return "interval.one.minute".localized
return NSLocalizedString("interval.one.minute", comment: "No comment provided")
case .fiveMinutes:
return "interval.five.minutes".localized
return NSLocalizedString("interval.five.minutes", comment: "No comment provided")
case .tenMinutes:
return "interval.ten.minutes".localized
return NSLocalizedString("interval.ten.minutes", comment: "No comment provided")
case .fifteenMinutes:
return "interval.fifteen.minutes".localized
return NSLocalizedString("interval.fifteen.minutes", comment: "No comment provided")
}
}
}
Expand All @@ -113,7 +113,7 @@ enum OledTypes: Int, CaseIterable, Identifiable {
var description: String {
switch self {
case .auto:
return "automatic.detection".localized
return NSLocalizedString("automatic.detection", comment: "No comment provided")
case .ssd1306:
return "SSD 1306"
case .sh1106:
Expand Down
Loading

0 comments on commit df05fdb

Please sign in to comment.