drone-path 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # drone-path
2
2
 
3
+ ## 0.13.0
4
+
5
+ - **New:** Choose English, German, Spanish, French or Japanese in desktop
6
+ Settings. The app follows the operating system language by default and
7
+ remembers a manually selected language between launches.
8
+ - **New:** Export dialogs place actions at the bottom and show progress
9
+ while restarting or exporting telemetry. Canceled open notices can be
10
+ dismissed, and map controls, export settings and menu items use more
11
+ consistent names.
12
+ - **New:** Workspace headings and Map appearance labels are more consistent.
13
+ Video and filmstrip thumbnails show loading text, and zoom limit messages
14
+ appear beside the zoom controls.
15
+
3
16
  ## 0.12.1
4
17
 
5
18
  - **Fixed:** The Export video dialog handles every outcome cleanly: a
package/README.md CHANGED
@@ -65,7 +65,7 @@ The app shows the recording and the synchronized flight map side by side —
65
65
  togglable to a corner map overlay — on one shared timeline;
66
66
  [the manual](docs/user/desktop-app.md) walks through loading a recording,
67
67
  reviewing a flight, marking a passage, exporting, and saving the per-frame
68
- telemetry JSON. The look settings carry over between launches.
68
+ telemetry JSON. The look and language settings carry over between launches.
69
69
 
70
70
  ![Desktop app: a drone recording beside the synchronized flight map](docs/images/app-main-window.jpg)
71
71
 
