mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
fix(layers): translate every route proxy refusal and clear stale receiver errorText
The route proxy also refuses with 'routing busy — too many routes at once' (429) and 'route proxy error'; both showed in English in every locale. Mark them in ROUTING_REFUSALS and add es, ru, zh-CN and zh-Hant entries. errorText is now cleared on a new connection, a mode switch and stop(), so it never outlives the error it describes. Tests cover the two refusals, 'Routing failed: rate limited' (pattern order) and the stop() reset.
This commit is contained in:
1 parent
11aad05dc9
commit
8cedd159e3
9 files changed
+48
-7
No files matched your search
@@ -1,4 +1,5 @@
|
||||
- Keep Directions route errors, the Local ADS-B receiver error and Global
|
||||
Context cohort reasons English in layer data; the Layers panel, Radio card
|
||||
and awareness panel still show them in the interface language
|
||||
(daikaginza, #1209).
|
||||
and awareness panel still show them in the interface language. The route
|
||||
proxy's "routing busy" and "route proxy error" refusals are now translated
|
||||
too (daikaginza, #1209).
|
||||
@@ -3001,5 +3001,7 @@
|
||||
"Your choice applies now, but could not be saved.": "Tu elección se aplica ahora, pero no se pudo guardar.",
|
||||
"Voice replies appear here.": "Las respuestas de voz aparecen aquí.",
|
||||
"Preview is off.": "La vista previa está desactivada.",
|
||||
"Automatic stop is unavailable for this voice connection.": "La parada automática no está disponible para esta conexión de voz."
|
||||
"Automatic stop is unavailable for this voice connection.": "La parada automática no está disponible para esta conexión de voz.",
|
||||
"routing busy — too many routes at once": "servicio de rutas ocupado: demasiadas rutas a la vez",
|
||||
"route proxy error": "error del proxy de rutas"
|
||||
}
|
||||
@@ -3070,5 +3070,7 @@
|
||||
"Your choice applies now, but could not be saved.": "Ваш выбор применён, но сохранить его не удалось.",
|
||||
"Voice replies appear here.": "Здесь появляются голосовые ответы.",
|
||||
"Preview is off.": "Предпросмотр отключён.",
|
||||
"Automatic stop is unavailable for this voice connection.": "Автоматическая остановка недоступна для этого голосового подключения."
|
||||
"Automatic stop is unavailable for this voice connection.": "Автоматическая остановка недоступна для этого голосового подключения.",
|
||||
"routing busy — too many routes at once": "сервис маршрутов занят: слишком много маршрутов одновременно",
|
||||
"route proxy error": "ошибка прокси маршрутов"
|
||||
}
|
||||
@@ -2863,5 +2863,7 @@
|
||||
"{count} placemarks": {
|
||||
"other": "{count} 个地标"
|
||||
},
|
||||
"S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.": "S2 Underground 在 GitHub 发布这些 KMZ 产品。新上传的内容会在数秒内被检测到,并自动替换旧版本。点击标记查看报告。"
|
||||
"S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.": "S2 Underground 在 GitHub 发布这些 KMZ 产品。新上传的内容会在数秒内被检测到,并自动替换旧版本。点击标记查看报告。",
|
||||
"routing busy — too many routes at once": "路线服务繁忙:同时请求的路线过多",
|
||||
"route proxy error": "路线代理出错"
|
||||
}
|
||||
@@ -2863,5 +2863,7 @@
|
||||
"{count} placemarks": {
|
||||
"other": "{count} 個地標"
|
||||
},
|
||||
"S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.": "S2 Underground 在 GitHub 發布這些 KMZ 產品。新上傳的內容會在數秒內被檢測到,並自動替換舊版本。點擊標記查看報告。"
|
||||
"S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.": "S2 Underground 在 GitHub 發布這些 KMZ 產品。新上傳的內容會在數秒內被檢測到,並自動替換舊版本。點擊標記查看報告。",
|
||||
"routing busy — too many routes at once": "路線服務繁忙:同時請求的路線過多",
|
||||
"route proxy error": "路線代理出錯"
|
||||
}
|
||||
@@ -99,6 +99,10 @@ for (const locale of ['es', 'ru']) {
|
||||
const row = rowFor(status, 0);
|
||||
assert.ok(row.includes(state.message), row);
|
||||
assert.doesNotMatch(row, /No RTL-SDR device selected/, row);
|
||||
|
||||
// The English text goes with the error: stop() clears it.
|
||||
await receiver.stop();
|
||||
assert.equal(receiver.getState().errorText, null);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
await receiver.destroy();
|
||||
|
||||
@@ -305,6 +305,7 @@ function describeConnectionError(error) {
|
||||
/**
|
||||
* State fields for a receiver error: `message` in the UI language for the
|
||||
* Radio card, `errorText` as English data for the Local ADS-B layer's stats.
|
||||
* A new connection, a mode switch and stop() clear `errorText` again.
|
||||
* @param {string} text English error text (ours or the browser's).
|
||||
*/
|
||||
function errorState(text) {
|
||||
@@ -360,6 +361,7 @@ export class SdrController {
|
||||
gain: this._gainByMode.fm,
|
||||
seeking: false,
|
||||
seekMessage: '',
|
||||
errorText: null,
|
||||
snr: null,
|
||||
aircraft: [],
|
||||
decodedMessages: 0,
|
||||
@@ -1082,6 +1084,7 @@ export class SdrController {
|
||||
this._setState({
|
||||
status: 'connecting',
|
||||
message: t('Waiting for an RTL-SDR device…'),
|
||||
errorText: null,
|
||||
});
|
||||
let acquisition = null;
|
||||
try {
|
||||
@@ -1554,6 +1557,7 @@ export class SdrController {
|
||||
message: t('Switching to {mode}…', {
|
||||
mode: nextMode === 'adsb' ? 'ADS-B' : 'FM',
|
||||
}),
|
||||
errorText: null,
|
||||
});
|
||||
try {
|
||||
if (nextMode === 'fm' && !(await this._ensureAudio())) {
|
||||
@@ -1869,7 +1873,7 @@ export class SdrController {
|
||||
status: preserveMessage ? this.state.status : idleStatus,
|
||||
...(preserveMessage
|
||||
? {}
|
||||
: { message: message || t('RTL-SDR disconnected') }),
|
||||
: { message: message || t('RTL-SDR disconnected'), errorText: null }),
|
||||
snr: null,
|
||||
samplesPerSecond: 0,
|
||||
workerBlocks: 0,
|
||||
|
||||
@@ -122,6 +122,8 @@ const ROUTING_REFUSALS = new Set([
|
||||
msg('routing service is rate limited'),
|
||||
msg('route leg too long'),
|
||||
msg('route too long'),
|
||||
msg('routing busy — too many routes at once'),
|
||||
msg('route proxy error'),
|
||||
]);
|
||||
const routingRefusal = (text) =>
|
||||
ROUTING_REFUSALS.has(text) ? t(text) : translateKnown(text);
|
||||
|
||||
@@ -83,6 +83,28 @@ for (const locale of ['es', 'ru']) {
|
||||
translateFeedError('Routing failed: something else'),
|
||||
t('Routing failed: {error}', { error: 'something else' }),
|
||||
);
|
||||
// Every refusal the proxy sends (server/providers/places/routes.js),
|
||||
// and "rate limited" after "Routing failed:", which the feed pattern
|
||||
// "<source> rate limited" would otherwise take.
|
||||
for (const [english, shown] of [
|
||||
[
|
||||
'routing busy — too many routes at once — try again in a moment',
|
||||
t('{error} — try again in a moment', {
|
||||
error: t('routing busy — too many routes at once'),
|
||||
}),
|
||||
],
|
||||
[
|
||||
'Routing failed: route proxy error',
|
||||
t('Routing failed: {error}', { error: t('route proxy error') }),
|
||||
],
|
||||
[
|
||||
'Routing failed: rate limited',
|
||||
t('Routing failed: {error}', { error: t('rate limited') }),
|
||||
],
|
||||
]) {
|
||||
assert.equal(translateFeedError(english), shown);
|
||||
assert.doesNotMatch(shown, /routing busy|route proxy|rate limited/);
|
||||
}
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user