Skip to content

Commit 4643bd6

Browse files
committed
Watch and .plist localization
Added german Localization for the watch extension and the plist files.
1 parent 4ba0768 commit 4643bd6

File tree

17 files changed

+284
-49
lines changed

17 files changed

+284
-49
lines changed

OpenGpxTracker-Watch Extension/GPXFileTableInterfaceController.swift

+13-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import WatchKit
1010
import WatchConnectivity
1111

1212
/// Text displayed when there are no GPX files in the folder.
13-
let kNoFiles = "No gpx files"
13+
let kNoFiles = NSLocalizedString("NO_FILES", comment: "no comment")
1414

1515
///
1616
/// WKInterfaceTable that displays the list of files that have been saved in previous sessions.
@@ -107,14 +107,14 @@ class GPXFileTableInterfaceController: WKInterfaceController {
107107
func updateProgressIndicators(status: sendingStatus, fileName: String?) {
108108
switch status {
109109
case .sending:
110-
progressTitle.setText("Sending:")
110+
progressTitle.setText(NSLocalizedString("SENDING", comment: "no comment"))
111111
guard let fileName = fileName else { return }
112112

113113
/// count of pending files, does not seem to include the current one
114114
let fileTransfersCount = session?.outstandingFileTransfers.count ?? 0
115115
// if there are files pending for sending, filename will not be displayed with the name of file.
116116
if fileTransfersCount >= 1 {
117-
progressFileName.setText("\(fileTransfersCount + 1) files")
117+
progressFileName.setText(String(format: NSLocalizedString("X_FILES", comment: "no comment"), fileTransfersCount + 1))
118118
}
119119
else {
120120
progressFileName.setText(fileName)
@@ -123,13 +123,13 @@ class GPXFileTableInterfaceController: WKInterfaceController {
123123
case .success:
124124
progressImageView.stopAnimating()
125125
progressImageView.setImage(UIImage(named: "Progress-success"))
126-
progressTitle.setText("Sucessfully sent:")
126+
progressTitle.setText(NSLocalizedString("SUCCESSFULLY_SENT", comment: "no comment"))
127127
hideProgressIndicatorsWithAnimation()
128128

129129
case .failure:
130130
progressImageView.stopAnimating()
131131
progressImageView.setImage(UIImage(named: "Progress-failure"))
132-
progressTitle.setText("Failed to send:")
132+
progressTitle.setText(NSLocalizedString("FAILED_TO_SEND", comment: "no comment"))
133133
hideProgressIndicatorsWithAnimation()
134134
}
135135
}
@@ -139,7 +139,7 @@ class GPXFileTableInterfaceController: WKInterfaceController {
139139
super.willActivate()
140140
print("GPXFileTableInterfaceController:: willActivate willSendFile: \(willSendFile)")
141141

142-
self.setTitle("Your files")
142+
self.setTitle(NSLocalizedString("YOUR_FILES", comment: "no comment"))
143143
session?.delegate = self
144144

145145
if willSendFile == true {
@@ -199,25 +199,25 @@ class GPXFileTableInterfaceController: WKInterfaceController {
199199
if gpxFilesFound {
200200

201201
/// Option lets user send selected file to iOS app
202-
let shareOption = WKAlertAction(title: "Send to iOS app", style: .default) {
202+
let shareOption = WKAlertAction(title: NSLocalizedString("SEND_TO_IOS", comment: "no comment"), style: .default) {
203203
self.actionTransferFileAtIndex(rowIndex)
204204
}
205205

206206
/// Option for users to cancel
207-
let cancelOption = WKAlertAction(title: "Cancel", style: .cancel) {
207+
let cancelOption = WKAlertAction(title: NSLocalizedString("CANCEL", comment: "no comment"), style: .cancel) {
208208
self.actionSheetCancel()
209209
}
210210

211211
/// Option to delete selected file
212-
let deleteOption = WKAlertAction(title: "Delete", style: .destructive) {
212+
let deleteOption = WKAlertAction(title: NSLocalizedString("DELETE", comment: "no comment"), style: .destructive) {
213213
self.actionDeleteFileAtIndex(rowIndex)
214214
self.loadTableData()
215215
}
216216

217217
/// Array of all available options
218218
let options = [shareOption, cancelOption, deleteOption]
219219

220-
presentAlert(withTitle: "GPX file selected", message: "What would you like to do?", preferredStyle: .actionSheet, actions: options)
220+
presentAlert(withTitle: NSLocalizedString("FILE_SELECTED_TITLE", comment: "no comment"), message: NSLocalizedString("FILE_SELECTED_MESSAGE", comment: "no comment"), preferredStyle: .actionSheet, actions: options)
221221
}
222222
}
223223

@@ -295,7 +295,7 @@ extension GPXFileTableInterfaceController: WCSessionDelegate {
295295
}
296296

297297
func session(_ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer, error: Error?) {
298-
let doneAction = WKAlertAction(title: "Done", style: .default) { }
298+
let doneAction = WKAlertAction(title: NSLocalizedString("DONE", comment: "no comment"), style: .default) { }
299299
guard let error = error else {
300300
print("WCSession: didFinish fileTransfer: \(fileTransfer.file.fileURL.absoluteString)")
301301
// presenting success indicator to user if file is successfully transferred
@@ -310,8 +310,9 @@ extension GPXFileTableInterfaceController: WCSessionDelegate {
310310
self.updateProgressIndicators(status: .failure, fileName: nil)
311311

312312
// presents alert after 1.5s, with error message
313+
// MARK: "as CVarArg" was suggested by XCode and my intruduce a bug...
313314
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
314-
self.presentAlert(withTitle: "Error Occurred", message: "GPX file was unsuccessfully sent to iOS app, due to \(error) ", preferredStyle: .alert, actions: [doneAction])
315+
self.presentAlert(withTitle: NSLocalizedString("ERROR_OCCURED_TITLE", comment: "no comment"), message: String(format: NSLocalizedString("ERROR_OCCURED_MESSAGE", comment: "no comment"), error as CVarArg), preferredStyle: .alert, actions: [doneAction])
315316
}
316317
}
317318

OpenGpxTracker-Watch Extension/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>XPC!</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.6.1</string>
20+
<string>1.6.2</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>CLKComplicationPrincipalClass</key>

OpenGpxTracker-Watch Extension/InterfaceController.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let kWhiteBackgroundColor: UIColor = UIColor(red: 254.0/255.0, green: 254.0/255.
2424
let kDeleteWaypointAccesoryButtonTag = 666
2525
let kEditWaypointAccesoryButtonTag = 333
2626

27-
let kNotGettingLocationText = "Not getting location"
27+
let kNotGettingLocationText = NSLocalizedString("NO_LOCATION", comment: "no comment")
2828
let kUnknownAccuracyText = "±···"
2929
let kUnknownSpeedText = "·.··"
3030
let kUnknownAltitudeText = "···"
@@ -130,7 +130,7 @@ class InterfaceController: WKInterfaceController {
130130
case .notStarted:
131131
print("switched to non started")
132132
// set Tracker button to allow Start
133-
trackerButton.setTitle("Start Tracking")
133+
trackerButton.setTitle(NSLocalizedString("START_TRACKING", comment: "no comment"))
134134
trackerButton.setBackgroundColor(kGreenButtonBackgroundColor)
135135
//save & reset button to transparent.
136136
saveButton.setBackgroundColor(kDisabledBlueButtonBackgroundColor)
@@ -159,7 +159,7 @@ class InterfaceController: WKInterfaceController {
159159
case .tracking:
160160
print("switched to tracking mode")
161161
// set trackerButton to allow Pause
162-
trackerButton.setTitle("Pause")
162+
trackerButton.setTitle(NSLocalizedString("PAUSE", comment: "no comment"))
163163
trackerButton.setBackgroundColor(kPurpleButtonBackgroundColor)
164164
//activate save & reset buttons
165165
saveButton.setBackgroundColor(kBlueButtonBackgroundColor)
@@ -170,7 +170,7 @@ class InterfaceController: WKInterfaceController {
170170
case .paused:
171171
print("switched to paused mode")
172172
// set trackerButton to allow Resume
173-
self.trackerButton.setTitle("Resume")
173+
self.trackerButton.setTitle(NSLocalizedString("RESUME", comment: "no comment"))
174174
self.trackerButton.setBackgroundColor(kGreenButtonBackgroundColor)
175175
// activate save & reset (just in case switched from .NotStarted)
176176
saveButton.setBackgroundColor(kBlueButtonBackgroundColor)
@@ -213,7 +213,7 @@ class InterfaceController: WKInterfaceController {
213213
// This method is called when watch view controller is about to be visible to user
214214
print("InterfaceController:: willActivate")
215215
super.willActivate()
216-
self.setTitle("GPX Tracker")
216+
self.setTitle(NSLocalizedString("GPX_TRACKER", comment: "no comment"))
217217

218218
stopWatch.delegate = self
219219

@@ -291,7 +291,7 @@ class InterfaceController: WKInterfaceController {
291291
/// Just a 'done' button, without
292292
let action = WKAlertAction(title: "Done", style: .default) {}
293293

294-
presentAlert(withTitle: "GPX file saved", message: "Current session saved as \(filename).gpx ", preferredStyle: .alert, actions: [action])
294+
presentAlert(withTitle: NSLocalizedString("FILE_SAVED_TITLE", comment: "no comment"), message: String(format: NSLocalizedString("NO_LOCATION", comment: "no comment"), filename), preferredStyle: .alert, actions: [action])
295295

296296
}
297297

@@ -345,7 +345,7 @@ class InterfaceController: WKInterfaceController {
345345
print("LocationServicesDisabledAlert: cancel pressed")
346346
}
347347

348-
presentAlert(withTitle: "Location services disabled", message: "Go to settings and enable location", preferredStyle: .alert, actions: [button])
348+
presentAlert(withTitle: NSLocalizedString("LOCATION_SERVICES_DISABLED", comment: "no comment"), message: NSLocalizedString("ENABLE_LOCATION_SERVICES", comment: "no comment"), preferredStyle: .alert, actions: [button])
349349
}
350350

351351

@@ -361,7 +361,7 @@ class InterfaceController: WKInterfaceController {
361361
print("LocationServicesDeniedAlert: cancel pressed")
362362
}
363363

364-
presentAlert(withTitle: "Access to location denied", message: "On Location settings, allow always access to location for GPX Tracker", preferredStyle: .alert, actions: [button])
364+
presentAlert(withTitle: NSLocalizedString("ACCESS_TO_LOCATION_DENIED", comment: "no comment"), message: NSLocalizedString("ALLOW_LOCATION", comment: "no comment"), preferredStyle: .alert, actions: [button])
365365
}
366366

367367
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
InfoPlist.strings
3+
OpenGpxTracker
4+
5+
Created by Kurt Höblinger on 21.08.19.
6+
Copyright © 2019 TransitBox. All rights reserved.
7+
*/
8+
9+
NSLocationAlwaysAndWhenInUseUsageDescription = "Der Standort wird nur verwendet um Deinen Standort auf der Karte darzustellen. Wähle \"immer\" um den Standort auch zur Verfügung zu stellen, wenn die App im Hintergrund arbeitet.";
10+
NSLocationAlwaysUsageDescription = "Dein Standort wird benötigt um den GPX Track auch dann zu erstellen, wenn die App im Hintergrund läuft.";
11+
NSLocationUsageDescription = "Der Standort wird zum Erstellen von GPX und zum Hinzufügen von PDIs benötigt";
12+
NSLocationWhenInUseUsageDescription = "Der Standort wird verwendet um auf der Karte zu zeigen wo Du bist und wo Du warst.";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
InfoPlist.strings
3+
OpenGpxTracker
4+
5+
Created by Kurt Höblinger on 21.08.19.
6+
Copyright © 2019 TransitBox. All rights reserved.
7+
*/
8+
9+
NSLocationAlwaysAndWhenInUseUsageDescription = "Location is only used to display your position in the map. Select always allow to track your position even if the app is in background.";
10+
NSLocationAlwaysUsageDescription = "Location is needed to create the GPX track even when the app is in background.";
11+
NSLocationUsageDescription = "Location is needed to create GPX and add PDIs";
12+
NSLocationWhenInUseUsageDescription = "Location is used to display in the map where are you and where you have been.";

OpenGpxTracker-Watch/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.6.1</string>
20+
<string>1.6.2</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>UISupportedInterfaceOrientations</key>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
/* Class = "WKInterfaceLabel"; text = "signal"; ObjectID = "036-aK-7ie"; */
3+
"036-aK-7ie.text" = "Signal";
4+
5+
/* Class = "WKInterfaceLabel"; text = "File Name"; ObjectID = "19n-8m-sC5"; */
6+
"19n-8m-sC5.text" = "Dateiname";
7+
8+
/* Class = "WKInterfaceButton"; title = "View files"; ObjectID = "3QZ-4r-aMl"; */
9+
"3QZ-4r-aMl.title" = "Zeige Dateien";
10+
11+
/* Class = "WKInterfaceLabel"; text = "speedValue"; ObjectID = "9yb-Lf-Jav"; */
12+
"9yb-Lf-Jav.text" = "speedValue";
13+
14+
/* Class = "WKInterfaceLabel"; text = "Sending"; ObjectID = "AyV-DL-c4U"; */
15+
"AyV-DL-c4U.text" = "Sende";
16+
17+
/* Class = "WKInterfaceLabel"; text = "SPEED"; ObjectID = "HGe-sg-FuE"; */
18+
"HGe-sg-FuE.text" = "GESCHWINDIGKEIT";
19+
20+
/* Class = "WKInterfaceLabel"; text = "Alert Label"; ObjectID = "IdU-wH-bcW"; */
21+
"IdU-wH-bcW.text" = "Alert Label";
22+
23+
/* Class = "WKInterfaceLabel"; text = "File Name"; ObjectID = "Nkq-Do-muS"; */
24+
"Nkq-Do-muS.text" = "Dateiname";
25+
26+
/* Class = "WKInterfaceButton"; title = "Save"; ObjectID = "Yfa-t6-5Sk"; */
27+
"Yfa-t6-5Sk.title" = "Sichern";
28+
29+
/* Class = "WKInterfaceButton"; title = "Start Tracking"; ObjectID = "exN-t4-It8"; */
30+
"exN-t4-It8.title" = "Tracking starten";
31+
32+
/* Class = "WKInterfaceLabel"; text = "altValue"; ObjectID = "fLq-xh-Kj9"; */
33+
"fLq-xh-Kj9.text" = "altValue";
34+
35+
/* Class = "WKInterfaceButton"; title = "Reset"; ObjectID = "g9l-MU-PFV"; */
36+
"g9l-MU-PFV.title" = "Löschen";
37+
38+
/* Class = "WKInterfaceLabel"; text = "0m"; ObjectID = "jLD-vq-fZz"; */
39+
"jLD-vq-fZz.text" = "0m";
40+
41+
/* Class = "WKInterfaceButton"; title = "📍"; ObjectID = "juk-oB-3vV"; */
42+
"juk-oB-3vV.title" = "📍";
43+
44+
/* Class = "WKInterfaceLabel"; text = "COORDINATES"; ObjectID = "oWE-ge-dGJ"; */
45+
"oWE-ge-dGJ.text" = "KOORDINATEN";
46+
47+
/* Class = "WKInterfaceLabel"; text = "ALTITUDE"; ObjectID = "sOz-Cs-O7T"; */
48+
"sOz-Cs-O7T.text" = "HÖHE";
49+
50+
/* Class = "WKInterfaceLabel"; text = "coordinatesLabel"; ObjectID = "wh4-cP-QA2"; */
51+
"wh4-cP-QA2.text" = "coordinatesLabel";
52+
53+
/* Class = "WKInterfaceLabel"; text = "00:00"; ObjectID = "xum-IR-If6"; */
54+
"xum-IR-If6.text" = "00:00";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
/* Class = "WKInterfaceLabel"; text = "signal"; ObjectID = "036-aK-7ie"; */
3+
"036-aK-7ie.text" = "signal";
4+
5+
/* Class = "WKInterfaceLabel"; text = "File Name"; ObjectID = "19n-8m-sC5"; */
6+
"19n-8m-sC5.text" = "File Name";
7+
8+
/* Class = "WKInterfaceButton"; title = "View files"; ObjectID = "3QZ-4r-aMl"; */
9+
"3QZ-4r-aMl.title" = "View files";
10+
11+
/* Class = "WKInterfaceLabel"; text = "speedValue"; ObjectID = "9yb-Lf-Jav"; */
12+
"9yb-Lf-Jav.text" = "speedValue";
13+
14+
/* Class = "WKInterfaceLabel"; text = "Sending"; ObjectID = "AyV-DL-c4U"; */
15+
"AyV-DL-c4U.text" = "Sending";
16+
17+
/* Class = "WKInterfaceLabel"; text = "SPEED"; ObjectID = "HGe-sg-FuE"; */
18+
"HGe-sg-FuE.text" = "SPEED";
19+
20+
/* Class = "WKInterfaceLabel"; text = "Alert Label"; ObjectID = "IdU-wH-bcW"; */
21+
"IdU-wH-bcW.text" = "Alert Label";
22+
23+
/* Class = "WKInterfaceLabel"; text = "File Name"; ObjectID = "Nkq-Do-muS"; */
24+
"Nkq-Do-muS.text" = "File Name";
25+
26+
/* Class = "WKInterfaceButton"; title = "Save"; ObjectID = "Yfa-t6-5Sk"; */
27+
"Yfa-t6-5Sk.title" = "Save";
28+
29+
/* Class = "WKInterfaceButton"; title = "Start Tracking"; ObjectID = "exN-t4-It8"; */
30+
"exN-t4-It8.title" = "Start Tracking";
31+
32+
/* Class = "WKInterfaceLabel"; text = "altValue"; ObjectID = "fLq-xh-Kj9"; */
33+
"fLq-xh-Kj9.text" = "altValue";
34+
35+
/* Class = "WKInterfaceButton"; title = "Reset"; ObjectID = "g9l-MU-PFV"; */
36+
"g9l-MU-PFV.title" = "Reset";
37+
38+
/* Class = "WKInterfaceLabel"; text = "0m"; ObjectID = "jLD-vq-fZz"; */
39+
"jLD-vq-fZz.text" = "0m";
40+
41+
/* Class = "WKInterfaceButton"; title = "📍"; ObjectID = "juk-oB-3vV"; */
42+
"juk-oB-3vV.title" = "📍";
43+
44+
/* Class = "WKInterfaceLabel"; text = "COORDINATES"; ObjectID = "oWE-ge-dGJ"; */
45+
"oWE-ge-dGJ.text" = "COORDINATES";
46+
47+
/* Class = "WKInterfaceLabel"; text = "ALTITUDE"; ObjectID = "sOz-Cs-O7T"; */
48+
"sOz-Cs-O7T.text" = "ALTITUDE";
49+
50+
/* Class = "WKInterfaceLabel"; text = "coordinatesLabel"; ObjectID = "wh4-cP-QA2"; */
51+
"wh4-cP-QA2.text" = "coordinatesLabel";
52+
53+
/* Class = "WKInterfaceLabel"; text = "00:00"; ObjectID = "xum-IR-If6"; */
54+
"xum-IR-If6.text" = "00:00";

0 commit comments

Comments
 (0)