package/app/ipc.d.mts CHANGED
@@ -12,6 +12,7 @@ export interface IpcState {
12
12
  session: AppSession | null;
13
13
  config: RenderConfig;
14
14
  appState: AppState;
15
+ systemLanguages: readonly string[];
15
16
  win: IpcWindow | null;
16
17
  exportRunner: {
17
18
  start(videoPath: string, request: ExportRequest): void;
package/app/ipc.mjs CHANGED
@@ -10,6 +10,7 @@ import { parsePickRequest, parseTrackSaveRequest } from '../dist/appsession.js';
10
10
  import { applyAppState, writeAppState } from '../dist/appstate.js';
11
11
  import { APP_ORIGIN, appStateFile } from '../dist/apppaths.js';
12
12
  import { parseExportRequest, parseSettingsPatch } from '../dist/config.js';
13
+ import { isLocale, resolveLocale, translator } from '../dist/desktop-i18n/messages.js';
13
14
  import { ERR_NO_RECORDING, errorMessage } from '../dist/errors.js';
14
15
  import { videoBaseName } from '../dist/recordings.js';
15
16
  import { outputPathFor } from '../dist/pipeline.js';
@@ -59,12 +60,13 @@ function knownOutputOf(state, payload) {
59
60
  // existing file is never replaced without a confirmation.
60
61
  async function confirmReplace(state, chosen) {
61
62
  if (!fs.existsSync(chosen)) return true;
63
+ const t = translator(languageSettings(state).locale);
62
64
  const box = {
63
65
  type: 'warning',
64
- buttons: ['Replace', 'Cancel'],
66
+ buttons: [t('native.replace'), t('native.cancel')],
65
67
  defaultId: 1,
66
68
  cancelId: 1,
67
- message: `Replace ${path.basename(chosen)}?`,
69
+ message: t('native.replaceFile', { name: path.basename(chosen) }),
68
70
  detail: chosen,
69
71
  };
70
72
  const confirm = state.win
@@ -126,13 +128,30 @@ function registerSettingsHandlers(state, devUrl, log) {
126
128
  });
127
129
  }
128
130
 
131
+ function languageSettings(state) {
132
+ const preference = isLocale(state.appState.language) ? state.appState.language : null;
133
+ return { preference, locale: resolveLocale(preference, state.systemLanguages) };
134
+ }
135
+
136
+ function registerLanguageHandlers(state, devUrl) {
137
+ handle(devUrl, 'dronepath:language', () => languageSettings(state));
138
+ handle(devUrl, 'dronepath:language:save', (preference) => {
139
+ if (preference !== null && !isLocale(preference)) throw new Error('invalid app language');
140
+ const appState = { ...state.appState, language: preference };
141
+ writeAppState(appStateFile(), appState);
142
+ state.appState = appState;
143
+ return { ok: true, ...languageSettings(state) };
144
+ });
145
+ }
146
+
129
147
  function registerExportHandlers(state, devUrl) {
130
148
  handle(devUrl, 'dronepath:export:pick-output', async () => {
131
149
  const video = requireVideo(state);
150
+ const t = translator(languageSettings(state).locale);
132
151
  return pickSavePath(state, {
133
- title: 'Export video',
152
+ title: t('native.exportVideo'),
134
153
  defaultPath: exportDefaultFor(state, video),
135
- filters: [{ name: 'MP4 video', extensions: ['mp4'] }],
154
+ filters: [{ name: t('native.mp4Video'), extensions: ['mp4'] }],
136
155
  extensions: ['mp4'],
137
156
  defaultExtension: 'mp4',
138
157
  });
@@ -163,15 +182,16 @@ function registerTrackHandlers(state, devUrl, log) {
163
182
  // (<basename>.telemetry.json); the typed name selects the format by its
164
183
  // extension, with the telemetry document as the bare-name default.
165
184
  const exportDefault = exportDefaultFor(state, video);
185
+ const t = translator(languageSettings(state).locale);
166
186
  return pickSavePath(state, {
167
- title: 'Export telemetry',
187
+ title: t('native.exportTelemetry'),
168
188
  defaultPath: path.join(path.dirname(exportDefault), `${videoBaseName(video)}.telemetry.json`),
169
189
  filters: [
170
- { name: 'Telemetry document (JSON)', extensions: ['json'] },
171
- { name: 'GPX track', extensions: ['gpx'] },
172
- { name: 'GeoJSON track', extensions: ['geojson'] },
173
- { name: 'KML track', extensions: ['kml'] },
174
- { name: 'KMZ track', extensions: ['kmz'] },
190
+ { name: t('native.telemetryJson'), extensions: ['json'] },
191
+ { name: t('native.gpx'), extensions: ['gpx'] },
192
+ { name: t('native.geojson'), extensions: ['geojson'] },
193
+ { name: t('native.kml'), extensions: ['kml'] },
194
+ { name: t('native.kmz'), extensions: ['kmz'] },
175
195
  ],
176
196
  extensions: [...TRACK_FORMAT_VALUES],
177
197
  defaultExtension: 'json',
@@ -209,6 +229,7 @@ function registerWindowHandlers(state, devUrl) {
209
229
  export function registerIpcHandlers(state, { devUrl, log, sendToWindow }) {
210
230
  registerSessionHandlers(state, devUrl);
211
231
  registerSettingsHandlers(state, devUrl, log);
232
+ registerLanguageHandlers(state, devUrl);
212
233
  registerExportHandlers(state, devUrl);
213
234
  registerTrackHandlers(state, devUrl, log);
214
235
  registerUpdateHandlers(state, devUrl, sendToWindow);
package/app/main.mjs CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  } from '../dist/appstate.js';
23
23
  import { createAppSession } from '../dist/appsession.js';
24
24
  import { resolveConfig } from '../dist/configfile.js';
25
+ import { DEFAULT_LOCALE, resolveLocale, translator } from '../dist/desktop-i18n/messages.js';
25
26
  import { ERROR_PREFIX, errorMessage } from '../dist/errors.js';
26
27
  import { createExportRunner } from '../dist/exportjob.js';
27
28
  import { requireFfmpegTools } from '../dist/ffmpeg.js';
@@ -63,6 +64,7 @@ function createShellState() {
63
64
  session: null,
64
65
  config: null,
65
66
  appState: emptyAppState(),
67
+ systemLanguages: app.getPreferredSystemLanguages(),
66
68
  tileTraffic: null,
67
69
  // The one tile prefetch entry point every in-process lane drives.
68
70
  tilePrefetch: null,
@@ -80,10 +82,15 @@ function createShellState() {
80
82
  };
81
83
  }
82
84
 
85
+ function translationFor(state) {
86
+ return translator(resolveLocale(state.appState.language, state.systemLanguages));
87
+ }
88
+
83
89
  async function pickRecording(state) {
90
+ const t = translationFor(state);
84
91
  const options = {
85
- title: 'Choose a drone recording',
86
- filters: [{ name: 'DJI recordings', extensions: ['mp4'] }],
92
+ title: t('native.chooseRecording'),
93
+ filters: [{ name: t('native.djiRecordings'), extensions: ['mp4'] }],
87
94
  properties: ['openFile'],
88
95
  // Back where the last recording came from, when that folder still exists.
89
96
  defaultPath: rememberedOpenDir(state) ?? undefined,
@@ -111,10 +118,14 @@ function rememberPicked(state, filePath) {
111
118
  }
112
119
  }
113
120
 
114
- function fail(error) {
121
+ function fail(state, error) {
115
122
  const message = errorMessage(error);
116
123
  process.stderr.write(`${ERROR_PREFIX}${message}\n`);
117
- dialog.showErrorBox('Drone Path', message);
124
+ const locale = resolveLocale(state.appState.language, state.systemLanguages);
125
+ const t = translator(locale);
126
+ dialog.showErrorBox(t('app.title'), locale === DEFAULT_LOCALE
127
+ ? message
128
+ : t('native.startupFailure', { details: message }));
118
129
  app.quit();
119
130
  }
120
131
 
@@ -192,8 +203,8 @@ async function handleRequest(state, request) {
192
203
  // The backing services behind the window: tool check, config, tile cache and
193
204
  // the recording session.
194
205
  async function initServices(state) {
195
- const resolved = resolveConfig({});
196
206
  state.appState = readAppState(appStateFile());
207
+ const resolved = resolveConfig({});
197
208
  state.config = applyAppState(resolved.config, state.appState);
198
209
  await requireFfmpegTools(resolveFfmpegTools(state.config));
199
210
  // One polite tile queue for the whole app: on-demand tiles and the export
@@ -244,6 +255,7 @@ function createWindow(state) {
244
255
  // The in-app menu bar owns all workspace commands; a native Alt/F10 menu
245
256
  // would compete with it, so none is installed (Windows and Linux).
246
257
  Menu.setApplicationMenu(null);
258
+ const t = translationFor(state);
247
259
  state.win = new BrowserWindow({
248
260
  width: 1600,
249
261
  height: 950,
@@ -254,7 +266,7 @@ function createWindow(state) {
254
266
  // Match --page in ui/app/globals.css so startup shows one background.
255
267
  backgroundColor: '#232323',
256
268
  // The loaded page's <title> takes over after load (ui/app/layout.tsx).
257
- title: 'Drone Path',
269
+ title: t('app.title'),
258
270
  // Windows renders an ICO best, Linux a PNG (Electron docs); both are
259
271
  // derived from build/icon-master.png (see build/README.md).
260
272
  icon:
@@ -291,13 +303,14 @@ function installCloseGuard(state) {
291
303
  }
292
304
  e.preventDefault();
293
305
  state.closePromptOpen = true;
306
+ const t = translationFor(state);
294
307
  const box = {
295
308
  type: 'warning',
296
- buttons: ['Stop Export and Close', 'Keep Exporting'],
309
+ buttons: [t('native.stopExport'), t('native.keepExporting')],
297
310
  defaultId: 1,
298
311
  cancelId: 1,
299
- message: 'An export is in progress',
300
- detail: 'Closing the window stops the export and removes its unfinished file.',
312
+ message: t('native.exportInProgress'),
313
+ detail: t('native.closeExportDetail'),
301
314
  };
302
315
  void (state.win ? dialog.showMessageBox(state.win, box) : dialog.showMessageBox(box)).then(
303
316
  ({ response }) => {
@@ -349,7 +362,7 @@ async function startup() {
349
362
  installCloseGuard(state);
350
363
  await loadUi(state);
351
364
  } catch (e) {
352
- fail(e);
365
+ fail(state, e);
353
366
  }
354
367
  }
355
368
 
package/app/preload.cjs CHANGED
@@ -11,6 +11,8 @@ function subscribe(channel, adapt) {
11
11
  contextBridge.exposeInMainWorld('dronepath', {
12
12
  pickRecording: (request) => ipcRenderer.invoke('dronepath:pick', request),
13
13
  getSession: () => ipcRenderer.invoke('dronepath:session'),
14
+ getLanguage: () => ipcRenderer.invoke('dronepath:language'),
15
+ saveLanguage: (preference) => ipcRenderer.invoke('dronepath:language:save', preference),
14
16
  getSettings: () => ipcRenderer.invoke('dronepath:settings'),
15
17
  saveSettings: (patch) => ipcRenderer.invoke('dronepath:settings:save', patch),
16
18
  pickExportOutput: () => ipcRenderer.invoke('dronepath:export:pick-output'),
package/dist/appstate.js CHANGED
@@ -5,7 +5,7 @@ import { DEFAULT_CONFIG, SETTINGS_KEYS, formatHud, parseSettingsPatch, parseValu
5
5
  import { errorMessage } from './errors.js';
6
6
  export const APP_STATE_VERSION = 1;
7
7
  export function emptyAppState() {
8
- return { settings: null, lastOpenDir: null };
8
+ return { settings: null, lastOpenDir: null, language: null };
9
9
  }
10
10
  function fillMissingSettings(raw) {
11
11
  if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
@@ -21,6 +21,7 @@ const APP_STATE_SHAPE = {
21
21
  version: z.unknown().optional(),
22
22
  settings: z.unknown().optional(),
23
23
  lastOpenDir: z.unknown().optional(),
24
+ language: z.unknown().optional(),
24
25
  };
25
26
  const LAST_OPEN_DIR = z
26
27
  .optional(z.nullable(z.string({
@@ -38,7 +39,11 @@ export function parseAppState(raw) {
38
39
  const settings = state.settings === undefined || state.settings === null
39
40
  ? null
40
41
  : parseSettingsPatch(fillMissingSettings(state.settings), 'app state');
41
- return { settings, lastOpenDir: parseValue(LAST_OPEN_DIR, state.lastOpenDir) };
42
+ return {
43
+ settings,
44
+ lastOpenDir: parseValue(LAST_OPEN_DIR, state.lastOpenDir),
45
+ language: typeof state.language === 'string' ? state.language : null,
46
+ };
42
47
  }
43
48
  export function serializeAppState(state) {
44
49
  const out = { version: APP_STATE_VERSION };
@@ -52,6 +57,8 @@ export function serializeAppState(state) {
52
57
  }
53
58
  if (state.lastOpenDir !== null)
54
59
  out.lastOpenDir = state.lastOpenDir;
60
+ if (state.language !== null)
61
+ out.language = state.language;
55
62
  return `${JSON.stringify(out, null, 2)}\n`;
56
63
  }
57
64
  export function applyAppState(config, state) {